Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp522173ybh; Wed, 15 Jul 2020 08:11:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXmGrMwSLjjvOgmuMoJ3K1yS3lJRTaRQaNDVUr97OsnNjyhaGUyL4siqQ4AR82itq0HPLs X-Received: by 2002:a17:906:408c:: with SMTP id u12mr9463607ejj.162.1594825878303; Wed, 15 Jul 2020 08:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594825878; cv=none; d=google.com; s=arc-20160816; b=qpY7g3i3h6VDIqcaQw+askrniOpxiYD6sstYGoRiJJcYJy+Uy1z51A569n51cc8vGj pHp9S7AvPrloQABf58akQooGIbpFWgy7P+JxLaXpCmBxD9J+DtGaU1kwlRqKKrzARmLl SbPAZ3XLvp64b1BiEKj/lwNUYMWiaFpW7HjXEkh8PnJTwWc7IcVF77vcHNR8DYCr5dXi savvfH2TayMc44Rvp3SGI7B/dbWgkfed18UwuVdO4oYEk7GnyLS0rAQhU0itGvMF+6XD wkyl2DJn6D7loLG1pYwTARgolQ1CDOr+RAOEWBSvBocbQTOImMe/sNWHEQrdxPlzwxOa Qu/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cFqxEO5GCd1e1dZ9OjJhtlzwIsLHCJufCpGCyw2ZCfQ=; b=LoWf3jtUl+t6UHxuAe4agCC75oY2gTyXECboPk+DvPnR0tPhUp/28h6TcQjUEYlVWh d580dHH1YpuwUctukIJTCe2eMhgRYLKGmKu+Vpz9j5ORTF1/wZkD8BcuvNRctbt/cu9L XoKspoXiw1PGTj+x9PqyC2J6qcJ7kJ3nMbEKcIk/wrNpZIWt2oJsPyiH/Xje+v6QqDn7 xovTFOUUncNIagpzmMO55zrovThO3MTh1lvz7lnpR0KaB2dt7X8c0J6NR8zj34qKgUqG MU6a2AXCRZtMkNbKG/zt6t3yJYR4lr/qiWZdnQFdvXkq6fALfNyOc6/7kOgJomcRxed4 mbXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YUEhM2Ed; 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 mf17si1399365ejb.86.2020.07.15.08.10.54; Wed, 15 Jul 2020 08:11:18 -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=YUEhM2Ed; 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 S1726766AbgGOOvc (ORCPT + 99 others); Wed, 15 Jul 2020 10:51:32 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:38496 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726759AbgGOOvb (ORCPT ); Wed, 15 Jul 2020 10:51:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594824690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cFqxEO5GCd1e1dZ9OjJhtlzwIsLHCJufCpGCyw2ZCfQ=; b=YUEhM2Ed+WCNg2/gpGqE/4HGmNv1rMNfh6157qn1WeJPApuz3FWKDbI8JRpRHF/iv7rmLc Zng9mgHsfColh2SR/7kKDXr77yjKQrD3b7WmHBf4zjn1wjVLNjUBneRzl4ykfXilG/Sdbf IMMP4KJ6SBaH761aK/cgQtdgJe/iW7g= 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-202-TmwZIEFRPpGGho2HLUOd2Q-1; Wed, 15 Jul 2020 10:51:26 -0400 X-MC-Unique: TmwZIEFRPpGGho2HLUOd2Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81A891009616; Wed, 15 Jul 2020 14:51:23 +0000 (UTC) Received: from dcbz.redhat.com (ovpn-114-113.ams2.redhat.com [10.36.114.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C09A60BF1; Wed, 15 Jul 2020 14:51:12 +0000 (UTC) From: Adrian Reber To: Christian Brauner , Eric Biederman , Pavel Emelyanov , Oleg Nesterov , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Nicolas Viennot , =?UTF-8?q?Micha=C5=82=20C=C5=82api=C5=84ski?= , Kamil Yurtsever , Dirk Petersen , Christine Flood , Casey Schaufler Cc: Mike Rapoport , Radostin Stoyanov , Adrian Reber , Cyrill Gorcunov , Serge Hallyn , Stephen Smalley , Sargun Dhillon , Arnd Bergmann , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, Eric Paris , Jann Horn , linux-fsdevel@vger.kernel.org Subject: [PATCH v5 2/6] pid: use checkpoint_restore_ns_capable() for set_tid Date: Wed, 15 Jul 2020 16:49:50 +0200 Message-Id: <20200715144954.1387760-3-areber@redhat.com> In-Reply-To: <20200715144954.1387760-1-areber@redhat.com> References: <20200715144954.1387760-1-areber@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the newly introduced capability CAP_CHECKPOINT_RESTORE to allow using clone3() with set_tid set. Signed-off-by: Adrian Reber Signed-off-by: Nicolas Viennot --- kernel/pid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/pid.c b/kernel/pid.c index de9d29c41d77..a9cbab0194d9 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -199,7 +199,7 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid, if (tid != 1 && !tmp->child_reaper) goto out_free; retval = -EPERM; - if (!ns_capable(tmp->user_ns, CAP_SYS_ADMIN)) + if (!checkpoint_restore_ns_capable(tmp->user_ns)) goto out_free; set_tid_size--; } -- 2.26.2