Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp919357ybh; Sun, 19 Jul 2020 03:06:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1y/Ha7bp51Aja0p8CecWISObfGtgy5f/66y5YLEACFtVy0ZbMddZ/5vi1UV5kD4d+n14K X-Received: by 2002:a17:906:5e0b:: with SMTP id n11mr16474398eju.15.1595153199177; Sun, 19 Jul 2020 03:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595153199; cv=none; d=google.com; s=arc-20160816; b=j3/5iRXj/apifyC1tSAob3CoP4LFah/x9l54W/W6XxBD8J3ebCDnVIwBsf2Ng2tdeX NQsKiYii6cg38rWcoboEcIhIk5+d9wnqkTI0RJ7bSohu0d/VZGeFS8+4UwksCdOvFWMU GkhbJnfgtniF1myretx8OVPCeGIeGOJhYdwYqLjgjvpOH2r3IgODHfBQABqRnp4Q3Pt/ uNaWoF7DhBuoWXJMD32f62ddVqhnbPB9UbcUMjIiQ2TRO6WOmfj3xtIQzkmrNc9UDURm d8WSDAIJqSjB+3yOWN4xglxVBP336w3F19EYp9mL9LGAnrI/rGDcefep7WdJVygA2o/D 71Zw== 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=e8qPhPXe8X77TQyQUPyP+913LMs/Q29Ll6dzrdr9bxI=; b=TZh4ervULrcxUvek9Fkz6DEHAWjNXevu8IjwHOE7jZ+Re2X4aGXVC8UjVdWk8LyciR 20V639nB33C50h9CpFibauGqv8nsARCRYf60KpzXSsgeP8ii4mDQcqz1fotscvEalJ5/ v/2ad/w5VUwaMjQswrqyL/sPstFd8pBGdkolpSFWoqPwj+Vp8eJB+fZiX1uABEz9VGZ1 5Kib0S69+JAVr7JFKRlI+8ntCfwoiu43/VjVNtcDA5vCruJN4YRX2TJ2ZZITDuXPQfJy lfGmglv8ZMAK6tekq+DziwIpFez9a3rauQhGWTbyPUcRE8v6QV3kjA1Zl/jkmZVlRft7 aTRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ExiMrSgl; 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 o21si8870504edv.451.2020.07.19.03.06.16; Sun, 19 Jul 2020 03:06:39 -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=ExiMrSgl; 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 S1726655AbgGSKFx (ORCPT + 99 others); Sun, 19 Jul 2020 06:05:53 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33040 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726608AbgGSKFx (ORCPT ); Sun, 19 Jul 2020 06:05:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595153152; 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=e8qPhPXe8X77TQyQUPyP+913LMs/Q29Ll6dzrdr9bxI=; b=ExiMrSgls14U8uLwqiGCpmKVJPxYEuE4RgX89y1biHA3E7Jk1HNFwqsXgJOWCCo/unmS46 bvNwvL3ly1tf6lis6q3p5fbLPW96GXJU4uMzvtgfvTUAN5iWQMFGV8bld/sLSuUJY/xHXR 2LpBMAw+Tjn0slsEQkAT1dnYA5bzc4I= 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-495-CaTTzOr-MRGi4__zGCbDNQ-1; Sun, 19 Jul 2020 06:05:50 -0400 X-MC-Unique: CaTTzOr-MRGi4__zGCbDNQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C13C418A1DE5; Sun, 19 Jul 2020 10:05:46 +0000 (UTC) Received: from dcbz.redhat.com (ovpn-112-10.ams2.redhat.com [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47960710A8; Sun, 19 Jul 2020 10:05:36 +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 v6 2/7] pid: use checkpoint_restore_ns_capable() for set_tid Date: Sun, 19 Jul 2020 12:04:12 +0200 Message-Id: <20200719100418.2112740-3-areber@redhat.com> In-Reply-To: <20200719100418.2112740-1-areber@redhat.com> References: <20200719100418.2112740-1-areber@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Acked-by: Christian Brauner Reviewed-by: Serge Hallyn --- 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