Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp740987pxu; Fri, 23 Oct 2020 12:05:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0pomlD1zWfgLQHYbZQUjDVkSRBFrXYusDQJXnlKbq5ue+PxSm0w3qtL/E25/ksa75u3LF X-Received: by 2002:a17:906:3997:: with SMTP id h23mr1780861eje.191.1603479900117; Fri, 23 Oct 2020 12:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603479900; cv=none; d=google.com; s=arc-20160816; b=MaMKYFkrVblai5Pmi9g5Nx/txX6rmN42GIdcTCvxvMI4G76gBgVz6ZbIrBZOD/5EUP 7ApLyf4omz9APgF7LbXlRzq4AbLRHxu/d0sgAHhtopq6B+qApuy5QO8OhcntJKSUco+k su0eefcmS0SfZ73Ko1CGXRfPUOFilfBVBcPiknwlcYxYLGCEAdM/6FpHl7d36QPxeLvr 1cmuC7FVhQUCdSfZl5lyfj4Y9xKodf6M7LEb3CwxFnaCsKccEvYK3mcPG6gUnzA63Vv+ tvORfNWgiZgcBuMT52P5S/fpO1WtEqbuOlHxFCItgjmwTiycxS7GRwAjGNH6o6RNM6o0 iCmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VtAgTEHRkAGqz+I14jNPk509SDkqha7SHbM3mBCCgZY=; b=OtqiBrmJYP7QcNSgbqH1XfvngfrbBBbYXGiKhSYAbZ9cnDzENGFwZz1JVodBdMm41B I1sUDNMP8+D4fOvsWsBgKrdobJ2QD85ZOY39tLE0Q8k5QeGz0QDl+J16sY0BxxY39+jV gThuQAjqrWwviS0sRnw98FC084MnENUs7SKwcyOdcAgsp0EOtjvvoxeEykghhTcde1rr IEfXu0D8/xvut5G6TW+5XsviyM/ovNpKZIShVj6Uroqh6BdZhRhBSqN4x/1//dNX1b67 c5LFFxal9a5zkP2sO7wNpPFbdyfpXwVJLch/RQVs/F+1QdN5hyR34TzOepLt2IBIqbEy ElVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bD+nsvaI; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si1352123edq.306.2020.10.23.12.04.37; Fri, 23 Oct 2020 12:05:00 -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=@gmail.com header.s=20161025 header.b=bD+nsvaI; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753859AbgJWRxC (ORCPT + 99 others); Fri, 23 Oct 2020 13:53:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S463135AbgJWRxB (ORCPT ); Fri, 23 Oct 2020 13:53:01 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68C06C0613CE; Fri, 23 Oct 2020 10:53:01 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id y17so2205286ilg.4; Fri, 23 Oct 2020 10:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VtAgTEHRkAGqz+I14jNPk509SDkqha7SHbM3mBCCgZY=; b=bD+nsvaIX4zp29UYZ+2JOdkUFkScGE8zl+rcJpNB4AsWeJe0EJpHRYpGF9ckMXyEAE eY6nY+lL78x+HZe3dqUl0NiWH3V7J8yP9nwnBEh+ssJ6yWJ4KLH8KjbXfyTlckN25RX7 VkolVVpARdJ1j3kH8s9VUT9CY4qpphaYqthbfNQ+WP3Ff4aSw3LUoU5qWGc7iUFJ4n7y m1vAyhI1jWbcMfYcHDitC0D/AAPkG/igpqDpwO4crbtgU3PRhg2xswA6w78CDzh0jrBy /flM8gaJ2HK0VxqkgAi4O0EsED4eLdGMthqGWhfNnXJsLLDe2P8RUXvO4B5ieoJOO2Y+ XtuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VtAgTEHRkAGqz+I14jNPk509SDkqha7SHbM3mBCCgZY=; b=nkc8Wk3oe776csUvW9tKM5/TjkI769bbWQZLz2sM3MJLr7UvzfGLS+MS6NLGGa+Wt2 9hXbrU2Sr8/MPuoZRR+cRCLYJzZY0mLKyoKB+4nED58F4e1j6q6kiCKpp6UlAPJjEjZQ /x2QvJOJrhvxGdGFHRetdtATJ1pemGNeKiVponOccdntRBPENcA6JSROLRNa9GOSZJkb NDHA+LzDVjafpFb1W8z5o+r+SiZ9YkxNMibVnQxB17D+Z79FYRLhW6C3Cowu8346V19Y ApWURfbI4Z5XFJTH52kb3o1te+7b5lZBhA0zdciQNvqcCi1UjnfgB6JEDbpKQRZZ0n/g 6TsQ== X-Gm-Message-State: AOAM530PukmVntuq/bWd6EPs1Lt/8+ofst3PtijZ279K2WYDmQ/SkNcZ p44xUXUsYN1FrBqNDuuZjph86iCtjPNyJxpaqHUPsYp/Yk95sg== X-Received: by 2002:a92:ba14:: with SMTP id o20mr2650068ili.76.1603475580876; Fri, 23 Oct 2020 10:53:00 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <180cd894-d42d-2bdb-093c-b5360b0ecb1e@gmail.com> From: Salvatore Mesoraca Date: Fri, 23 Oct 2020 18:52:50 +0100 Message-ID: Subject: Re: BTI interaction between seccomp filters in systemd and glibc mprotect calls, causing service failures To: Topi Miettinen Cc: 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, 22 Oct 2020 at 23:24, Topi Miettinen 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=yes. SARA actually has a procattr[0] interface to do just that. There is also a library[1] to help using it. > I didn't also see specific measures against memfd_create() or file > system W&X, but perhaps those can be added later. You are right, there are no measures against those vectors. It would be interesting to add them, though. > Maybe pkey_mprotect() > is not handled either unless it uses the same LSM hook as mprotect(). IIRC mprotect is implemented more or less as a pkey_mprotect with -1 as pkey. The same LSM hook should cover both. Salvatore [0] https://lore.kernel.org/lkml/1562410493-8661-10-git-send-email-s.mesoraca16@gmail.com/ [1] https://github.com/smeso/libsara