Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp557766pxu; Fri, 23 Oct 2020 07:51:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfBcD/fxM6e3ezqMxhavjwtZj4Wx7oIYTKxOlOmqeiDPWuh00Zvl6fz/UlWbYIKtO+Fw9Q X-Received: by 2002:a17:906:3daa:: with SMTP id y10mr2303574ejh.23.1603464706124; Fri, 23 Oct 2020 07:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603464706; cv=none; d=google.com; s=arc-20160816; b=gArAgb9OLA52nSgd/aExN53WCRwgFaKjUZ2vO6p8FEvDG547HYa/B8bFpWqZHaLwJf EgjQJ48EAud2whCgX0WfYbT4djIAHn/UCrEYGRKN/fd2O6PXuEDPjwMeDi8XFvU7nQJE 9e5IW4mTdf2o46j0j45OinldBYBXzk9HRcvUi5PjUSgiPOZbCRkp36oKo6lP/BpDRgZC +qEJXYOK8TI1apXPko5Sn/PKKKe5iC8HOwEjuU0LqptJwL60m3RsC2qdO4AELV4M19S9 pRMsTMtlkh7Ung1wj+EZhRxAoni7awLiBlkEC/8+wahqsUD2djx+qr2D3tvJznoGmIOb zOGA== 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; bh=fGIEycN6h572izK8ycACccepeDxAqGuMoT5obM9IKbQ=; b=xzPaoR312VIQw9c+L+77gPxm2f6acfjWGZ6wEgKSAle7BOb3N4OO0F7vq+WlKGNAc0 6GETGrqLt7RkGbuy9jhnKjyqm+IxTXPMNtN84uYoY52ZG9yfH6pSSWAcWZnHDZPRX4zU /PbG+DwQMKfAQH45EgwC4J96pIwXvmTUDymuN9ZF5TFmEHErqLf2snTDNekaghRY5hBk Tf99i8HDrpobJM2UeiQNURF8B3I/MoW43cLbomBctOJ09MlZjU3OfusM0ztjePWqBO8y +LI7KNNY7ypgW7FlJTsQbayIODT9B9DCDRXhGzuHZlO0B+gPC4i4hdAzlhQDugAU3yD4 EVgQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si1179096ejg.143.2020.10.23.07.51.23; Fri, 23 Oct 2020 07:51:46 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S461080AbgJWJE5 (ORCPT + 99 others); Fri, 23 Oct 2020 05:04:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:48540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S460856AbgJWJE5 (ORCPT ); Fri, 23 Oct 2020 05:04:57 -0400 Received: from gaia (unknown [95.145.162.19]) (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 6BB9524182; Fri, 23 Oct 2020 09:04:54 +0000 (UTC) Date: Fri, 23 Oct 2020 10:04:51 +0100 From: Catalin Marinas To: Szabolcs Nagy Cc: Lennart Poettering , Topi Miettinen , Florian Weimer , Mark Rutland , systemd-devel@lists.freedesktop.org, Kees Cook , Will Deacon , "linux-kernel@vger.kernel.org" , Mark Brown , libc-alpha@sourceware.org, Dave Martin , "linux-arm-kernel@lists.infradead.org" Subject: Re: [systemd-devel] BTI interaction between seccomp filters in systemd and glibc mprotect calls, causing service failures Message-ID: <20201023090451.GB25736@gaia> References: <8584c14f-5c28-9d70-c054-7c78127d84ea@arm.com> <20201022071812.GA324655@gardel-login> <87sga6snjn.fsf@oldenburg2.str.redhat.com> <511318fd-efde-f2fc-9159-9d16ac8d33a7@gmail.com> <20201022082912.GQ3819@arm.com> <20201022083823.GA324825@gardel-login> <20201022093104.GB1229@gaia> <20201023061316.GR3819@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201023061316.GR3819@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 23, 2020 at 07:13:17AM +0100, Szabolcs Nagy wrote: > The 10/22/2020 10:31, Catalin Marinas wrote: > > IIUC, the problem is with the main executable which is mapped by the > > kernel without PROT_BTI. The dynamic loader wants to set PROT_BTI but > > does not have the original file descriptor to be able to remap. Its only > > choice is mprotect() and this fails because of the MDWX policy. > > > > Not sure whether the kernel has the right information but could it map > > the main executable with PROT_BTI if the corresponding PT_GNU_PROPERTY > > is found? The current ABI states it only sets PROT_BTI for the > > interpreter who'd be responsible for setting the PROT_BTI on the main > > executable. I can't tell whether it would break anything but it's worth > > a try: > > i think it would work, but now i can't easily > tell from the libc if i have to do the mprotect > on the main exe or not. > > i guess i can just always mprotect and ignore > the failure? I replied to Keys before reading your email. So yeah, still issue mprotect() but ignore the failure. -- Catalin