From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100233 invoked by alias); 29 Sep 2017 15:15:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 99318 invoked by uid 89); 29 Sep 2017 15:15:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=attacks, mixing, sensitive, den X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Sep 2017 15:15:36 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E920ABDE3; Fri, 29 Sep 2017 15:15:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E920ABDE3 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law@redhat.com Received: from localhost.localdomain (ovpn-112-5.rdu2.redhat.com [10.10.112.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04F7718147; Fri, 29 Sep 2017 15:15:32 +0000 (UTC) From: Jeff Law To: gcc-patches Cc: Richard Earnshaw , James Greenhalgh , Wilco Dijkstra , Marcus Shawcroft Subject: [RFA][PATCH] Stack clash protection 07/08 -- V4 (aarch64 bits) Message-ID: <3a6b1bdf-df0f-a512-fd2b-116d57702bc7@redhat.com> Date: Fri, 29 Sep 2017 15:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2E43AD4D08D86DA498EF519B" X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg01964.txt.bz2 This is a multi-part message in MIME format. --------------2E43AD4D08D86DA498EF519B Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-length: 2531 Wilco has done most of the design/implementation review work to-date and should have state on most of this code. -- Here's the current aarch64 patch for stack clash protection. It's the only bits for stack clash protection that haven't been committed to the trunk. Looking through my archives I can't find the V3 patch. So I'm going to describe what's changed since the V2 patch. aarch64_output_probe_stack_range changes were slightly simplified. There was no need to set reg1 to stack_pointer_rtx for stack-clash protection. We have PARAMS for the size of the guard and the probe interval. For aarch64 we override the default guard size and set it to 64k. The guard size determines if we need probing and once we need probing the interval is determined by the probe interval. The reserved 1k for outgoing args doesn't have a PARAM since it's target specific. The code tries to handle probe intervals > ARITH_FACTOR, but I haven't thoroughly tested that. The code should add the appropriate notes to get the dwarf2 CFI records we need, including the case when we have a probing loop. The epilogue would sometimes elide setting IP0_REGNUM or IP1_REGNUM assuming the prologue had done so and left them in a usable state. However, those registers won't have the expected values when stack-clash protection is enabled. The epilogue has been updated to handle that case and avoid the incorrect optimization. This was tickled during testing. We emit REG_STACK_CHECK notes and blockage insns to prevent combine-stack-adjustments and/or the scheduler from mucking up the probing sequences. A testcase for this issue is included. This was discovered during binary scanning of glibc built with stack clash protection. The trailing probe to ensure that a caller always has a probe within 1k of the end of the outgoing args should be correct now. Testcases for a couple instances of this problem (from Wilco) are included. Similarly we turn on the hook to do the same for the alloca space. We no longer track the most recent probe. A better understanding of the aarch64 prologue code shows this wasn't really needed. This has been bootstrapped and regression tested on aarch64 linux. I've also bootstrapped and regression tested with stack clash protections enabled by default to exercise the code further (regressions in that case are related to mixing stack-clash and stack-check as well as the usual guality problems). Earlier versions have been used to build and test glibc as well. OK for the trunk? Jeff --------------2E43AD4D08D86DA498EF519B Content-Type: text/plain; charset=UTF-8; name="P" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="P" Content-length: 27463 Y29tbWl0IDdmY2RjNjkzMzUwMWY5YTZiMTI0MTc0ZThiMmM0MTEzYzNhZGNm MWQKQXV0aG9yOiByb290IDxyb290QGdpZ2FieXRlLXIxMjAtMDUua2h3Lmxh Yi5lbmcuYm9zLnJlZGhhdC5jb20+CkRhdGU6ICAgRnJpIEp1bCA3IDExOjE3 OjA2IDIwMTcgLTA0MDAKCiAgICAgICAgICAgICogY29uZmlnL2FhcmNoL2Fh cmNoNjQuYyAoYWFyY2g2NF9vdXRwdXRfcHJvYmVfc3RhY2tfcmFuZ2UpOiBI YW5kbGUKICAgICAgICAgICAgLWZzdGFjay1jbGFzaC1wcm90ZWN0aW9uIHBy b2JpbmcgdG9vLgogICAgICAgICAgICAoYWFyY2g2NF9hbGxvY2F0ZV9hbmRf cHJvYmVfc3RhY2tfc3BhY2UpOiBOZXcgZnVuY3Rpb24uCiAgICAgICAgICAg IChhYXJjaDY0X2V4cGFuZF9wcm9sb2d1ZSk6IEFzc2VydCB3ZSBuZXZlciBo YXZlIGJvdGggYW4gaW5pdGlhbAogICAgICAgICAgICBhZGp1c3RtZW50IGFu ZCBjYWxsZWUgc2F2ZSBhZGp1c3RtZW50LiAgUHJvYmUgYW5kIGR1bXAgYXMg bmVlZGVkIHdoZW4KICAgICAgICAgICAgLWZzdGFjay1jbGFzaC1wcm90ZWN0 aW9uIGlzIGVuYWJsZWQuCiAgICAgICAgICAgIChhYXJjaDY0X2V4cGFuZF9l cGlsb2d1ZSk6IERvIG5vdCBhc3N1bWUgdGhlIHByb2xvZ3VlIGhhcwogICAg ICAgICAgICBzZXQgSVAxX1JFR05VTSBvciBJUDBfUkVHTlVNIHRvIHVzZWZ1 bCB2YWx1ZXMgd2hlbgogICAgICAgICAgICAtZ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