Message ID | 20230511142535.732324-7-cgzones@googlemail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4429150vqo; Thu, 11 May 2023 07:44:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40qn/nQaTXAK7GGqn6jiMXahXpK30kwQJR6bOUomyydBhv8jjqoFm/7Ydx5aCyjFBGOpBM X-Received: by 2002:a17:90a:e645:b0:247:35f8:81d2 with SMTP id ep5-20020a17090ae64500b0024735f881d2mr21345071pjb.29.1683816259041; Thu, 11 May 2023 07:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683816259; cv=none; d=google.com; s=arc-20160816; b=Go7dI/0qGbzrY+XSk7mJHWLQilf3iCtjw3MS9BKTwN4KLPRoki0wRnZgr/AX/gJ7KQ DlauTAaL4jww0AbD3pmSJcmLZxQl3jVrlYpa6ZB2cLD2Aho48xA7snFxMU+ZZZ8WS/Jt 5tTaKDPqbijWfGerEUYEq+aWC04N5nMM4DREyZdY+Qf1nXrXPTD+hrR3utZKcIEey5Dp 292E9EQBb66zyg7tsdsvoAeOlWS0WypK/484ylEUeb0pFvN/Y9KoeRpEIIQ6fXppqCLW eq4apDm8+H71hwu6A00MMjNIT74800KtrgFGxoxjIK3JdpXksX6QNIa54CKL0Bab3ktS rKIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=omcL1tQTkN45wCKai+1Kbbd8238ac0Z+pI3Znyzufew=; b=HoZ3nCqyPjbzvFa/LyARjvDUg5f6zZY9dVCLKXMF50KsEoVr7g5PMiVGOg7xkVz93Z 5880bGCAnqwn/kP/S3TaPVA5F4pTC+M9VvGNsIX4iXYM9Xol5TnFvXe/XLdNYNW1zpNA 1vNjlZpdWdzXuDjmdxqqsDNXMbubVfchV9UxkdpqiyhUBnOOoIIBEY1ohI/0wl1Kl0i1 V4pQWLesAIGga1I+JtmM8/Cp7TxuRewYiF95rbdnvKYEFUWETW8Fcr3u1QnNS9F5juuN 7M6v24e4213ss3frnQtbqWeOjGy938Afs2q+6TLLvV3MtKW+gxRhdUOjBp4CMn8ax131 Rg5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=rKqibNf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp14-20020a17090b190e00b0024696599329si20588749pjb.77.2023.05.11.07.44.06; Thu, 11 May 2023 07:44:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=rKqibNf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238110AbjEKO1j (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Thu, 11 May 2023 10:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238389AbjEKO06 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 11 May 2023 10:26:58 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09A1711568; Thu, 11 May 2023 07:26:41 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-50bd2d7ba74so79896065a12.1; Thu, 11 May 2023 07:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1683815200; x=1686407200; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=omcL1tQTkN45wCKai+1Kbbd8238ac0Z+pI3Znyzufew=; b=rKqibNf1l2a12KI79rqt5KPK4zm1S3BNWMM35Ahix1Jc8c38zD5DWVJbqB66b+JtD3 HDU694w3CQsEfsLkGWy0XOzhc04GoQn67u1tAxOkUHBAHSyWwR2C0rvfTjwL9x6lzlLs 6Gma1AQHwBXhb9DLBkBYQivjRJN3QLF93mnwRSqrsxW7RtI0Tzqn0cYU2e/IlQacAzSQ THkQ3suYfAAtNs7YgMY3bW0jn9CjozSNmVMRZTbSompRGyVpVRWzGgDRvDMwQt/743i/ Sl2JgX/H2nT3b/MUg4lk+1Pb5Q7m7krVG5qak/G1XHT47hcHnmrbGGUnc5Lus57t72sL 6KUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683815200; x=1686407200; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=omcL1tQTkN45wCKai+1Kbbd8238ac0Z+pI3Znyzufew=; b=hpRoIZRMIPq8Awpp7AUQuW9wovA3V9TcS48ycEk9k0OPyrHV7XhkUkunQu5nJEbJjy Kcme4BMHJuD07XDHPLidTP06SBxWuCDm3UncRo24mhySO/IOrN7mLMI4UX1EzQ3Bk00z Kl/BGCf1n3HL/Fgii6RrKoJ9/4UV90xDiSW7H7guHOdN45ZYLL3W+ost1t0x60V3iBck VUdZunxQo8RqEXEUUgW3Hu7oZLRokaHboiVkgsZDgIDYX01KV9m9FRgFwwEkmKGAqlkB lEDqA9U6C2yfvoPuqS3vG5UX+MOnZ+PJstNmW9QLZZXxvLkxRA75Zjj9335hMr9O7ud/ wM4g== X-Gm-Message-State: AC+VfDzt7iHoeac/KnCF1s+y8IuAzfrpd4HUKKkD/9QEzf/Vfo3RAE27 goam3nqTyM0u6otbzOHT58juKFO5IsVl8w== X-Received: by 2002:a17:907:1690:b0:94f:6316:ce8d with SMTP id hc16-20020a170907169000b0094f6316ce8dmr21600343ejc.34.1683815200236; Thu, 11 May 2023 07:26:40 -0700 (PDT) Received: from debianHome.localdomain (dynamic-077-008-180-228.77.8.pool.telefonica.de. [77.8.180.228]) by smtp.gmail.com with ESMTPSA id hf15-20020a1709072c4f00b0094f58a85bc5sm4056647ejc.180.2023.05.11.07.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 07:26:39 -0700 (PDT) From: =?utf-8?q?Christian_G=C3=B6ttsche?= <cgzones@googlemail.com> To: selinux@vger.kernel.org Cc: Andrew Morton <akpm@linux-foundation.org>, Christian Brauner <brauner@kernel.org>, Suren Baghdasaryan <surenb@google.com>, "Liam R. Howlett" <Liam.Howlett@oracle.com>, "Michael S. Tsirkin" <mst@redhat.com>, Mike Christie <michael.christie@oracle.com>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Andrei Vagin <avagin@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Peter Zijlstra <peterz@infradead.org>, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v4 7/9] kernel: use new capable_any functionality Date: Thu, 11 May 2023 16:25:30 +0200 Message-Id: <20230511142535.732324-7-cgzones@googlemail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230511142535.732324-1-cgzones@googlemail.com> References: <20230511142535.732324-1-cgzones@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765609317239183646?= X-GMAIL-MSGID: =?utf-8?q?1765609317239183646?= |
Series |
[v4,1/9] capability: introduce new capable flag NODENYAUDIT
|
|
Commit Message
Christian Göttsche
May 11, 2023, 2:25 p.m. UTC
Use the new added capable_any function in appropriate cases, where a
task is required to have any of two capabilities.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
v3:
rename to capable_any()
---
kernel/fork.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, May 11, 2023 at 04:25:30PM +0200, Christian Göttsche wrote: > Use the new added capable_any function in appropriate cases, where a > task is required to have any of two capabilities. > > Signed-off-by: Christian Göttsche <cgzones@googlemail.com> > --- Looks good to me, Reviewed-by: Christian Brauner <brauner@kernel.org>
diff --git a/kernel/fork.c b/kernel/fork.c index ed4e01daccaa..6e00933e8ef4 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2371,7 +2371,7 @@ __latent_entropy struct task_struct *copy_process( retval = -EAGAIN; if (is_rlimit_overlimit(task_ucounts(p), UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC))) { if (p->real_cred->user != INIT_USER && - !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) + !capable_any(CAP_SYS_RESOURCE, CAP_SYS_ADMIN)) goto bad_fork_cleanup_count; } current->flags &= ~PF_NPROC_EXCEEDED;