From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by sourceware.org (Postfix) with ESMTPS id 3AE383858416 for ; Mon, 17 Jan 2022 17:54:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3AE383858416 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 ams.source.kernel.org (Postfix) with ESMTPS id 95195B81185; Mon, 17 Jan 2022 17:54:20 +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: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Mon, 17 Jan 2022 17:54:23 -0000 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