From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125238 invoked by alias); 31 Jul 2018 21:01:57 -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 125226 invoked by uid 89); 31 Jul 2018 21:01:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0063.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.63) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Jul 2018 21:01:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gfRdWdQc30utOxf71RgY/I15i8V32457Slq+z/8zGRo=; b=UIDZ9FHS6c9u8eAncSpjKwehodHIFVM4JdzftVIZGf1sNmAlskCeL3fCySwCZQ3e3kJadBLY5d+DRGxqjCg5NVk5IJBpDMo/Axj7h9F+0azwJr5bm5pw4qX2sZAS9EL9icVu7K4IjWFDT4/qpZ1ibTzA9BY0D4Q6WHYdRgb9VQU= Received: from AM4PR08CA0075.eurprd08.prod.outlook.com (2603:10a6:205:2::46) by DB5PR08MB0533.eurprd08.prod.outlook.com (2a01:111:e400:5813::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.21; Tue, 31 Jul 2018 21:01:51 +0000 Received: from AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::202) by AM4PR08CA0075.outlook.office365.com (2603:10a6:205:2::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.995.18 via Frontend Transport; Tue, 31 Jul 2018 21:01:51 +0000 Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT026.mail.protection.outlook.com (10.152.16.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.1038.3 via Frontend Transport; Tue, 31 Jul 2018 21:01:50 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Tue, 31 Jul 2018 21:01:42 +0000 Received: from arm.com (10.2.206.78) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_RSA_WITH_AES_256_CBC_SHA256) id 15.1.1415.2 via Frontend Transport; Tue, 31 Jul 2018 21:01:42 +0000 Date: Tue, 31 Jul 2018 21:01:00 -0000 From: James Greenhalgh To: Tamar Christina CC: "gcc-patches@gcc.gnu.org" , nd , Richard Earnshaw , Marcus Shawcroft Subject: Re: [PATCH][GCC][AArch64] Set default values for stack-clash and do basic validation in back-end. [Patch (5/6)] Message-ID: <20180731210137.GA1826@arm.com> References: <20180711112251.GA15936@arm.com> <20180724102657.GB3249@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180724102657.GB3249@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Return-Path: James.Greenhalgh@arm.com X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg02005.txt.bz2 On Tue, Jul 24, 2018 at 05:27:05AM -0500, Tamar Christina wrote: > Hi All, > > This patch is a cascade update from having to re-spin the configure patch (no# 4 in the series). > > This patch enforces that the default guard size for stack-clash protection for > AArch64 be 64KB unless the user has overriden it via configure in which case > the user value is used as long as that value is within the valid range. > > It also does some basic validation to ensure that the guard size is only 4KB or > 64KB and also enforces that for aarch64 the stack-clash probing interval is > equal to the guard size. > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. > Target was tested with stack clash on and off by default. > > Ok for trunk? This is OK with the style changes below. Thanks, James > gcc/ > 2018-07-24 Tamar Christina > > PR target/86486 > * config/aarch64/aarch64.c (aarch64_override_options_internal): > Add validation for stack-clash parameters and set defaults. > > > -----Original Message----- > > From: Tamar Christina > > Sent: Wednesday, July 11, 2018 12:23 > > To: gcc-patches@gcc.gnu.org > > Cc: nd ; James Greenhalgh ; > > Richard Earnshaw ; Marcus Shawcroft > > > > Subject: [PATCH][GCC][AArch64] Set default values for stack-clash and do > > basic validation in back-end. [Patch (5/6)] > > > > Hi All, > > > > This patch enforces that the default guard size for stack-clash protection for > > AArch64 be 64KB unless the user has overriden it via configure in which case > > the user value is used as long as that value is within the valid range. > > > > It also does some basic validation to ensure that the guard size is only 4KB or > > 64KB and also enforces that for aarch64 the stack-clash probing interval is > > equal to the guard size. > > > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. > > Target was tested with stack clash on and off by default. > > > > Ok for trunk? > > > > Thanks, > > Tamar > > > > gcc/ > > 2018-07-11 Tamar Christina > > > > PR target/86486 > > * config/aarch64/aarch64.c (aarch64_override_options_internal): > > Add validation for stack-clash parameters. > > > > -- > diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c > index e2c34cdfc96a1d3f99f7e4834c66a7551464a518..30c62c406e10793fe041d54c73316a6c8d7c229f 100644 > --- a/gcc/config/aarch64/aarch64.c > +++ b/gcc/config/aarch64/aarch64.c > @@ -10916,6 +10916,37 @@ aarch64_override_options_internal (struct gcc_options *opts) > opts->x_param_values, > global_options_set.x_param_values); > > + /* If the user hasn't change it via configure then set the default to 64 KB s/change/changed/ > + for the backend. */ > + maybe_set_param_value (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE, > + DEFAULT_STK_CLASH_GUARD_SIZE == 0 > + ? 16 : DEFAULT_STK_CLASH_GUARD_SIZE, > + opts->x_param_values, > + global_options_set.x_param_values); > + > + /* Validate the guard size. */ > + int guard_size = PARAM_VALUE (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE); > + if (guard_size != 12 && guard_size != 16) > + error ("only values 12 (4 KB) and 16 (64 KB) are supported for guard " Formatting is wrong, two spaces to indent error. > + "size. Given value %d (%llu KB) is out of range.\n", No \n on errors. s/out of range/invalid/ > + guard_size, (1ULL << guard_size) / 1024ULL); > + > + /* Enforce that interval is the same size as size so the mid-end does the > + right thing. */ > + maybe_set_param_value (PARAM_STACK_CLASH_PROTECTION_PROBE_INTERVAL, > + guard_size, > + opts->x_param_values, > + global_options_set.x_param_values); > + > + /* The maybe_set calls won't update the value if the user has explicitly set > + one. Which means we need to validate that probing interval and guard size > + are equal. */ > + int probe_interval > + = PARAM_VALUE (PARAM_STACK_CLASH_PROTECTION_PROBE_INTERVAL); > + if (guard_size != probe_interval) > + error ("stack clash guard size '%d' must be equal to probing interval " > + "'%d'\n", guard_size, probe_interval); No \n on errors. > + > /* Enable sw prefetching at specified optimization level for > CPUS that have prefetch. Lower optimization level threshold by 1 > when profiling is enabled. */ >