From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4.protonmail.ch (mail4.protonmail.ch [185.70.40.27]) by sourceware.org (Postfix) with ESMTPS id 5E3DC3857C68 for ; Sun, 25 Oct 2020 13:43:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5E3DC3857C68 Date: Sun, 25 Oct 2020 13:42:57 +0000 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=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, FREEMAIL_REPLYTO_END_DIGIT, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Sun, 25 Oct 2020 13:43:09 -0000 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