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 X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A07F3C433DB for ; Fri, 5 Feb 2021 17:52:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AA3964DEC for ; Fri, 5 Feb 2021 17:52:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AA3964DEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+5Kz1KUVKcZxBg+A++Rx2DoyoBHKOLosp5S1JFX6N+0=; b=weYXxxmK5Cf2YQrZ8GfN5XfHJ xjq4lrljuuFqNUM8OUpX+3zLjFB1s4I/nGOxx9oWTS8iLJGfyaac7MWOz5tXpexihBWJ+QcTmDjez NtS5+ntSOeODsg2rHM9zCXBuR5MqTnbC1GQ2ANTcFU8encFrsy4ewwHFwghiNqqcc6OeS7LEM5SDF 2Y/Hw9Ig9kUzp0HuNYLTBsHfK5M4QQscqLQhvzDB5cr9eEQInv+3IDkzctiaFJH9HzYDaby95Vk4y 9L6qUyRRFH6p2NZ+wHPnQsaGi4+38VHLcoYXbd2DZAMGPw1ebN15onSg45BjAGhHytyPSdvQjiXAw 23+9fijPw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l85Ga-0000Oe-Mp; Fri, 05 Feb 2021 17:51:36 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l85GY-0000O8-OQ for linux-arm-kernel@lists.infradead.org; Fri, 05 Feb 2021 17:51:35 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 37AEA64DDE; Fri, 5 Feb 2021 17:51:32 +0000 (UTC) Date: Fri, 5 Feb 2021 17:51:29 +0000 From: Catalin Marinas To: Mark Brown Subject: Re: [PATCH] arm64: bti: Set PROT_BTI on all BTI executables mapped by the kernel Message-ID: <20210205175128.GB12697@gaia> References: <20210205173837.39315-1-broonie@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210205173837.39315-1-broonie@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210205_125134_899810_51BFC375 X-CRM114-Status: GOOD ( 18.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , libc-alpha@sourceware.org, Kees Cook , Szabolcs Nagy , Jeremy Linton , Will Deacon , Dave Martin , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 05, 2021 at 05:38:37PM +0000, Mark Brown wrote: > Currently for dynamically linked executables the kernel only enables > PROT_BTI for the interpreter, the interpreter is responsible for > enabling it for everything else including the main executable. > Unfortunately this interacts poorly with systemd's > MemoryDenyWriteExecute feature which uses a seccomp filter to prevent > setting PROT_EXEC on already mapped memory via mprotect(), it lacks the > context to detect that PROT_EXEC is already set and so refuses to allow > the mprotect() on the main executable which the kernel has already > mapped. > > Since we don't want to force users to choose between having MDWX and BTI > as these are othogonal features have the kernel enable PROT_BTI for all > the ELF objects it loads, not just the dynamic linker. This means that > if there is a problem with BTI it will be harder to disable at the > executable level but we currently have no conditional support for this > in any libc anyway so that would be new development. Ideally we would > have interfaces that allowed us to more clearly specify what is enabled > and disabled by a given syscall but this would be a far more difficult > change to deploy. > > Reported-by: Jeremy Linton > Suggested-by: Catalin Marinas > Signed-off-by: Mark Brown > Cc: Mark Rutland > Cc: Szabolcs Nagy > Cc: Dave Martin > Cc: Kees Cook > Cc: libc-alpha@sourceware.org Thanks Mark for putting the patch together. You may want to add a reference to some of the discussions around the ABI, one of them: Link: https://lore.kernel.org/r/20201207200338.GB24625@arm.com/ (so we can keep Szabolcs accountable if something breaks ;)) For this patch: Reviewed-by: Catalin Marinas I wouldn't merge it as a fix yet but I'm ok with getting in 5.12 if Will is ok. It would give us some time to revert. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel