From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24142C433EF for ; Mon, 17 Jan 2022 17:54:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238034AbiAQRyU (ORCPT ); Mon, 17 Jan 2022 12:54:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58136 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233445AbiAQRyU (ORCPT ); Mon, 17 Jan 2022 12:54:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F048060F78 for ; Mon, 17 Jan 2022 17:54:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 977F8C36AE7; Mon, 17 Jan 2022 17:54:17 +0000 (UTC) Date: Mon, 17 Jan 2022 17:54:14 +0000 From: Catalin Marinas To: Mark Brown Cc: Jeremy Linton , Szabolcs Nagy , Will Deacon , "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: References: <20211115152714.3205552-1-broonie@kernel.org> <20211209111048.GM3294453@arm.com> <101d8e84-7429-bbf1-0271-5436eca0eea2@arm.com> <8550afd2-268d-a25f-88fd-0dd0b184ca23@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Fri, Jan 07, 2022 at 12:01:17PM +0000, Catalin Marinas wrote: > I think we can look at this from two angles: > > 1. Ignoring MDWE, should whoever does the original mmap() also honour > PROT_BTI? We do this for static binaries but, for consistency, should > we extend it to dynamic executable? > > 2. A 'simple' fix to allow MDWE together with BTI. Thinking about it, (1) is not that different from the kernel setting PROT_EXEC on the main executable when the dynamic loader could've done it as well. There is a case for making this more consistent: whoever does the mmap() should use the full attributes. Question for the toolchain people: would the compiler ever generate relocations in the main executable that the linker needs to resolve via an mprotect(READ|WRITE) followed by mprotect(READ|EXEC)? If yes, we'd better go for a proper MDWE implementation in the kernel. -- Catalin