Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp522187ybh; Wed, 15 Jul 2020 08:11:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzy5zQxi3oOWRXzdUO3KDlRpudMvhJBG2FmTxByuBQyy21N7wYrpQYpLnOqkOFCmWDxYYw X-Received: by 2002:a17:906:a0c8:: with SMTP id bh8mr10371630ejb.190.1594825879346; Wed, 15 Jul 2020 08:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594825879; cv=none; d=google.com; s=arc-20160816; b=v5ZlVdAIuil10qHgrpLlkjzUMYOiJhhGwq6RVS/QowZhko0NMvRktbRgXUz5hYB0mg jmA+pFDq7Ry96cWKCbP9agggduetKuhXlJphB9CIUN/0H28sFQzGZjMCRopIod7EOhUK 7lwrIGnjXFh2m+1EMszhoxWn97qFe/BMdmgyl3q7NvYy+xQmaQ+IYgwt9bQfSrFFmCVk uFNA4XAp+kTXtVuUOjAARhNKRkvRteyKGJA7r1n8cVxFfpmfJuWCs8EOnLo44Vqd1Qaz esVCfjMS6m/o3uM1T/R90sJn8mxj5+8bfxyDTUIASnANyL/YD0V+0VGefwZ+qHtxy0Kf A0ZQ== 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=e+GUMkIqOM1756261b5DcpT99uKH+47iX9jCYAeaOt4=; b=JwLa2LHaLdaR2O61GoYOsUw3dmtyS6ic6xZ5RJLItw6bOMFx9RTzE1L3W3T9rf0LC8 Lfhk/n4ddUWdJfinJ85scgremmiE6z/yru/aatDQDf6ULhL39y6DjZHuJHa++Vir72Tt 943Af9FnXODQrj71azGWHJCAaCKsdPJvkq5JFCP4qPT2ZLDWOsrbVE9PFYeAZyzelBJ+ O6DVseBadeaYZWsm8JvCeptN1wXWvtynr4Zv844l4NUvPn9IDAuWmizY+vsTVFKdhvFp rpkefJjht6/IOBmOnfuVjTzZMNrOI7WV7ktmhLTGtazNH/FSZQbmtw2uSTLvRFVuW9qn vY3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fKyZ0cWR; 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 l14si1481251edq.355.2020.07.15.08.10.55; Wed, 15 Jul 2020 08:11:19 -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=fKyZ0cWR; 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 S1726759AbgGOOvj (ORCPT + 99 others); Wed, 15 Jul 2020 10:51:39 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:58102 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726803AbgGOOvi (ORCPT ); Wed, 15 Jul 2020 10:51:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594824696; 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=e+GUMkIqOM1756261b5DcpT99uKH+47iX9jCYAeaOt4=; b=fKyZ0cWReMV5tbZ3KYqO1+IxMKRLDNyAswjxwr3mBan89u5ma5r1lFY90uAHtnhdib1TUD oraleeEscUraRKtwvsP/5TDEqjVDEynEONjr1MITHoCHwBZ1EcmD4RVHVePaRl3wiBhAQ3 4qmO3WoaCkvrE6MzGHpPBuwGTKH2DzA= 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-267-1qTtWfGdMCGV4yDZuWsOng-1; Wed, 15 Jul 2020 10:51:34 -0400 X-MC-Unique: 1qTtWfGdMCGV4yDZuWsOng-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 C8B5E100AA23; Wed, 15 Jul 2020 14:51:31 +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 E795660BF4; Wed, 15 Jul 2020 14:51:24 +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 3/6] pid_namespace: use checkpoint_restore_ns_capable() for ns_last_pid Date: Wed, 15 Jul 2020 16:49:51 +0200 Message-Id: <20200715144954.1387760-4-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 writing to ns_last_pid. Signed-off-by: Adrian Reber Signed-off-by: Nicolas Viennot --- kernel/pid_namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index 0e5ac162c3a8..ac135bd600eb 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -269,7 +269,7 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write, struct ctl_table tmp = *table; int ret, next; - if (write && !ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN)) + if (write && !checkpoint_restore_ns_capable(pid_ns->user_ns)) return -EPERM; /* -- 2.26.2