Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8912094rwr; Thu, 11 May 2023 07:43:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Imvu50SUe1bUokqFZ9DLWbrlPUO360Wdn/Q5aidj8hgjd8Di/P+mxEuHeoo10M/R9cG63 X-Received: by 2002:a17:902:ce91:b0:1ad:c1c2:7d1a with SMTP id f17-20020a170902ce9100b001adc1c27d1amr4073043plg.63.1683816233575; Thu, 11 May 2023 07:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683816233; cv=none; d=google.com; s=arc-20160816; b=CO+jbNSm+RzGo3AX5LOmPyTDGWEm2ed7q2JOgBvHG4gDWStqzixNg8jW2OZrnD3t87 XcCCJ8hc8XpbqrQxkiDNtbNu0ySW9SvgJQbXEkOccTTgmwpgQXO/RzuH/nluNGJuAjew hzamEleO6tue0tcVwGD93ArxUJEHOh04e4C/Zs+AgLlmglc7SwgELzTkaJ5A5JaGMjKA f32dDgB+RiHhqFCjU4bY9eeRXb+VYFHYfzq51EbLvPNf2s+ahKVDcJzm6ty2iYv+vKxC 8jDFyw/p+16jwSdntrBdAoLjiB02dYd8xROjokBZRF35EyrYT+MX2lQVgsQxgHWZKtVV A7pw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k24-20020a170902761800b001a990bcc3f5si6519944pll.392.2023.05.11.07.43.41; Thu, 11 May 2023 07:43:53 -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 S238054AbjEKO1j (ORCPT + 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 ); 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=20G=C3=B6ttsche?= To: selinux@vger.kernel.org Cc: Andrew Morton , Christian Brauner , Suren Baghdasaryan , "Liam R. Howlett" , "Michael S. Tsirkin" , Mike Christie , Mathieu Desnoyers , Andrei Vagin , Nicholas Piggin , Peter Zijlstra , 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v3: rename to capable_any() --- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.40.1