Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp174532iob; Mon, 2 May 2022 16:17:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPYUGd4ucf9F3C9/L3c5lBxbgTHopVvclI9x1tR4c+aPUbfzCNFi4AK8Ta0wCMuCp6Q+oy X-Received: by 2002:a17:90b:33ca:b0:1d4:d5ab:40b0 with SMTP id lk10-20020a17090b33ca00b001d4d5ab40b0mr1670408pjb.96.1651533460903; Mon, 02 May 2022 16:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651533460; cv=none; d=google.com; s=arc-20160816; b=L1BdK/CDS5HgjULOE6DCzoddPbMwrgmfoKIqWqzaa9XA8HRUwcWq49jwth9R1RqY50 dfPt0VbxR4vi+0xAB3j0iUaO17f3ZLOVDVZ41JwYuLCZOBI0TuexX3alfdKHQTxGdh/I UJLUT6Vu/Y899XEgP0RrdfwSa9dWt4DhH90r8jGRVffHc8kTg905Nu5mvA3kEqKICEfM i/XHiHClNc6vELaRv6idfRby46qoQ3DdNMFQxDGB7A2QOrMAWwG8n9dujsdZb9AxZ1Mh Zrbs2nMeOAEIGvi7occxYgtDCplSJOqh3DuwmcuJmTdq0NKs/VsaJ3HMU2kSeNZHDc3c TJDg== 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=busCb+Om5lGBi8mOWmr9OZyYy/vhvqsiFL5/BXL6zqA=; b=P+sBSUUoH2vCHsxYp0aADRS5HnZgl3Oaq/wb+I7EW87Hm45mrBvVp5Bp8dNFOAbLDZ Eckj0lGVTzNenmZ5PmemxULRi6vQ0tbOTlA8trDZEE1B0VL1xnM0G+YpQlQnN+0HNzAG MQDym/69LiEPVMv6WrlwjHS9NrTnFRjXLcIosLIj27234BAiSBM6Bt/E0BiQPVSukdt3 IQQSVDWE+qHsuOtG5QhHTzfTqkorDwOdgKvx8pNm3cro7MESUdPy+KY9s19udTb81uhf xmWsKubWJtc4wkbyk/7zYoiLXOmeWbR/9S4xGYd0NeHZOSGTbQSDKQcuTh2DPmCb2OGe rn2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=ghk5NXhp; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id lb9-20020a17090b4a4900b001dbd2a6c260si733786pjb.84.2022.05.02.16.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:17:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=ghk5NXhp; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 12FD331216; Mon, 2 May 2022 16:17:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386045AbiEBQEP (ORCPT + 99 others); Mon, 2 May 2022 12:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241345AbiEBQEN (ORCPT ); Mon, 2 May 2022 12:04:13 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04A165F93; Mon, 2 May 2022 09:00:44 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id kq17so28609143ejb.4; Mon, 02 May 2022 09:00:43 -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=busCb+Om5lGBi8mOWmr9OZyYy/vhvqsiFL5/BXL6zqA=; b=ghk5NXhphzM2gG989XZFhRAZZGZycbT6Xm1juiPzyiJ9UWfO8/jJt8Y905OOl6IeCV StRbo7WnSDtUgPaLnm48Gq7edKbikw4gDhZOtb33pF+vhKu9POC5LHE1FhZLxWGehz+L I5cGaZRIegguH5Enu7D/TXvhLfkMrb7WiHEh9a58D0laKm9jnp5LskhUbH4Nrh3XthN0 MzWJaCk6Nz4X6UOp5hZSCibk7EROY0K6aauOALrXk1CHbzgR5+BCuJQWGw5r7MJfcshI Dq5eNcmau6KflTW8SWsYMcQNqaqBcEooEeRaNLwkG+rTo7NNbANgLC0zwAwBVKj5tHtX tTqg== 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=busCb+Om5lGBi8mOWmr9OZyYy/vhvqsiFL5/BXL6zqA=; b=ERbALm5eqCky8ZJ1Y8L4xG+SHrNSXL9u41gtowRv6phNeY7j/IqO09UvB9CKkIOCKF uZrFjxGqYbbgEbDypS9549GH9DvFk5yvAddmUFPP6qcsuORB+Dn08qe8UnFImPMV1ygi V+dJgc4SXkZpAf6DW/0AVlh3iCeSgqaweiUhIVuLMgb/35Jr5WaiKqSYR5scJSXkmeGD qFCzgbaumfxPb3Y7GUSl+VT9WCMxZKPqkcxjko8bfF2reEMCoP4LFKo2egxuGO5uMHSf V9Zz8wNnCVJERfJ0S9WdFPdmX8f2FZyXa+LOaMYSXHsdUgz3EYSX6NM4XElDvXSoNeTx 3dAg== X-Gm-Message-State: AOAM531ZWcUAIS9/qXa4/lndY0Mnm3uuPNlKvAvYIP/q0z+PHVF7RM8j NRlotN0VyZN+qnSKLLuaunjn65ywYxCX4g== X-Received: by 2002:a17:907:3e25:b0:6f4:2c9a:709d with SMTP id hp37-20020a1709073e2500b006f42c9a709dmr8293319ejc.175.1651507242418; Mon, 02 May 2022 09:00:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 09:00:42 -0700 (PDT) From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= To: selinux@vger.kernel.org Cc: Serge Hallyn , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/8] capability: use new capable_or functionality Date: Mon, 2 May 2022 18:00:23 +0200 Message-Id: <20220502160030.131168-1-cgzones@googlemail.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220217145003.78982-2-cgzones@googlemail.com> References: <20220217145003.78982-2-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 --- include/linux/capability.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/capability.h b/include/linux/capability.h index a16d1edea9b3..1f26d6bae4f3 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -261,12 +261,12 @@ extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, extern bool ptracer_capable(struct task_struct *tsk, struct user_namespace *ns); static inline bool perfmon_capable(void) { - return capable(CAP_PERFMON) || capable(CAP_SYS_ADMIN); + return capable_or(CAP_PERFMON, CAP_SYS_ADMIN); } static inline bool bpf_capable(void) { - return capable(CAP_BPF) || capable(CAP_SYS_ADMIN); + return capable_or(CAP_BPF, CAP_SYS_ADMIN); } static inline bool checkpoint_restore_ns_capable(struct user_namespace *ns) -- 2.36.0