Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp233016pxx; Wed, 28 Oct 2020 03:36:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7Aoakf238+P/xJSTI6etx5VY+By+kZcJ3hEVTCbiWKGxE61c/MnFj8d6zy6Da81+KUSuX X-Received: by 2002:a05:6402:32f:: with SMTP id q15mr6962241edw.230.1603881362760; Wed, 28 Oct 2020 03:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881362; cv=none; d=google.com; s=arc-20160816; b=uVgV2MFW60zBg2Uu0OSc6jrAbFm2KbY0BGDIaZg50/JmjFAXAVRHg8lS6cR9epmOPf BjpSls9PqszNCfSpQxKCfmmNxNKP00rIduO3qzkeggsUwvYYQHak2YmBOQSGeNduzKCF cJQwDA+QxHX9dp+ndYn8S9+Aah/UjOQXqK7SouuRWBIpqgz/nfOXTYiHEKmBOT6mHy1N yT3BhLntEEH0UwYqhEOMoxVstStBzGe5ys0l6I4rjoCD2O4ezlGSemte2+izIhc8g47x 3gQONjI350JhDWxqPS00nynHLbLuUhWVLL2npCeWbdN0V18RXBnn1/7DbCZBPcTyfG81 ksYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=W9LSlVFWDh1OdvfuuN7VkyRri+qKNeLwtHdr3XMqkNc=; b=q94T/FIVDIRZlQeAGxQaUNtRzv6etXFA9xqzHBCv0MOJoYslVNzwwSuKeQ80DB2AaX fMDm/b9SyfMwEGYliR9wMB9Uq+9YKD6GX3zdNYoWjsa5Dcy48IepZUl31KS37Vyw7w9X +qSahiEl7STkIgV4niIbHnxDP/e/ErbJL4XQ/Eo33gdbL28g46dWRyW5D0WfBsd8H+af 7yg9Hs3oMC9mth2XrqrGNP39Vy9r1PxXbNvbj9CkOvb3WtTo6Va0ZCt9JRP8qvxcZuWs Uf8wJ6hMgoooDcR8JUHwFN8dhVyhOqOcQdw/jFfp1xcX+HlxUfSC6uCp7/rBnZTTMIUn zrEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hO0iTJT1; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si2868715ejb.712.2020.10.28.03.35.40; Wed, 28 Oct 2020 03:36:02 -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=@redhat.com header.s=mimecast20190719 header.b=hO0iTJT1; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762578AbgJ0On3 (ORCPT + 99 others); Tue, 27 Oct 2020 10:43:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53400 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762205AbgJ0Ol2 (ORCPT ); Tue, 27 Oct 2020 10:41:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603809688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W9LSlVFWDh1OdvfuuN7VkyRri+qKNeLwtHdr3XMqkNc=; b=hO0iTJT1adAS2BomfQ8pEqABCz0h3BdBRDLZBZVLPw/8VhKhJ8c3r+vFaoGA2PALPlF6f3 TfL428PWDO+TjOfscby5/10PrcFm/FkTSEi7EvLx49E9CNtL5bgYrTVrFBLsuVLkzyfgsB g/3rdid9kqzptfVzezvpgQC0aleJI3E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-hOSFsm6JPoyZIcnOfGZVNg-1; Tue, 27 Oct 2020 10:41:23 -0400 X-MC-Unique: hOSFsm6JPoyZIcnOfGZVNg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4A6510866A0; Tue, 27 Oct 2020 14:41:20 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 378AB5C1BB; Tue, 27 Oct 2020 14:41:18 +0000 (UTC) From: Florian Weimer To: Dave Martin via Libc-alpha Cc: Dave Martin , Mark Rutland , systemd-devel@lists.freedesktop.org, Kees Cook , Catalin Marinas , Will Deacon , "linux-kernel@vger.kernel.org" , Jeremy Linton , Mark Brown , toiwoton@gmail.com, "linux-arm-kernel@lists.infradead.org" Subject: Re: BTI interaction between seccomp filters in systemd and glibc mprotect calls, causing service failures References: <8584c14f-5c28-9d70-c054-7c78127d84ea@arm.com> <20201026162410.GB27285@arm.com> <87r1pl9brd.fsf@oldenburg2.str.redhat.com> <20201027142218.GE27285@arm.com> Date: Tue, 27 Oct 2020 15:41:16 +0100 In-Reply-To: <20201027142218.GE27285@arm.com> (Dave Martin via Libc-alpha's message of "Tue, 27 Oct 2020 14:22:19 +0000") Message-ID: <877drb68ab.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Dave Martin via Libc-alpha: > On Mon, Oct 26, 2020 at 05:45:42PM +0100, Florian Weimer via Libc-alpha wrote: >> * Dave Martin via Libc-alpha: >> >> > Would it now help to add something like: >> > >> > int mchangeprot(void *addr, size_t len, int old_flags, int new_flags) >> > { >> > int ret = -EINVAL; >> > mmap_write_lock(current->mm); >> > if (all vmas in [addr .. addr + len) have >> > their mprotect flags set to old_flags) { >> > >> > ret = mprotect(addr, len, new_flags); >> > } >> > >> > mmap_write_unlock(current->mm); >> > return ret; >> > } >> >> I suggested something similar as well. Ideally, the interface would >> subsume pkey_mprotect, though, and have a separate flags argument from >> the protection flags. But then we run into argument list length limits. >> >> Thanks, >> Florian > > I suppose. Assuming that a syscall filter can inspect memory, we might > be able to bundle arguments into a struct if necessary. But that leads to a discussion about batch mmap/mprotect/munmap, and that's again incompatible with seccomp (it would need a checking loop). Thanks, Florian -- Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243, Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill