Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp181302iob; Mon, 2 May 2022 16:28:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtdHogrZtnxZBd2nad/79U4/H3hNZnvhFdRt7wwUBbhtWQFaj0WZyvzXF+AL2qcSCgx8xT X-Received: by 2002:a17:90b:4c09:b0:1dc:6c30:f230 with SMTP id na9-20020a17090b4c0900b001dc6c30f230mr1700144pjb.110.1651534114506; Mon, 02 May 2022 16:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651534114; cv=none; d=google.com; s=arc-20160816; b=eLleV6/f9VE9dtVJGRGP5DH/hswD6nLWoRQM2L6FjS3QhQIN8vhFeWnBwx8hwD6iWm eYRQMuWJBCKodh9YfvU3oluSTWKneV+ZKMSEx0xYyCVrnbF/zPAzv5h71VfK76vPDG2M nYufxfdHZS2JRHMp7N5j9zdFf7b28uWWJ0CvUD/VMnxfrwdcPAwaEYAic8cO7wS06ZIi 1TQ56xZm0APs+XJCl+hh6IM7F5vhv46OqBbPN6s9vn/5kXsGj9PjlHK9cVr3+/YdUeU4 nZHK43Ff8OStw+TmFEoIT0xO6HqdNwaGt6g/Sg8pI23AMv0bjeSCFqt3tc/Nz1gtaMpO R3rg== 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=Os4/s4uH06DSewsQZ4Jw4mtY1gOh+ru8ll+LispUhdk=; b=HzlPxfyC3eFwsJESPLXqZcQJCn3fa1XYfZ4CXxkvBWs3hbd9qraNkkVqeBMyugYIh4 JG3uFy4hadaIq/aqj2uRa7MTKHknh3ZDAMe1W/W+UuuYZr5+ZDdVI253AXrW3YoNNjIR KpElMbci5WA4vgUSj9XZb/TG0ib+StFnqhZktHahdZLJB2OHxJ6C7xdzPd7FzOu9oxSd Mi/tUjT8Pyhc/VYEelFBmVegPOp/uAjuqIdkULuLmJMGsEL5Qo8Er9q1e6/SBDcvrU68 jd7kQPtaoBs8qGO0b6a4R3IPSr/7wrp8TYt/MfT+sNPdBf4NGP4AApX34aI5JTB7SXnI 41ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=De0pLEoi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i6-20020a62c106000000b004fa831f601csi14510244pfg.231.2022.05.02.16.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=De0pLEoi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 00226655B; Mon, 2 May 2022 16:28:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386058AbiEBQEu (ORCPT + 99 others); Mon, 2 May 2022 12:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386119AbiEBQEf (ORCPT ); Mon, 2 May 2022 12:04:35 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54562BC9C; Mon, 2 May 2022 09:00:54 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id l18so28559074ejc.7; Mon, 02 May 2022 09:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Os4/s4uH06DSewsQZ4Jw4mtY1gOh+ru8ll+LispUhdk=; b=De0pLEoiOywAueFbxfwipQsICqvS0dsuUca/89fJwmt8cMOCADBrLd0jk/+L3uSjIw 2UIjl7fmHwEZv4kzpuU12JiX6t/hMIcRKrozwHoObJbe9vcKPsPYz3yF+A4tOu3QQzQu jJJ907cxlGe5ZhwrEpVu+eXW2I+w7QNe/wwhnRaac4iDzYXZWf7Tl6BHov6x44MGFzhv md/jQ1niDinl3W2S90Es19kf8nlUMyNqDk7DReRJON/IKscLS0AwPPeeir2fFgQ5tKlz B63TKfB7k12MM30ceHweTK2NAcvWQAEHZs0WX1AZAwYsdQbu4P2g/WRBq75njU/iMbeN y54w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Os4/s4uH06DSewsQZ4Jw4mtY1gOh+ru8ll+LispUhdk=; b=zS+45VSY7tL7P4VXD5vF7AU91oQl6n2juVugkjuJcl7WwbvqXbwCFOSdxn8JRLy4qj J7YiIfaOxfBbQBJiEqkpIXVYDN0EHoFNbd8CEp2lq2EABUUE3SHTPxMZ4x7QCYkJ/DTL TAF6Ad1HajUp/jT/8PCWP471vi+KbXaYztNy+ZYji2f+0pdZuuq8siXEbPG2NFIx5tV8 qyiBRjtdR+YPDXME7pWiB6Dad3PQmzlkNdXZEvHB2keDNMr887j/o1j1QRNZxUrbKYvD XzI3evUtBniFtKazigligdOTtOowOyH/x1s+lATrloTSKngbHXvyF7R5yEfuxPLTUZk2 zfDQ== X-Gm-Message-State: AOAM533jWR5p4fmFGBy0+VA6WKpN9BnXpBblyItaqH7tIN9z2kC44q5V 308UnIL8DHMtF643/5awEfxE45HabOzojw== X-Received: by 2002:a17:907:1c21:b0:6f4:7a8a:d6a2 with SMTP id nc33-20020a1709071c2100b006f47a8ad6a2mr811397ejc.288.1651507252707; Mon, 02 May 2022 09:00:52 -0700 (PDT) Received: from debianHome.localdomain (dynamic-077-001-135-067.77.1.pool.telefonica.de. [77.1.135.67]) by smtp.gmail.com with ESMTPSA id h18-20020a1709070b1200b006f3ef214dd3sm3689996ejl.57.2022.05.02.09.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 09:00:52 -0700 (PDT) From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= To: selinux@vger.kernel.org Cc: Serge Hallyn , Thomas Gleixner , "Eric W. Biederman" , Andrew Morton , Andy Lutomirski , Sebastian Andrzej Siewior , Peter Zijlstra , Fenghua Yu , David Hildenbrand , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/8] kernel: use new capable_or functionality Date: Mon, 2 May 2022 18:00:27 +0200 Message-Id: <20220502160030.131168-5-cgzones@googlemail.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220502160030.131168-1-cgzones@googlemail.com> References: <20220217145003.78982-2-cgzones@googlemail.com> <20220502160030.131168-1-cgzones@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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_or function in appropriate cases, where a task is required to have any of two capabilities. Signed-off-by: Christian Göttsche --- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/fork.c b/kernel/fork.c index 9796897560ab..3ae87b864380 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2098,7 +2098,7 @@ static __latent_entropy struct task_struct *copy_process( retval = -EAGAIN; if (is_ucounts_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_or(CAP_SYS_RESOURCE, CAP_SYS_ADMIN)) goto bad_fork_cleanup_count; } current->flags &= ~PF_NPROC_EXCEEDED; -- 2.36.0