Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1248909pxp; Sun, 6 Mar 2022 09:35:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx10JeqXVqtuJv/9KqpUf895KXB0yqeh3Sjo+xnu+KEqByt4mLS0v7ZeAFkR4vf7oliAOse X-Received: by 2002:a05:6402:37a:b0:415:9501:e112 with SMTP id s26-20020a056402037a00b004159501e112mr7732120edw.402.1646588105366; Sun, 06 Mar 2022 09:35:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646588105; cv=none; d=google.com; s=arc-20160816; b=U/sRF+ZwpD+g3RlIzmt3JcI5rmfoPGnsxKUvqxQfdVCrueUnZXmT2GsDlyWp5Hzvlu doL3GZ8w57qZn5/c0fCA9uEqMbi03le9DVfKDu/HrqPenNU4X5FMxeGA0j+PDOEN9jNL uqOY+fzU8aNlKiL+K1Db/a8Q3I1ir/qX4wInRJvGIYreW2hWjYdn9acWjUqRZcN8i1fU fRPEFh+V+7+Qomg7bZPdoOg0McJGNveaXFXssQ8SWHNACwFBbmsUuK+YoW6aiGOFSRGD JOgVJ2basNG+iHzGPRt6px9mlLwzkl5B5Q1FFdklhHrz2KOR6OVVL/o6S5IyTo3b9V9h EUnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=l+7bkttBhLtdx+i5YQI7wY2en2hul/hAtSFpLBjqBs4=; b=YMqngzN4d4url7MnrIjpUncMC0PLViTDtDr1czbz2GnvYzw/VPkGwbL1TU/OGAqq76 Y5WOGRu6gYsFWVZrwwKRZ9rumdHAjgYRQw8O7USC95l8WDuAW7O1REyUlf0pEKADV0GT cMxZPIWDF2VW3Fn71b3HggsQyZd7/oVi5JUrTGG/ethcWBn7BpnzoU/WaKhbczZYeNQt ARZ9Nbhr4U5aHr79W5/OEH0HTwxybIMY4Ua2O5BoDvx37RgfSYZAQM3geVId5ULqietn mjkh/yVfBaMlNED6e/+Nd2+FFBC+avQwQ8BjoEHXu6ZbxvtdPWYMadgaR3NaZeZLmYJo 0Gow== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mess.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a170906a21700b006d07ebd77c7si6841996ejy.251.2022.03.06.09.34.31; Sun, 06 Mar 2022 09:35:05 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mess.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232105AbiCEQ6x (ORCPT + 99 others); Sat, 5 Mar 2022 11:58:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbiCEQ6x (ORCPT ); Sat, 5 Mar 2022 11:58:53 -0500 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5408E41FA9; Sat, 5 Mar 2022 08:58:02 -0800 (PST) Received: by gofer.mess.org (Postfix, from userid 1000) id 47BBB101CB3; Sat, 5 Mar 2022 16:58:00 +0000 (UTC) Date: Sat, 5 Mar 2022 16:58:00 +0000 From: Sean Young To: Benjamin Tissoires Cc: Song Liu , 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 Subject: Re: [PATCH bpf-next v2 01/28] bpf: add new is_sys_admin_prog_type() helper Message-ID: References: <20220304172852.274126-1-benjamin.tissoires@redhat.com> <20220304172852.274126-2-benjamin.tissoires@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 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 Sean