Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1160666pxb; Wed, 4 Nov 2020 01:22:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGrOFdaH7PLq/TT07KRe+G0QHdh7smOkIOav64kBp21cYG9M6c4TDZHGoQa0UpBeW4F35N X-Received: by 2002:a05:6402:144b:: with SMTP id d11mr26479675edx.195.1604481772525; Wed, 04 Nov 2020 01:22:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604481772; cv=none; d=google.com; s=arc-20160816; b=gLEEqyg4UME1RcaMRDJ9tyM+eJ8i78vyzP2gvuaUZGppHCjlwipAKZkT/9Gf84k0Ur 6o+ICYc7UKVMPwwtGPwNpQFjrWi8IJwoNG3EOoBDo3eIneLmx3jUuDy6/caqEQoPj8DE QBUEY8DKC+Cspt067Z+K98S4Qn27gGtLxT0Hi98fO9XSeNg9B39xsnpp6XPmg54bcSTk NYp3xVCZWc+6lkQ9x5mWzkpc1GpDLuseNmJYO+PzOyL0Gkky+9BJ72b09Lbf6/9vZLQk Hluud6Z74/pTwSdePB8Hz7EYnDnRvLEZQb+sdaoHsD4D30KY4UInkVZ34bv4Nr8XyXqe 3O5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Kkd1B0PT0SmYwXeWy2+sJFv9FwxGQ0alVQsjCr0yDbs=; b=pxAfb2yan1r6fLKgkiHwPDgbWZLvyNdSGrkr1woEH3EtAc9mLYmo179+C8ZuHMn/Kd tC3WxrWvdk1eelrWAo6l9ovZuveriGp5SbYGNtorMv3q43vLR5Z9nMAq4UwKij93O8A1 1DH4v+d8GlWLKJ3X7zje6khl4BZlAir7/+cijT11kTNc40wfILoR5xk++wIsYdyirJHP fkb8Z+SqxCqOHBu1aDvz1H5hg0zoJsFDIXA8F/7Bx2lWrida+vnr/p6VT2jA0zyz/Vcb rVftXSTpUq/DcdfnTjXm6R4HOZiRxcamLnMsi6Rfss7H7k6QolPdUhULtsYVGCdL/bNs MdNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=npUyaTWC; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga3si1086936ejc.703.2020.11.04.01.22.28; Wed, 04 Nov 2020 01:22:52 -0800 (PST) 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=@kernel.org header.s=default header.b=npUyaTWC; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728029AbgKDJUU (ORCPT + 99 others); Wed, 4 Nov 2020 04:20:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:35938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725812AbgKDJUT (ORCPT ); Wed, 4 Nov 2020 04:20:19 -0500 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4689E20715; Wed, 4 Nov 2020 09:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604481619; bh=OB2pEHAq3eSy9zEaaBXh+kvuQPObkvMCdwCMUwzw1JY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=npUyaTWCrnrKnzUraBfak+xsfoK1LtFuckl7rhvbc/h3cxA+6xI9w8UKKlUbQZNVw 6tPD9MtchgCKOFA4wTe1S6ViePXtxYkmspUGsrF98MhWwKvTEjSpk2CTB/9TRa+tfT 3muQirkvuEYhnX6JeB8x0V62+X5I7KfSOSR0tBHE= Date: Wed, 4 Nov 2020 09:20:12 +0000 From: Will Deacon To: Mark Brown Cc: Szabolcs Nagy , libc-alpha@sourceware.org, Jeremy Linton , Catalin Marinas , Mark Rutland , Florian Weimer , Kees Cook , Salvatore Mesoraca , Lennart Poettering , Topi Miettinen , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com, linux-hardening@vger.kernel.org Subject: Re: [PATCH 0/4] aarch64: avoid mprotect(PROT_BTI|PROT_EXEC) [BZ #26831] Message-ID: <20201104092012.GA6439@willie-the-truck> References: <20201103173438.GD5545@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103173438.GD5545@sirena.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 03, 2020 at 05:34:38PM +0000, Mark Brown wrote: > On Tue, Nov 03, 2020 at 10:25:37AM +0000, Szabolcs Nagy wrote: > > > Re-mmap executable segments instead of mprotecting them in > > case mprotect is seccomp filtered. > > > For the kernel mapped main executable we don't have the fd > > for re-mmap so linux needs to be updated to add BTI. (In the > > presence of seccomp filters for mprotect(PROT_EXEC) the libc > > cannot change BTI protection at runtime based on user space > > policy so it is better if the kernel maps BTI compatible > > binaries with PROT_BTI by default.) > > Given that there were still some ongoing discussions on a more robust > kernel interface here and there seem to be a few concerns with this > series should we perhaps just take a step back and disable this seccomp > filter in systemd on arm64, at least for the time being? That seems > safer than rolling out things that set ABI quickly, a big part of the > reason we went with having the dynamic linker enable PROT_BTI in the > first place was to give us more flexibility to handle any unforseen > consequences of enabling BTI that we run into. We are going to have > similar issues with other features like MTE so we need to make sure that > whatever we're doing works with them too. > > Also updated to Will's current e-mail address - Will, do you have > thoughts on what we should do here? Changing the kernel to map the main executable with PROT_BTI by default is a user-visible change in behaviour and not without risk, so if we're going to do that then it needs to be opt-in because the current behaviour has been there since 5.8. I suppose we could shoe-horn in a cmdline option for 5.10 (which will be the first LTS with BTI) but it would be better to put up with the current ABI if possible. Is there real value in this seccomp filter if it only looks at mprotect(), or was it just implemented because it's easy to do and sounds like a good idea? Will