From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2065.outbound.protection.outlook.com [40.107.20.65]) by sourceware.org (Postfix) with ESMTPS id 67B6D3858C39 for ; Thu, 9 Dec 2021 11:11:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 67B6D3858C39 Received: from DB7PR05CA0018.eurprd05.prod.outlook.com (2603:10a6:10:36::31) by AM8PR08MB5714.eurprd08.prod.outlook.com (2603:10a6:20b:1dd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13; Thu, 9 Dec 2021 11:11:16 +0000 Received: from DB5EUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:36:cafe::68) by DB7PR05CA0018.outlook.office365.com (2603:10a6:10:36::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11 via Frontend Transport; Thu, 9 Dec 2021 11:11:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT063.mail.protection.outlook.com (10.152.20.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Thu, 9 Dec 2021 11:11:16 +0000 Received: ("Tessian outbound de6049708a0a:v110"); Thu, 09 Dec 2021 11:11:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8cd3fc06b39a2262 X-CR-MTA-TID: 64aa7808 Received: from 6e21fa10d25c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D23EE72F-75C1-42A6-826D-4ABEC510EB71.1; Thu, 09 Dec 2021 11:10:55 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6e21fa10d25c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 09 Dec 2021 11:10:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BuQvH6b1tv7ZnIa2eUbVgWd2BUzmP2wVitmOL56E2Ui1anKulHf9XX2reQiiKs6848TgoDE+993AGhHAWIz+jP9yqRwVj6farR9wHxr0WRSwF1Oza4R9wf+3WtD7EzH2orLiavlJkdXXqX3qryq4d4/IBDb/tA+I5GAeyASWm0YOTQoBXI7XSWAi1fniJGz0irhnAtACY5WzPkstBLBnojosPMPLxy6k97kLoavx1PgOQ/xXlrgmnLD6RKNwmDLdgK/wNN4pjKzDmzX9iasogzbIVSJ1yKeFY9KyC6goxwSIxUHC3ERFtgi3O4CIhVS2rIwdJhynF2knfrZguholSg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zbqrvd3J42TVhk9cK9IeaJNcX9Lw486UhJgw6CxsNXQ=; b=Y+HMEwlyxYeddcZYj4S2uBjJZwRgDMA1+EALe1Del4pSrhFP7ayPe+qfOfncU9q5l/c2gL0NAmAY7nZS2DkFnpvY74v5Jyjf/KePQ8Z2jDqnIvtkkNwpPe0cSglFkCBphZkvuy/4i5fu7n8f4C8ILG5N+F859r/44c749zrPfGtko6zRrwumKQmLjgSMMtaw2arXMkmzUgnFLSDWo4OSnaY/U3QlXzAL9PNfUS9fAgXA/jzpC8As4NSl2wfaHCT8DGFBWv9szswhnWYU2d+cwfvugwqsa47PvzAZWQbJWrHi53jRBP1W5Wc/YNZDRbV22Ri3g48HPXBOr6FcDdWosQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) by DU2PR08MB7312.eurprd08.prod.outlook.com (2603:10a6:10:2e7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Thu, 9 Dec 2021 11:10:51 +0000 Received: from DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::25f9:a7e6:422a:da43]) by DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::25f9:a7e6:422a:da43%6]) with mapi id 15.20.4755.022; Thu, 9 Dec 2021 11:10:51 +0000 Date: Thu, 9 Dec 2021 11:10:48 +0000 From: Szabolcs Nagy To: Catalin Marinas Cc: Mark Brown , Will Deacon , Jeremy Linton , "H . J . Lu" , Yu-cheng Yu , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, libc-alpha@sourceware.org, Mark Rutland Subject: Re: [PATCH v7 0/4] arm64: Enable BTI for the executable as well as the interpreter Message-ID: <20211209111048.GM3294453@arm.com> References: <20211115152714.3205552-1-broonie@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO4P265CA0011.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ad::19) To DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) MIME-Version: 1.0 Received: from arm.com (217.140.106.49) by LO4P265CA0011.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ad::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21 via Frontend Transport; Thu, 9 Dec 2021 11:10:50 +0000 X-MS-Office365-Filtering-Correlation-Id: 12f44a7c-3479-4364-3e36-08d9bb049e9f X-MS-TrafficTypeDiagnostic: DU2PR08MB7312:EE_|DB5EUR03FT063:EE_|AM8PR08MB5714:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ZgaWEUeTbQkqLjH3mzSTr5iQP1OLGEaTHiXNQwRxLQx6fvCJqx81+iOUDqP8jWoEzjXT6j9b36RBGyfxp2f7bCWsYDyccINqEVhqkzUi6D1DdWQnIRiwaHj/KnNSWwmeZlsdIxTta+F8ME88syrpA2MXKnhPsWYLND/gI4/fg3EiEErdlw3MlgthaIApSL5YfB5i1Zxsx/W2JuGILrtiTUYgIKxaoqj5Sb8FzvT8/Y8514Hdvrf6zNL3KYpz9Wv4oYji9AHs2KHTC/FGaOcTccds02WhbFu1+moN663SEZalY8lp6azklYfMgBkKS7MK3oTDxISQmTx9uiOoiqpW4SWJuzZUxv8Lmej2lMGRAdkSaGyqnpMKvY5MLREotl2GnbjyyedojZL9V3Gs1gC8U9obMr4w3vp00M2acZdQXOJxNRpOTPFeXmzr0f++t8iSwVtCLc59p6uLc4ZV7ZomNIt2BNZSAA2sVHGfG7+WS+cHKPZxkp4HCaIgkVmGpGB239/Ny2cvkb1iq7WBd6nYrwOzYqfjhMm0OpgaWAPSn4vOnefGIbBAiDp0GL37VLclkWXk/XBNGl5Sr4KCYlbtmLHL4PWnz0iBZNfzU4FbcGvH8pNStKB7N49CkmGi1e7ItbR7YwkvEXTUcoptPmG/nGhUnmvrMwjn593FLGLaLLnYgeQQhZMEojdjCRKI2Odcy8wfokZvSEz+mw/+cQUXRg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR08MB7179.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(5660300002)(1076003)(66946007)(6862004)(4326008)(52116002)(7696005)(38100700002)(38350700002)(83380400001)(66476007)(66556008)(26005)(33656002)(8886007)(2906002)(508600001)(37006003)(44832011)(6636002)(55016003)(36756003)(316002)(86362001)(54906003)(8936002)(2616005)(956004)(8676002)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB7312 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4e36cff7-1f05-4577-7116-08d9bb048f58 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mKsIZ6sTlbum5Oll50rqDzEcVzPtgMs3R9IpfIUyrPZ3mOKc4vB0oabsGFUSWkoeSCJvTg3qXEZDOXE6FGNyvRBQx6yJqKMOxBpYvrNhstkh6Busz5YTdYAwDx/Le9cZh1rNZfNmsB7rLWWuOVrL43dUIOjG5WhHoC7oA8Km8FSOx604hq1j2ZBEgoF2YpKQGjRZdCX28bBpI9hj7ZFElJ+v0vjQe1ZEwf2D/IPaRFNCW+zNdrHv6QFNcNq/6ThkjvdJkgZDAtJDwi/69va8SALGC+61LAUHn7qVFw6ScNdGFgPdRbDqKV99qrYFLRbxhRIScLoveXFgaaPfoGy2u0MetcgGLuM7ErQgC78brWDCvfkptCk63H4bWzCA8cnFIFniv+sYCmvMH3xPlomc33dr2GLp+KnOeAt+S9qJStRNANl9d/LUT19hQl2llbo/3aTxUpuh46ncIRgeg+dIbQKoxM/vLsK9qRvs66mBxpGQgrQDtFCHa8PXY+Kmox68KWuJQkBimn8Kw+qZGpIhYDoJDuyuPsKFeZchLXX8/ZYYvXBx8VbP9m7MBeYegoGLNR+7URWnkae78ZRw0nAIwxgNMUWAo6e9V/lXOBurlSGR05NGsr7Gq2mZcRndyeB6ycY6S7WZP6TdrXM5c5IyeL2lxiZLK5x2fbqix0PLJ3mD3EBtAXlpREHbcSQeQbFl/bVkNIqEP2QKYmUGhtS3GmocxRokS/SM6lL5hgdIlRRQpxf0uY12nKJNvzgSyj+NulTlo3K97lgsSs9m1UBgMA== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(44832011)(8936002)(70206006)(186003)(70586007)(36860700001)(33656002)(5660300002)(4326008)(8886007)(36756003)(2906002)(55016003)(82310400004)(40460700001)(7696005)(83380400001)(6862004)(26005)(956004)(1076003)(336012)(2616005)(54906003)(37006003)(47076005)(316002)(8676002)(81166007)(86362001)(356005)(6636002)(508600001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2021 11:11:16.5135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12f44a7c-3479-4364-3e36-08d9bb049e9f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5714 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2021 11:11:20 -0000 The 12/08/2021 18:23, Catalin Marinas wrote: > On Mon, Nov 15, 2021 at 03:27:10PM +0000, Mark Brown wrote: > > Deployments of BTI on arm64 have run into issues interacting with > > systemd's MemoryDenyWriteExecute feature. Currently for dynamically > > linked executables the kernel will only handle architecture specific > > properties like BTI for the interpreter, the expectation is that the > > interpreter will then handle any properties on the main executable. > > For BTI this means remapping the executable segments PROT_EXEC | > > PROT_BTI. > > > > This interacts poorly with MemoryDenyWriteExecute since that is > > implemented using a seccomp filter which prevents setting PROT_EXEC on > > already mapped memory and lacks the context to be able to detect that > > memory is already mapped with PROT_EXEC. This series resolves this by > > handling the BTI property for both the interpreter and the main > > executable. > > > > This does mean that we may get more code with BTI enabled if running on > > a system without BTI support in the dynamic linker, this is expected to > > be a safe configuration and testing seems to confirm that. It also > > reduces the flexibility userspace has to disable BTI but it is expected > > that for cases where there are problems which require BTI to be disabled > > it is more likely that it will need to be disabled on a system level. > > Given the silence on this series over the past months, I propose we drop > it. It's a bit unfortunate that systemd's MemoryDenyWriteExecute cannot > work with BTI but I also think the former is a pretty blunt hardening > mechanism (rejecting any mprotect(PROT_EXEC) regardless of the previous > attributes). > > I'm not a security expert to assess whether MDWX is more important than > BTI (hardware availability also influences the distros decision). My > suggestion would be to look at a better way to support the MDWX on the > long run that does not interfere with BTI. i still think it would be better if the kernel dealt with PROT_BTI for the exe loaded by the kernel. things work without this series as glibc will continue to apply mprotect and ignore the failure, but with the series security is tighter (neither mdwx nor bti are compromised). for unrelated reasons bti is not widely deployed currently so i guess there is no urgent interest in this.