From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mCxTc-0001Ro-5x for mharc-grub-devel@gnu.org; Mon, 09 Aug 2021 01:05:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCxTa-0001RS-L7 for grub-devel@gnu.org; Mon, 09 Aug 2021 01:05:26 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.109.102]:31057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCxTY-0005YD-4V for grub-devel@gnu.org; Mon, 09 Aug 2021 01:05:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1628485521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lYDgfg9fPezwwrpaAfoP2EE1sdoJfYMXWVEMCEWVwt4=; b=ZepjJ1thISsSMbpspFafWqP79wtYnON2/Pcy4LA79GmDvnSCjWyMzc93ReaUXEgQCF+CJ+ fUH7rEu/6VD2oigcVExrjPhtJgQdQ0KNF5HipyXbKYjZ6dLZi+CI4yWsVlf7jdOX6fkOsb 0wIvjdTb9yudLP6wetaM41GMa6ZYLDI= Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2109.outbound.protection.outlook.com [104.47.17.109]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-37-AWnXAALPOEiFxxdTD9nWBg-1; Mon, 09 Aug 2021 07:05:21 +0200 X-MC-Unique: AWnXAALPOEiFxxdTD9nWBg-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PiTfRZdy9DFupnIMWhL5kifbM/Tn4kjwmc3RfaOKpT5puCVjdLPS+C0EsFPf6lLxX9fD4Ti/zwZZNsTo8l74ohTNWqu36Fv5vX/yfnkSVqKLtsqrR9730LB3wHI7vYFpnFsAuxMHIr/k9uvFPRHtxOB/Btfu9EJ9wocOYMzAMUdkUzUjPN6nJdi0YQLqTk5PHVlyZ6nMJiHnOxhzwU/kkVFS7i/PKO+pbLfOubiF7mQE8QPg1X1bq9b4h6Z2Qi5K0SEvimEccVgsAYDHTna9KtF2+AX8N7d4FR5u1hLBbwDACdQo2nNJIZFIVqvUQ6A0Obg5446Wv5krG6trMIlmYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lYDgfg9fPezwwrpaAfoP2EE1sdoJfYMXWVEMCEWVwt4=; b=kZ/V7e8Co+ApP5rkLBS3VnRhOTHGBFdIaka5I1BfHYxCh7L2YXLex3whu4+hJW6SiuCwMPZbBk53OvK2SP4VAz1v6m9tFWl4ToFgEfNIT2Y/GxEx0M62PNAvVCFpTToxiZlj0HiZxvs2df71mEx+F3p7qXQSLoJl3FNNpe1PD3pFNMkKsv39R4vC8YS2LC0CqWSg3f2i9fYwPgIN3Hwt600Ozs7GIInqCwJCTX+uPrz9zc8t5bGTjKDIiHeLUu29pEvFFFRAPwQQZNfy5tf9hK6ByBAP3xnLudXVTS+75QzYamoGugbAhx3OpJc5WA9lu0tq+vgvoy5VA+jVd4AbXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=suse.com; Received: from DU2PR04MB8648.eurprd04.prod.outlook.com (2603:10a6:10:2df::21) by DU2PR04MB8678.eurprd04.prod.outlook.com (2603:10a6:10:2dd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.19; Mon, 9 Aug 2021 05:05:20 +0000 Received: from DU2PR04MB8648.eurprd04.prod.outlook.com ([fe80::5586:d75d:b656:b85]) by DU2PR04MB8648.eurprd04.prod.outlook.com ([fe80::5586:d75d:b656:b85%5]) with mapi id 15.20.4394.022; Mon, 9 Aug 2021 05:05:20 +0000 Date: Mon, 9 Aug 2021 13:05:12 +0800 From: Michael Chang To: The development of GNU GRUB Subject: Re: [PATCH] emu: fix executable stack marking Message-ID: <20210809050512.GB13488@mercury> References: <20210802094057.19319-1-mchang@suse.com> <20210805150505.l5npdmge7afibvk2@tomti.i.net-space.pl> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210805150505.l5npdmge7afibvk2@tomti.i.net-space.pl> User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: HK2PR0401CA0006.apcprd04.prod.outlook.com (2603:1096:202:2::16) To DU2PR04MB8648.eurprd04.prod.outlook.com (2603:10a6:10:2df::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost (36.226.40.253) by HK2PR0401CA0006.apcprd04.prod.outlook.com (2603:1096:202:2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Mon, 9 Aug 2021 05:05:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fd32d0d3-db53-4d56-cb1a-08d95af34920 X-MS-TrafficTypeDiagnostic: DU2PR04MB8678: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +Fv0nq74T5ZNQrtrC28dcdoqdw1gVl/8SIxobHXOcBd8hoPv/ewtbFPGajqQ4HsS1f6Bc7q1ReSC4kQNBVMnd2z+CB5OxY1g61MUvBoKvEV7HK/lrey209LbTdwufspGJRkW/3H0GdEYIwSi0iCmjajPAjHTm+SbLdCyK/LyA3mkMxgOaTlnKIKfNNX4z0vD4GPpRl+gmF7sdtitnIqUdfRmnEIgNcxQnT2Z5LIMo1oJxulhnUXeSo9WvZh3jreOsa4Gps6v7jam2I2rI1/JBLPDGbSO0dUM5yIYyBLsNqsSCMvquboG5ul5JREXiU2mSpHgmkhvIZFdkPZE8AQnNNUuXPuJzXrGCIWI+gBAWQnguPMcWTjmuZ/1em/g16TTYlVjhVaRaRk5YrQpgb4EK6n/ixk8SsLfXbDU2Nfv/FybYOvQxWLmEJi8h4XTWTrRksz+zLWMo3UDxivIovV6ctkgl9qLGZVL2Zo7+iYU/mOrh1a8zQ8H5fOQKyfLChWiOTQMDxG74QNno5kyPNisth+LcwhvZKJm3Q8oP5isikiKmcp3QF6yNMFZ/lehA00n6mYKjnWyljYbCV8nHJtIqpfMTUDk0e8YS0zfqNOzjClzszOUZ+N5SetTTo3gqQuTOFgFNNn79nS+AD/6w3PvkcfF8Ib5qGoHoky6oF9ozOpHmGdxREvFhpLStd6qI9KY3puRckPMRGh2jP50M5r7o1Xwlqv9Z3SHOg7BNixJ8a4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8648.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(7916004)(376002)(136003)(366004)(396003)(346002)(39850400004)(86362001)(5660300002)(6916009)(8936002)(33716001)(966005)(6666004)(66476007)(186003)(478600001)(66556008)(83380400001)(66946007)(26005)(6496006)(8676002)(38100700002)(33656002)(9686003)(6486002)(1076003)(2906002)(316002)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uD+yjk3q63CGa+GyH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?us-ascii?Q?+cYxR6N8GwpCOpCUgSKDvxsimSk/ZGOB7drf1pONnNtZop7IBnVyN3CraWYO?= =?us-ascii?Q?Wz2DmUDJ0jtWULZlYyC6Wj/iOLKA6I1qtDx+dN653Vgi1YfQCrvVP8gOSHbX?= =?us-ascii?Q?XtbdeP4+X4SeUMFfAo1LlURq2C52IXc3RkYjMldhpqnGINnz6U4t47EztQbH?= =?us-ascii?Q?5mOD+1dA/T0rRbXTEg7GciVhj8Ovu+rU0Xb2hYPa1Tjvs/jkdvs3GRDd6HQv?= =?us-ascii?Q?WsdJT4Oo4BgRBZ4eM54A5DqABOpFj1hT/1i/xNvEjrM+LbvoACE79cispMoX?= =?us-ascii?Q?ebqxOiO4p56bkQzWxy1yx/1qYCJQVu/FU2x0k3808YCflQtV8d3jewG7B6YY?= =?us-ascii?Q?5jpQStpsBlklwUIezSRMAwxS6wh8gu+WP60Eq6oq+l4DhqyW7Ne0zCNy58xn?= =?us-ascii?Q?+AaqFftFx9USXe9H7hOsSH6W?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd32d0d3-db53-4d56-cb1a-08d95af34920 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8648.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2021 05:05:20.1438 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TQLMdIlz0GVb4vw029VnVlXAxTZrnnGTa4YKRGruTNYZQSd01hMAqum3pc3Sf8Ns X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8678 Received-SPF: pass client-ip=194.104.109.102; envelope-from=mchang@suse.com; helo=de-smtp-delivery-102.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2021 05:05:26 -0000 On Thu, Aug 05, 2021 at 05:05:05PM +0200, Daniel Kiper wrote: > On Mon, Aug 02, 2021 at 05:40:57PM +0800, Michael Chang via Grub-devel wrote: > > The gcc by default assumes executable stack is required if the source > > object file doesn't have .note.GNU-stack section in place. If any of the > > source objects doesn't incorporate the GNU-stack note, the resulting > > program will have executable stack flag set in PT_GNU_STACK program > > header to instruct program loader or kernel to set up the exeutable > > stack when program loads to memory. > > > > Usually the .note.GNU-stack section will be generated by gcc > > automatically if it finds that executable stack is not required. However > > it doesn't take care of generating .note.GNU-stack section for those > > object files built from assembler sources. This leads to unnecessary > > risk of security of exploiting the executable stack because those > > assembler sources don't actually require stack to be executable to work. > > > > The grub-emu and grub-emu-lite are found to flag stack as executable > > revealed by execstack tool. > > Did you test all executables for all supported architectures and platforms? No. But the test should cover grub executables on as many plarforms as possbile as follow. i386-pc i386-efi x86_64-efi powerpc-ieee1275 arm64-efi x86_64-xen x86_64-emu arm64-emu > > $ mkdir -p build-emu && cd build-emu > > $ ../configure --with-platform=emu && make > > $ execstack -q grub-core/grub-emu grub-core/grub-emu-lite > > X grub-core/grub-emu > > X grub-core/grub-emu-lite > > > > This patch will add the missing GNU-stack note to the assembler source > > used by both utilities, therefore the result doesn't count on gcc > > default behavior and the executable stack is disabled. > > > > $ execstack -q grub-core/grub-emu grub-core/grub-emu-lite > > - grub-core/grub-emu > > - grub-core/grub-emu-lite > > > > Signed-off-by: Michael Chang > > Reviewed-by: Daniel Kiper Thanks for reviewing the patch. Regards, Michael > > Daniel > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel