Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1116001rwd; Tue, 16 May 2023 12:03:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bLyP+UMF3AR9RKNRc971Xd44vTAlNnRpDRGoud/063a0j0NjWcZAfqQeomADrKmcYZmGG X-Received: by 2002:a17:902:db02:b0:1ae:89a:9e with SMTP id m2-20020a170902db0200b001ae089a009emr12193178plx.61.1684263783966; Tue, 16 May 2023 12:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684263783; cv=none; d=google.com; s=arc-20160816; b=FT26l+w7E53gzS5wCL+u+Qa3dl+q72CF1eITLtDpnhs2bWwiqO9Aw68IQmwGSKIE6O 2S866egnp3ufMuGI5hBJfNaDSoaIvOZHEydMz8POQrGAQlvlZ4LdxOhtzTSLK7uYj2g5 rYQpSr+Wjc/gn7VKTJe6a5n0tU9jUJfiaIhLq7aD627pH1r0Oo6yfT8ZBS0/fHpFRUy/ s0Va1d9IHQmlJ/1ibQLNdkcr4zVggLP83S8hLK0FWv9aSY6NXuvCAl9gQf9QHlfp0yFk PbmNg6BlLsA4cTkMYwt/5Of83nCFd+WJfTDeRbSa2W1rVcvsUGoAkQB9lz0zIbVbx7P7 HPIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZVglkrRn4KtUXyMZNafVQZU+oIXi6ViD3yp4abRe5us=; b=npDjB4Rq3IWj97sXK9LaPCaOn1/RQu5BGHci9SOe6qNNtkULfyCe0/CA+6zCkItsKA vGQriBBEnHjoayDfXRKYytObdm//1gv2v6fCJlUAyy+nGIY0uKVlvj1WyWeGZNMdRTtg IeCQy2o8Zw6Z0AOtjHAEOTfGGWR2kYKhmyXO0VP9/L/1HtaYZ0kG5k5OrwhsxxwVxAGB bsNgOr6vCdmVX6SDaa5JxxK2AYpvJDdqVVS9CYMZV5zpStVwD5UsZWqnff/jyYimKPXg xrnqmKB1n+RTZvVpYzPer3Ykg38kGNysDWZHc8hUWu+dXfBkspg0WCxHpmbGb/Pz4N4K 5m8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="IA/OenOH"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a17090a6e0500b00246aa5e7322si93031pjk.59.2023.05.16.12.02.49; Tue, 16 May 2023 12:03:03 -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=@gmail.com header.s=20221208 header.b="IA/OenOH"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbjEPSnL (ORCPT + 99 others); Tue, 16 May 2023 14:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbjEPSnJ (ORCPT ); Tue, 16 May 2023 14:43:09 -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 27DE88699; Tue, 16 May 2023 11:43:01 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-965f7bdab6bso2591916466b.3; Tue, 16 May 2023 11:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684262579; x=1686854579; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZVglkrRn4KtUXyMZNafVQZU+oIXi6ViD3yp4abRe5us=; b=IA/OenOHU9PgFrxQAXYsdghkYdGIy43feL3FTATpObUDFEYrj6xlyIBNW00RSu6ldZ +D5KHsBd4VD1hVbTKtkn8IwHQVpbpKQ/9KyavuDYuG+fQQ2jELHR8LaPPLTMtug717ta T/yQP6GUgym3x7/Y5OAbHwew6bo/Q7suLGQ1aCAu01aRI0+duy8aGAAl5g6vCt8mY6NS WSkf392GY+b+2IVFOGKjXQjtH++pbzaksICihue4V911EBtbbHIUxb4lYLROXpOMPMtx ngdZ//qR17N1Id7PxPd9TfdJ45elklIEc3OJkVl8/fge/fJDO3LcYh/xpuuchVEe7yTh Aj7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684262579; x=1686854579; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZVglkrRn4KtUXyMZNafVQZU+oIXi6ViD3yp4abRe5us=; b=F1MhrkrpJE4iYgA+xBwf0jYzMp4kv13xAfjOyhCORE7P5yp7f4HZmXisAMqwAv3QN9 5WWeYMUwoIPZNPkQN/j6XudfJfZixb08FqaF/dywp9X89ADIPBnygnQ5FdNM6jCFxfun 89uZ0NzM6kWUtMM7c+Zld0VtvsW+kwzQ6+pMPedAUXG7V/aOqgxWOiSBHm4EBFkOCELf hHgGIlU/cRyWWAFPrV/dCBGCe/kfNn6PQdpSxgyLX9r0AZOqWBAEd/J5uCRBwsxqfcRy X/jY7sv0Gu6dIc+8zS4Yr19UllOwGIdzWYhyZIbOyOUcxIt5rm9GViyu90+1Myuu8bBA xApA== X-Gm-Message-State: AC+VfDyRk1bKAy5+hJl4a+PSvi/uYi9qt9JKseWD0iLtgPNKxIFKPrct JKw1AR8jYsedtWsbbE8h0QY9QJnAyBCR/09A50k= X-Received: by 2002:a17:907:701:b0:96a:26d2:53db with SMTP id xb1-20020a170907070100b0096a26d253dbmr19418703ejb.15.1684262579111; Tue, 16 May 2023 11:42:59 -0700 (PDT) MIME-Version: 1.0 References: <20230511142535.732324-1-cgzones@googlemail.com> <20230511142535.732324-8-cgzones@googlemail.com> In-Reply-To: <20230511142535.732324-8-cgzones@googlemail.com> From: Andrii Nakryiko Date: Tue, 16 May 2023 11:42:47 -0700 Message-ID: Subject: Re: [PATCH v4 8/9] bpf: use new capable_any functionality To: =?UTF-8?Q?Christian_G=C3=B6ttsche?= Cc: selinux@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Thu, May 11, 2023 at 7:26=E2=80=AFAM Christian G=C3=B6ttsche 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=C3=B6ttsche > --- > v3: > rename to capable_any() > --- > kernel/bpf/syscall.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Acked-by: Andrii Nakryiko > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > index 14f39c1e573e..1bd50da05a22 100644 > --- a/kernel/bpf/syscall.c > +++ b/kernel/bpf/syscall.c > @@ -2539,7 +2539,7 @@ static int bpf_prog_load(union bpf_attr *attr, bpfp= tr_t uattr, u32 uattr_size) > !bpf_capable()) > return -EPERM; > > - if (is_net_admin_prog_type(type) && !capable(CAP_NET_ADMIN) && !c= apable(CAP_SYS_ADMIN)) > + if (is_net_admin_prog_type(type) && !capable_any(CAP_NET_ADMIN, C= AP_SYS_ADMIN)) > return -EPERM; > if (is_perfmon_prog_type(type) && !perfmon_capable()) > return -EPERM; > -- > 2.40.1 >