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=-8.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 21451C388F7 for ; Thu, 22 Oct 2020 07:28:12 +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 A1B3520848 for ; Thu, 22 Oct 2020 07:28:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="S3hT/kaB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1B3520848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=0pointer.de 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=XtQCUAO1pSLt0NW77ahzbz2jnvr4PI5wmYvDXC03lGs=; b=S3hT/kaBPPV9Ee0IMNVZRcFCQ U/Xi9Hil03TtUNe78ITIzpoeS5HrTstRqLSsjTtkvAfN4G3U3rxT18rJilXlh/DjFgbGy0ALu5YlY ebNyA0gA83zyJ2MJGphv/vrsDnZMNkHFqZmIwfLwb1wZ1ffrR7sEl2SqA7AAU8m518stdLj6+bOMo v5ss8YSqIHDJJuQIxev7SaZ+8suZu48RKMPKUSdeXgRqoFp5zD/4y5cT8z1uNxo0VnEYhEPL5qOP4 M4lyWte8QotCwt2sJDdpHWVEG+fpGLqu5leF+6T9pOkNeenOGH0O1p/wNfXb5yCRvXkWkb1/v+KKw y1RfaOKeQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVUzy-0002oO-Vc; Thu, 22 Oct 2020 07:26:59 +0000 Received: from gardel.0pointer.net ([85.214.157.71]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVUzw-0002mp-1b for linux-arm-kernel@lists.infradead.org; Thu, 22 Oct 2020 07:26:57 +0000 Received: from gardel-login.0pointer.net (gardel.0pointer.net [IPv6:2a01:238:43ed:c300:10c3:bcf3:3266:da74]) by gardel.0pointer.net (Postfix) with ESMTP id AC041E8080C; Thu, 22 Oct 2020 09:18:14 +0200 (CEST) Received: by gardel-login.0pointer.net (Postfix, from userid 1000) id 20608160834; Thu, 22 Oct 2020 09:18:12 +0200 (CEST) Date: Thu, 22 Oct 2020 09:18:12 +0200 From: Lennart Poettering To: Jeremy Linton Subject: Re: [systemd-devel] BTI interaction between seccomp filters in systemd and glibc mprotect calls, causing service failures Message-ID: <20201022071812.GA324655@gardel-login> References: <8584c14f-5c28-9d70-c054-7c78127d84ea@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <8584c14f-5c28-9d70-c054-7c78127d84ea@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201022_032656_208449_F1C95109 X-CRM114-Status: GOOD ( 16.45 ) 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 , systemd-devel@lists.freedesktop.org, Kees Cook , Szabolcs Nagy , Catalin Marinas , Will Deacon , "linux-kernel@vger.kernel.org" , Mark Brown , libc-alpha@sourceware.org, 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 Mi, 21.10.20 22:44, Jeremy Linton (jeremy.linton@arm.com) wrote: > Hi, > > There is a problem with glibc+systemd on BTI enabled systems. Systemd > has a service flag "MemoryDenyWriteExecute" which uses seccomp to deny > PROT_EXEC changes. Glibc enables BTI only on segments which are marked as > being BTI compatible by calling mprotect PROT_EXEC|PROT_BTI. That call is > caught by the seccomp filter, resulting in service failures. > > So, at the moment one has to pick either denying PROT_EXEC changes, or BTI. > This is obviously not desirable. > > Various changes have been suggested, replacing the mprotect with mmap calls > having PROT_BTI set on the original mapping, re-mmapping the segments, > implying PROT_EXEC on mprotect PROT_BTI calls when VM_EXEC is already set, > and various modification to seccomp to allow particular mprotect cases to > bypass the filters. In each case there seems to be an undesirable attribute > to the solution. > > So, whats the best solution? Did you see Topi's comments on the systemd issue? https://github.com/systemd/systemd/issues/17368#issuecomment-710485532 I think I agree with this: it's a bit weird to alter the bits after the fact. Can't glibc set up everything right from the begining? That would keep both concepts working. Lennart -- Lennart Poettering, Berlin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel