Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp244782iob; Mon, 2 May 2022 18:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNdSQCgx9bIAGaEF3mJWOedC7BvZpATtqMC9Q4xjKSasw0wKEbCspI8CQ5ddt5a6pc0S8G X-Received: by 2002:a05:6a00:1a8c:b0:50d:9c5d:e20f with SMTP id e12-20020a056a001a8c00b0050d9c5de20fmr13819806pfv.46.1651540870587; Mon, 02 May 2022 18:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651540870; cv=none; d=google.com; s=arc-20160816; b=WKkSRxGwwJCVxEq0rC4adN1UuslcQDSS4ccJf8QW/wa64c2W7w0xgi0x39/9y7jOSO PrehrHS7NoGtr3fXY+n8jLFyZ8D0PqiSdgaKwpK2HcVQfKa5zFWRPN5HVMbiRVkvIhdv gJxC8RZF86GrEANU+xF4xD6BZS0H2bnFgoodWk93910aeRK/wJuR+/+Ikk7l6hMJGsQc oUSZR5b1lXuLb9kUSrYfOh54yMhktfyITUakxiwhmk7rHUFW5wmiPGrwQMd4nXzhIX1a o05KdY+XYOGmapnXbRvC5vwBuo33pWxq4vIw6QmJSc/x1Qv8lQC2GaHCZahdYaDvsK1v y4Ig== 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=N3AME3IcPE8G01jSuTBFGfb2u7+rTRdyuYIo50HVTEg=; b=lWH2ev7uW602lSGu5rlo4iaaI/9nUnLlHignd2Nwsptl8vgnPYTBOux8iLl+9kvJSD S4nGC7oKBN1TvIBKXYk6PTd58ycZt0fGVfA6UQZZNLxcSDnbMdhmkNIplsL2p4QPPA0Z 7TJ4qtzwE8XL/VgOppCa46pk6h/huJV57s0SJtm59gKG5rL8DX2kshz1JTlnPmGRGVJ+ lSmNBAATh2w5Cbfp881ovQugQ/qTOp0XWyjCwTFpQIjQ1SiG7hRrH+x+M+qWUOigniNu vUbpno1GH8h5u1cSkceuWD7lfgl9ixRvTgY06XfgLbHeA1DG3HUxycsmg93UWbs68IzX lTOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=BgtDFtCx; 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 n13-20020a170902e54d00b0015d06426f70si16635890plf.249.2022.05.02.18.21.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:21:10 -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=BgtDFtCx; 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 0683C65D36; Mon, 2 May 2022 18:00:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386156AbiEBQE4 (ORCPT + 99 others); Mon, 2 May 2022 12:04:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386150AbiEBQEf (ORCPT ); Mon, 2 May 2022 12:04:35 -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 77A7FBCBA; Mon, 2 May 2022 09:00:55 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id a1so17137924edt.3; Mon, 02 May 2022 09:00:55 -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=N3AME3IcPE8G01jSuTBFGfb2u7+rTRdyuYIo50HVTEg=; b=BgtDFtCxqx/FN6/+BjsXXaKHaLn+ihBUfE5b+bIVc+wk821dSW3bFKNEVB7Q6ypQ5v D242HfeafW05VEfKAo9l+Ijc5DyyfjEsZOarGM/2zSvIJB9EruKM/plp38cwhHcgJ0WO k9SZWJE4wn6AuFK92SkXbDNi9OHtz4DKDcqmNzU8tSM94UgbJiGsn3nBFCvw/Sdu/DBS Snr1GOkFl5FtN8t04fe/O5sF6tUC/9+e2/2QX/LXzWuoP0rHnDAysSAydmaNv1wVFTOu WFwhuJUvHxBSlT0VgQRxRjE41n/xVjw1/LuuvYsnXON3Kh7iGQmvA2RtV6UbVM003aYX 7EAg== 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=N3AME3IcPE8G01jSuTBFGfb2u7+rTRdyuYIo50HVTEg=; b=4ult8OEWfth1odpgUsNNDZynmlQSqtqtQhykxI59gre/g03/qFd+3whHFC4v4qWypP nmKZwaDQ/WnDmHuInKWuRQaAM46t2RvIfoKeF53TJocYhLP6jJGV2UTlDx4WwvbR0bvL 6UrP+5Y3mp8IXDqyKKF2l9Ca3Uk154A6D/+8FOqKEkOYhY+jZQlN06cgUZd9kdkhr6Nf GilsU/Sn9VufZP9wgoOQvzarkyRAJcPY2tCS8bGnlaFWsOad4wAm0HYwtjw3/UuTwBmV QqD6YcCcA+RJw35N10ZiSMlH5q5u1FVaBQluDv/CSZ4P9H7kc9dJ8+8In6LfKo58WLrt RDHg== X-Gm-Message-State: AOAM530TMGUNqLcUePAPGA03Nc6dWpSVeZ2CWzjUKUEn10NxMX8Fa5V8 CTkZZyaKDbAKrooyr/mh0CrN7CSeopmV1w== X-Received: by 2002:a05:6402:10d5:b0:408:f881:f0f3 with SMTP id p21-20020a05640210d500b00408f881f0f3mr13971727edu.112.1651507253898; Mon, 02 May 2022 09:00:53 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 09:00:53 -0700 (PDT) From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= To: selinux@vger.kernel.org Cc: Serge Hallyn , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 7/8] kernel/bpf: use new capable_or functionality Date: Mon, 2 May 2022 18:00:28 +0200 Message-Id: <20220502160030.131168-6-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/bpf/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index cdaa1152436a..95a2cf3e78c9 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -2249,7 +2249,7 @@ static int bpf_prog_load(union bpf_attr *attr, bpfptr_t uattr) !bpf_capable()) return -EPERM; - if (is_net_admin_prog_type(type) && !capable(CAP_NET_ADMIN) && !capable(CAP_SYS_ADMIN)) + if (is_net_admin_prog_type(type) && !capable_or(CAP_NET_ADMIN, CAP_SYS_ADMIN)) return -EPERM; if (is_perfmon_prog_type(type) && !perfmon_capable()) return -EPERM; -- 2.36.0