Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2844150pxp; Tue, 8 Mar 2022 03:04:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7eyZVI5/a4L0IEsCn6SIC++q2SXXw0ZTidpVnNgCM//yORdwUyPgsyP/2ly1bzpOxSpHm X-Received: by 2002:a17:907:2d8d:b0:6d6:e449:881e with SMTP id gt13-20020a1709072d8d00b006d6e449881emr12547986ejc.371.1646737472774; Tue, 08 Mar 2022 03:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646737472; cv=none; d=google.com; s=arc-20160816; b=PPs9HjAYRt9gVAFjvrmOG3k/Z8B+F+8Yzu+sj0A7jjvMglalwlbqmBitAMJq828hH1 L4C/JpaaxiLPCgG+r+rqck7ewGY7GZWqXPmkIGCy6+dwwKtpCY1Qh67tol+XnRPPAsqK Yax5pxgfq6K3QQNjMUlFHmWB/AkGlVt/Z3fDmxO8WLF5C3b9N1S+qqn8bDHcRVxqTkvk l5P5SrmYEYbJNb57pGae5531M3UcbeFVuvsXY6g6gPZaXcr/qIfoZONDHwTgQ1ozlj2/ VsRlt+nOYGzJy60i0SeygTyD1JQnGlGyQdcsL6Sg0l9mpLnEi8gM7SCb589jbAR1STs8 xv8Q== 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=DjTIbbapi0sG/51rmrU22a9tBgzr9MmOUZpRHZXdEA8=; b=RDD/d+D8a5cjIRYngtnfDSr2SmOQaWiKOvuAij6Yj6WnSmrGseZEtSoAsQy0PWINI/ P/iSQEPcc7NhoyyxGrfRhDWH621i/cvxNDdzoqEKn+tHBfpzTXo5klrZ6kZc4VUVzRPn 8+QTEgi1GzHf1UoKSzYBq8NIwgBqRt+knOECbHW4Fmw/URzfxeZUomxfrm+/saN4iVS8 XZaKvD+0Xpuw6yV0Bz4tnbISKULRwyMqSSypRb07ZDgZxPYmaUow252q1uuOFKPKOGXg 6YHMTeLZCoJX7HRC3HiaeLd09L+wRtMlGZte9HQrbISE3Lh1+OENLP1mDJdTyWtDIpLu jxRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZKncCtRm; 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 s1-20020a056402520100b00416669e0096si1780654edd.622.2022.03.08.03.04.09; Tue, 08 Mar 2022 03:04:32 -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=ZKncCtRm; 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 S244766AbiCGS1X (ORCPT + 99 others); Mon, 7 Mar 2022 13:27:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241487AbiCGS1W (ORCPT ); Mon, 7 Mar 2022 13:27:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65D88939F1; Mon, 7 Mar 2022 10:26:27 -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 B2778B8166E; Mon, 7 Mar 2022 18:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 722B9C340F4; Mon, 7 Mar 2022 18:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646677584; bh=tiM5Uvq+D31XhjJe7+hWNcPkNyAsCyNOhRKy5ex9OS4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZKncCtRmliUj08hyHjNPIch7ZIcVa/2uoOlqtXYHfSGXXt2FIwx3UCD9FmEje7oXy NKqgElEOarYqHJo/nW6N5R1QgRcUSPoWXqNHFx1EAxPr04T1vw5tB8OqEQ3U0DnpyQ ca6Nv+e83arQ9MrGv5O/klgVXR+yLOe3uavLWbMXB5cy6bMd5wwx17GMORE6fVjnHP TFQI0pbgk0MmuJgtClIBhD9ww429rgSPtFcFWTRV1fsE6rF9JDXpsZNqZXX9qS5052 Z9qjZ7dWRjXVQyRzzsbw42OEt3SYOG1gzJLH73TYaxoBOQhVLP0Oejw1v0aylcyjvA c0q8YOMJIEMng== Received: by mail-yb1-f181.google.com with SMTP id l2so13269860ybe.8; Mon, 07 Mar 2022 10:26:24 -0800 (PST) X-Gm-Message-State: AOAM5323Orjrce40RNfFXhW/zI0h9VWQgO7jpdr+Azl0thrKR0a5G81i GIOoCxGet3g0HB3znIsjbbI9RAE9uTty7ruiFuM= X-Received: by 2002:a25:8546:0:b0:61e:1d34:ec71 with SMTP id f6-20020a258546000000b0061e1d34ec71mr8563794ybn.259.1646677583501; Mon, 07 Mar 2022 10:26:23 -0800 (PST) MIME-Version: 1.0 References: <20220304172852.274126-1-benjamin.tissoires@redhat.com> <20220304172852.274126-2-benjamin.tissoires@redhat.com> In-Reply-To: From: Song Liu Date: Mon, 7 Mar 2022 10:26:12 -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: Sean Young Cc: Benjamin Tissoires , 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.6 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 Sat, Mar 5, 2022 at 8:58 AM Sean Young wrote: > > On Sat, Mar 05, 2022 at 11:07:04AM +0100, Benjamin Tissoires wrote: > > On Sat, Mar 5, 2022 at 12:12 AM Song Liu wrote: > > > > > > 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. > > > > Sure, I can drop it from v3 and make this function appear for HID only. > > For BPF_PROG_TYPE_LIRC_MODE2, I don't think this change will break userspace. > This is called from ir-keytable(1) which is called from udev. It should have > all the necessary permissions. > > In addition, the vast majority IR decoders are non-bpf. bpf ir decoders have > very few users at the moment. > > I am working on completely new userspace tooling which will make extensive > use of bpf ir decoding with full lircd and IRP compatibility, but this is not > finished yet (see https://github.com/seanyoung/cir). Thanks for these information. I guess change for BPF_PROG_TYPE_LIRC_MODE2 is ok then. Would you mind ack or review this change (either current version or a later version)? Thanks, Song