Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp38763pxm; Fri, 4 Mar 2022 15:32:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwryKV6tJbnZFJ+6bHvO6Ef7BPv51FAMIG/AR/g+t3IRlJ/z19ZJUyEkPFXpt78FZNJP8n2 X-Received: by 2002:a05:6402:1e8f:b0:3fa:72cb:1733 with SMTP id f15-20020a0564021e8f00b003fa72cb1733mr880484edf.24.1646436721721; Fri, 04 Mar 2022 15:32:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646436721; cv=none; d=google.com; s=arc-20160816; b=ThZd1VKxluZkc7//z8qpFHB1lqMi3XHt8ICkZDBEjjRfQj34dOcgyOW05EYdscDfkm V7VxpK44BhxunN4KRmH+aXX9chccCdVNWnnYGschJFgeNxSWSq5aTmVCpcFOcq4JR1n9 TV62JhwiHC91hx3YqaCwZr+HDtf2sn+Ah2oaSh5eZYY79+1AnNlDHnPjmGt1Gs9wV1Ug I1U3Hqdq5KXsmdiTJMKG1jiupmTrUunGV7eSC/ZJFgws1xdq12VRnQPJVP8cdRn0GANE KQM2oUOMBbo5SM1rla3gcloNfde1WQuQAuie0LUMZ26HP7pBNkV5utMRtUKd0Cn8ai1+ QuAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=X2e6DUJD6quzl1Vx/qkuOZzI29exow87rvZgP5z5CRE=; b=sjtIh3qHtVbjjwOySVngigyzHVFOLbwuMV7YkdeWLKO3YRLIkbudX5IU50UKJ7mD2P uDsINBQIa404ndOKm8cUK/8ZkYqlfojr3nf5J/amoWSeeiPVipgIUTfKa+UpjdpsB4bu rjVTjUEUBB5yzH42IJF+SJdsK4slcBTtCnUp/cZ7KFlL3H7amDCPZ1+qJKqfLbF3xd/P V7B2IZthc137YerYranzMLFrvs93eTGH/ZpbmpofyBl1Y4H9pROkgx4HaSN1UhyyCQt8 rZhHcdRiIlor0efBHwvV1L3Y6hM+xKoS7mRn0NX42S7pxOnuBhbquZOuETq5NDcpLSrC bhZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NsylDpV6; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lc10-20020a170906dfea00b006d6e545b6d9si4470821ejc.827.2022.03.04.15.31.38; Fri, 04 Mar 2022 15:32:01 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=NsylDpV6; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230121AbiCDXN3 (ORCPT + 99 others); Fri, 4 Mar 2022 18:13:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbiCDXN0 (ORCPT ); Fri, 4 Mar 2022 18:13:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3C96140D3; Fri, 4 Mar 2022 15:12:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47699B82C59; Fri, 4 Mar 2022 23:12:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D599C340F6; Fri, 4 Mar 2022 23:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646435547; bh=M3M7GJjFihvbF6LifpyP35fxlg6/lZjmcYRAbzOnZbo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NsylDpV6b5BkXIQ+41uIxXt7r8IzhnLnT0Whk6slypqhNBevXpEbQ6JXr9D+dNqLa R2hJ0IWoVyKjXxHA7DD8jjqM2mY+9WTVrAtNX8l2uX4mMcUWN0l5eWGuVP05mOqW8O ME/VDDsiVDY/qCQaHf6OeN8TrFIGQHKYzvL4Mlmu+3OwCrPmh2gpeESHxecTB9s8Ec zYy7cGyC1DkDKPvZDruV2W5v+0Vn5lH06ISAcxMWJR6kr7K9LAwEzN1Es2QjqBGQC0 BbVnWnEsZI2aJGOmkCTaGbxdSzWMDdBYTKLL33M4Y51oqoH0FTToX9NsPflLRZSNVd c4zv/mU4KHpaw== Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-2d07ae0b1c4so107811627b3.11; Fri, 04 Mar 2022 15:12:27 -0800 (PST) X-Gm-Message-State: AOAM530vvux3MzkcG7/Fh8LoCZ5OOgToDdzIGl0NXeWlYcz4bk8RuRn4 dD1D5/rFLuAR8Wag/xHnJqElGIxtMFkBiUrr1U8= X-Received: by 2002:a81:10cc:0:b0:2dc:24f7:7dd3 with SMTP id 195-20020a8110cc000000b002dc24f77dd3mr898510ywq.460.1646435546021; Fri, 04 Mar 2022 15:12:26 -0800 (PST) MIME-Version: 1.0 References: <20220304172852.274126-1-benjamin.tissoires@redhat.com> <20220304172852.274126-2-benjamin.tissoires@redhat.com> In-Reply-To: <20220304172852.274126-2-benjamin.tissoires@redhat.com> From: Song Liu Date: Fri, 4 Mar 2022 15:12:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 01/28] bpf: add new is_sys_admin_prog_type() helper To: Benjamin Tissoires Cc: Greg KH , Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Dave Marchevsky , Joe Stringer , Tero Kristo , open list , "open list:HID CORE LAYER" , Networking , bpf , linux-kselftest@vger.kernel.org, Sean Young Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Fri, Mar 4, 2022 at 9:30 AM Benjamin Tissoires wrote: > > LIRC_MODE2 does not really need net_admin capability, but only sys_admin. > > Extract a new helper for it, it will be also used for the HID bpf > implementation. > > Cc: Sean Young > Signed-off-by: Benjamin Tissoires > > --- > > new in v2 > --- > kernel/bpf/syscall.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > index db402ebc5570..cc570891322b 100644 > --- a/kernel/bpf/syscall.c > +++ b/kernel/bpf/syscall.c > @@ -2165,7 +2165,6 @@ static bool is_net_admin_prog_type(enum bpf_prog_type prog_type) > case BPF_PROG_TYPE_LWT_SEG6LOCAL: > case BPF_PROG_TYPE_SK_SKB: > case BPF_PROG_TYPE_SK_MSG: > - case BPF_PROG_TYPE_LIRC_MODE2: > case BPF_PROG_TYPE_FLOW_DISSECTOR: > case BPF_PROG_TYPE_CGROUP_DEVICE: > case BPF_PROG_TYPE_CGROUP_SOCK: > @@ -2202,6 +2201,17 @@ static bool is_perfmon_prog_type(enum bpf_prog_type prog_type) > } > } > > +static bool is_sys_admin_prog_type(enum bpf_prog_type prog_type) > +{ > + switch (prog_type) { > + case BPF_PROG_TYPE_LIRC_MODE2: > + case BPF_PROG_TYPE_EXT: /* extends any prog */ > + return true; > + default: > + return false; > + } > +} I am not sure whether we should do this. This is a behavior change, that may break some user space. Also, BPF_PROG_TYPE_EXT is checked in is_perfmon_prog_type(), and this change will make that case useless. Thanks, Song [...]