Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp517881pxu; Sun, 25 Oct 2020 08:12:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5yM7etWRsQHnqe9Xs6iylva02HJRcN1BkkmVnKPx6LqbKjThzlFOw9TQrgpH7Ipd7mh+z X-Received: by 2002:a17:906:486:: with SMTP id f6mr11370742eja.473.1603638757567; Sun, 25 Oct 2020 08:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603638757; cv=none; d=google.com; s=arc-20160816; b=emwlm06fHvmVI+vsFtgdWJ40B70wRPTRpvRqbRsTpmN2JBA3qKW9OWKHeKPtXFl0wY C93xbFcFLGCAej/tByUF5nNRFJ4RcN2fkrT1PKcSRbnMa+LXfB1ZaZzNGR84yh/kEwlc oGoAfUz41TOsAjzkm8nMaVGNHHqjRdJCcekLXxIT/x8fEr441WVq4pjUJpnWfSUKGawD 9FI0t/CQZc34TnWgoBLFAhmNlGDdrmcubjuCz9amUrtDWfG0EDLvpTJ4dHllsnhb+v5C qZEvJ2+d7ujgtVlDZff23xMaZOyVDd/pQjZGhEC5irql0B6tG5bxusA+gc1d/JRMY+j+ +NQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=RztYREdZbMudtChMjooBjWJtc3ZFeXsHMYskl+O762c=; b=qzR341zuHJHsjV95yEx6Zl1TuRtn6+8fjsE2vaUy/5nE3YwvdGdMxRkkLMGWZzFn/k S0UvPPqMo0xbQnirK7HM9lJNPXLOyKlySAK0VVUTc3PVKttbIkDnOj4VqlzodK5OlkmC IlSa/C7dixEPHdVShGeQZTh5lx1NChvQu2sUesmQn7gd5Hx8HTk7MBpw5wLKqro38ziz wQ3B+Nvx9L/iaH4rGiIYVfbgYrgQhmZQS1q2XlkQFl4kj4u6m0Df0JeOsOauZ1/YEuVL eNLC+KIQJ12BQsL3x7IO+bQDzu6kiHjuCj6WpQt7buyQEcdd+w2m6fRLkwhCwoNwogt/ N4lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.ch header.s=protonmail header.b=sj0R0QHA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.ch Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs10si5151669edb.190.2020.10.25.08.12.15; Sun, 25 Oct 2020 08:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.ch header.s=protonmail header.b=sj0R0QHA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1416390AbgJYNnJ (ORCPT + 99 others); Sun, 25 Oct 2020 09:43:09 -0400 Received: from mail-03.mail-europe.com ([91.134.188.129]:44936 "EHLO mail-03.mail-europe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1416382AbgJYNnI (ORCPT ); Sun, 25 Oct 2020 09:43:08 -0400 Date: Sun, 25 Oct 2020 13:42:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.ch; s=protonmail; t=1603633383; bh=RztYREdZbMudtChMjooBjWJtc3ZFeXsHMYskl+O762c=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=sj0R0QHA8mqAXANRDKgYvjZhWMKMupZnQj4pVghO9waIHM0GZdAfuLoNKs8vyjMSR ihE/K6adlqkG3V5FlMGaysO/RHAjnG81d/8IKEt8QqJEw717G5vzYGzUsc7HLvQy+a JbQVwXnf3kpaeSfaQVe3QqKYJ4ub6Ae87GXO1U3g= To: Salvatore Mesoraca From: Jordan Glover Cc: Topi Miettinen , Kees Cook , Szabolcs Nagy , Jeremy Linton , "linux-arm-kernel@lists.infradead.org" , "libc-alpha@sourceware.org" , "systemd-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , Mark Rutland , Mark Brown , Dave Martin , Catalin Marinas , Will Deacon , Kernel Hardening , "linux-hardening@vger.kernel.org" Reply-To: Jordan Glover Subject: Re: BTI interaction between seccomp filters in systemd and glibc mprotect calls, causing service failures Message-ID: <_2cdGtwD1Z9iBKSrB4v55wrfcso1gpABXQas61V7fdAD2SqYF8RyG_ggCXGigvJ4jkMr7OlVLP484_SPsjP01JFeoI2_lP8PM4IOGZAlRBk=@protonmail.ch> In-Reply-To: References: <8584c14f-5c28-9d70-c054-7c78127d84ea@arm.com> <20201022075447.GO3819@arm.com> <78464155-f459-773f-d0ee-c5bdbeb39e5d@gmail.com> <202010221256.A4F95FD11@keescook> <180cd894-d42d-2bdb-093c-b5360b0ecb1e@gmail.com> <3cb894d4-049f-aa25-4450-d1df36a1b92e@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.7 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday, October 24, 2020 2:12 PM, Salvatore Mesoraca wrote: > On Sat, 24 Oct 2020 at 12:34, Topi Miettinen toiwoton@gmail.com wrote: > > > On 23.10.2020 20.52, Salvatore Mesoraca wrote: > > > > > Hi, > > > On Thu, 22 Oct 2020 at 23:24, Topi Miettinen toiwoton@gmail.com wrote= : > > > > > > > SARA looks interesting. What is missing is a prctl() to enable all = W^X > > > > protections irrevocably for the current process, then systemd could > > > > enable it for services with MemoryDenyWriteExecute=3Dyes. > > > > > > SARA actually has a procattr[0] interface to do just that. > > > There is also a library[1] to help using it. > > > > That means that /proc has to be available and writable at that point, s= o > > setting up procattrs has to be done before mount namespaces are set up. > > In general, it would be nice for sandboxing facilities in kernel if > > there would be a way to start enforcing restrictions only at next > > execve(), like setexeccon() for SELinux and aa_change_onexec() for > > AppArmor. Otherwise the exact order of setting up various sandboxing > > options can be very tricky to arrange correctly, since each option may > > have a subtle effect to the sandboxing features enabled later. In case > > of SARA, the operations done between shuffling the mount namespace and > > before execve() shouldn't be affected so it isn't important. Even if it > > did (a new sandboxing feature in the future would need trampolines or > > JIT code generation), maybe the procattr file could be opened early but > > it could be written closer to execve(). > > A new "apply on exec" procattr file seems reasonable and relatively easy = to add. > As Kees pointed out, the main obstacle here is the fact that SARA is > not upstream :( > > Salvatore Is there a chance we will see new SARA iteration soon on lkml? :) Jordan