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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 CAEC4C388F9 for ; Fri, 23 Oct 2020 09:04:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7378A24248 for ; Fri, 23 Oct 2020 09:04:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S461084AbgJWJE5 (ORCPT ); Fri, 23 Oct 2020 05:04:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:48540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S460856AbgJWJE5 (ORCPT ); Fri, 23 Oct 2020 05:04:57 -0400 Received: from gaia (unknown [95.145.162.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6BB9524182; Fri, 23 Oct 2020 09:04:54 +0000 (UTC) Date: Fri, 23 Oct 2020 10:04:51 +0100 From: Catalin Marinas To: Szabolcs Nagy Cc: Lennart Poettering , Topi Miettinen , Florian Weimer , Mark Rutland , systemd-devel@lists.freedesktop.org, Kees Cook , Will Deacon , "linux-kernel@vger.kernel.org" , Mark Brown , libc-alpha@sourceware.org, Dave Martin , "linux-arm-kernel@lists.infradead.org" Subject: Re: [systemd-devel] BTI interaction between seccomp filters in systemd and glibc mprotect calls, causing service failures Message-ID: <20201023090451.GB25736@gaia> References: <8584c14f-5c28-9d70-c054-7c78127d84ea@arm.com> <20201022071812.GA324655@gardel-login> <87sga6snjn.fsf@oldenburg2.str.redhat.com> <511318fd-efde-f2fc-9159-9d16ac8d33a7@gmail.com> <20201022082912.GQ3819@arm.com> <20201022083823.GA324825@gardel-login> <20201022093104.GB1229@gaia> <20201023061316.GR3819@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201023061316.GR3819@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 23, 2020 at 07:13:17AM +0100, Szabolcs Nagy wrote: > The 10/22/2020 10:31, Catalin Marinas wrote: > > IIUC, the problem is with the main executable which is mapped by the > > kernel without PROT_BTI. The dynamic loader wants to set PROT_BTI but > > does not have the original file descriptor to be able to remap. Its only > > choice is mprotect() and this fails because of the MDWX policy. > > > > Not sure whether the kernel has the right information but could it map > > the main executable with PROT_BTI if the corresponding PT_GNU_PROPERTY > > is found? The current ABI states it only sets PROT_BTI for the > > interpreter who'd be responsible for setting the PROT_BTI on the main > > executable. I can't tell whether it would break anything but it's worth > > a try: > > i think it would work, but now i can't easily > tell from the libc if i have to do the mprotect > on the main exe or not. > > i guess i can just always mprotect and ignore > the failure? I replied to Keys before reading your email. So yeah, still issue mprotect() but ignore the failure. -- Catalin 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=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 8D663C388F9 for ; Fri, 23 Oct 2020 09:06:14 +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 F1E8C24182 for ; Fri, 23 Oct 2020 09:06:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1jmXWhYu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1E8C24182 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=y9Rut2n8wUW3KkF81pCndCihHKLtzJDTfu8iGZIK/LM=; b=1jmXWhYuZAT7AghSw6QuC1pti d1rzhQKqEv03iGT60Gvcf1dR7cr5boccbwtxDxFxFuKqJjssUePJ84GwJyFU4uMfEDkmEfLjFuVNc 7bulmHrlEldglUagr/pkrBs8Rnh1NsPZD58J5unkTuQ1PirNT0w3eVj79ALuOC3QhwASizGLAiVwA YTbAY+0totNFwdR5QrzzbCjUD2D3ILtQxMi0XFqkEIt3dMFAe7IjznvOnIp5BNb4TBWyxcveySxi2 r/mKfO1TVqm7FkOcnKtHLMrnz5kqUtgfVz9qleOVUiVJqdLizPLY6CoHQCAklkAam6gppzzPZ8wJL ckSwlZI5Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVt0O-0006Fg-Lw; Fri, 23 Oct 2020 09:05:00 +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 1kVt0L-0006Ew-Si for linux-arm-kernel@lists.infradead.org; Fri, 23 Oct 2020 09:04:58 +0000 Received: from gaia (unknown [95.145.162.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6BB9524182; Fri, 23 Oct 2020 09:04:54 +0000 (UTC) Date: Fri, 23 Oct 2020 10:04:51 +0100 From: Catalin Marinas To: Szabolcs Nagy Subject: Re: [systemd-devel] BTI interaction between seccomp filters in systemd and glibc mprotect calls, causing service failures Message-ID: <20201023090451.GB25736@gaia> References: <8584c14f-5c28-9d70-c054-7c78127d84ea@arm.com> <20201022071812.GA324655@gardel-login> <87sga6snjn.fsf@oldenburg2.str.redhat.com> <511318fd-efde-f2fc-9159-9d16ac8d33a7@gmail.com> <20201022082912.GQ3819@arm.com> <20201022083823.GA324825@gardel-login> <20201022093104.GB1229@gaia> <20201023061316.GR3819@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201023061316.GR3819@arm.com> 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-20201023_050458_034549_41F599AC X-CRM114-Status: GOOD ( 21.70 ) 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: Florian Weimer , Mark Rutland , systemd-devel@lists.freedesktop.org, Kees Cook , libc-alpha@sourceware.org, Will Deacon , "linux-kernel@vger.kernel.org" , Mark Brown , Topi Miettinen , Lennart Poettering , 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, Oct 23, 2020 at 07:13:17AM +0100, Szabolcs Nagy wrote: > The 10/22/2020 10:31, Catalin Marinas wrote: > > IIUC, the problem is with the main executable which is mapped by the > > kernel without PROT_BTI. The dynamic loader wants to set PROT_BTI but > > does not have the original file descriptor to be able to remap. Its only > > choice is mprotect() and this fails because of the MDWX policy. > > > > Not sure whether the kernel has the right information but could it map > > the main executable with PROT_BTI if the corresponding PT_GNU_PROPERTY > > is found? The current ABI states it only sets PROT_BTI for the > > interpreter who'd be responsible for setting the PROT_BTI on the main > > executable. I can't tell whether it would break anything but it's worth > > a try: > > i think it would work, but now i can't easily > tell from the libc if i have to do the mprotect > on the main exe or not. > > i guess i can just always mprotect and ignore > the failure? I replied to Keys before reading your email. So yeah, still issue mprotect() but ignore the failure. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel