From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by sourceware.org (Postfix) with ESMTPS id 50C8A385783E for ; Fri, 23 Oct 2020 17:53:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 50C8A385783E Received: by mail-il1-x142.google.com with SMTP id a20so2176989ilk.13 for ; Fri, 23 Oct 2020 10:53:01 -0700 (PDT) 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=Be6X70Qx/4dzkotIaU5B13So782ASL7iqFiehSXgx6TeIuVFH1Xyp4j38rBLtfkmaF 3Z4LTJI+M+++BVEWZWMUQ/L5gpKCFNytecMs3KTTfdyuQtrt9JY91gFD9SojE4e99krM YydDPsLeNO8lwHKcZDhgGAhmrdjIG3xlbm5gXcx5yio8oPaJHdsGSe8DZ3iAa1vk+pd5 82jrXDup8YZTUhaJy1v1KHJ3x0A31AoYkaMtHVrwfYfh2ZCIuFMrAPNczNLUgoxRD1YZ +mrTmnMHi0v2UL7M4I4q7shxZ/YuTsMppIujuA3lEWzauGc1Zzno2TboIqsx/dp2qJ2l nXlQ== X-Gm-Message-State: AOAM531Z58Mn7W9I3MNgEkeOiGSMyqPtrXQqsrgOyg2r3Eu2e27hyzIH bdtgPxq3dFUlPrW48wPPS38fkx8YunVbTSgHU5o= X-Google-Smtp-Source: ABdhPJy2EtC+Jp6f2du99WT/FJet4nqfOd4rMxYcV8yqiQVUKzPy9q5NN3+QK+mO/scRsa8G2nVIF4q9Fo9IJWlasYo= 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" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: Fri, 23 Oct 2020 17:53:02 -0000 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