Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp617057pxp; Sat, 5 Mar 2022 13:12:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWDoLxvT8AfE9MFfgbol+EFt/zoIcP+g5lbyReMPsxQDXdV6q+/Gu5b2l2qNERV6OCSGjl X-Received: by 2002:a65:49cc:0:b0:372:a079:cb3a with SMTP id t12-20020a6549cc000000b00372a079cb3amr3878923pgs.222.1646514744262; Sat, 05 Mar 2022 13:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646514744; cv=none; d=google.com; s=arc-20160816; b=lJfqTWgQvJvw9/K+JuDgHDJ7nCH/ypFJEoVcfmTMHVuGBvwMucAbDBs4IM0LhPFp4U SBmi3ozKplgVKHgjL83YB9/MNTKCgGufD5NAtVR/VbYZ/YyWJdVQ9gyyyjaQyyhECZ3F z5TBOthFnfStP5ambuymEGeH4iHHNOiWnItVHBGY1ylwkfc5ljtbwIHLjvi0NBQDTPLV OiM6PAJJ3tlUYZkg/7FxHpkEV37EAeys6in1Ap3tsYIly0rEabEeIX6dIXKaR98Mylsz QiivfOS0KcxCANZVyxviTVlAV7UQqJeIsmgkiUvOj/SDLD/znWUCo+z7JMmvnL8/6KzN LS6w== 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=a0Fgc88E/ZnztbMYK2n/3xkvK5J7VCgRYmi3UI+KKPI=; b=yiUhQPblSDL458VmZvgM+uahWnypNHKgqh2p2ZO1wz2aIos64Kua0eH7enAgi5nI7n 6TW4X3R5v5D2fRY8daPOFFAVI0nEo51kIdlheRQdv4owecIs5ZPiD9k7UsoTjir3wQZp j+RLTWH2BS1h6WxlonSnPAVcjbQqKroEfaHZnPYAAApVia4dJS0tMX0M3Ncn3a6iDAT8 JBiDsPqctD42/dIqZWH9RhAK2o58RKXmwmJNpXIUUlbXaOl9+3819X4hpQBWCdlND+w4 i18eRVCRCh03nBktSoyILYgK8lHr6U7xVNoFTeb1uVTdY8v/IJxhU9MQl78f6+5kEIMm S8ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EQrcV1Rn; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c196-20020a621ccd000000b004f6ec464c79si582808pfc.203.2022.03.05.13.12.06; Sat, 05 Mar 2022 13:12:24 -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=@redhat.com header.s=mimecast20190719 header.b=EQrcV1Rn; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231381AbiCEKIO (ORCPT + 99 others); Sat, 5 Mar 2022 05:08:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbiCEKIK (ORCPT ); Sat, 5 Mar 2022 05:08:10 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6851A25C127 for ; Sat, 5 Mar 2022 02:07:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646474838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a0Fgc88E/ZnztbMYK2n/3xkvK5J7VCgRYmi3UI+KKPI=; b=EQrcV1RngVR5eUbfS2dgxmuc8SYZRCtPitexg/fdWpbtPZjqYmzv0D3SwI/WQN/+CG24Fp qgYiO31q68r9j7sANSvKfQBz/w04ttcabOHIm52l6vs5K+WVkjtBhFs+KbTw8BdYzKXx5E +jtAwQJWyPQRZy39BhDguIJ/+j+yd3o= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-617-iT5aIG-SNf-F72d5224X5g-1; Sat, 05 Mar 2022 05:07:17 -0500 X-MC-Unique: iT5aIG-SNf-F72d5224X5g-1 Received: by mail-pg1-f198.google.com with SMTP id o30-20020a634e5e000000b00373598b71d4so5909072pgl.21 for ; Sat, 05 Mar 2022 02:07:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a0Fgc88E/ZnztbMYK2n/3xkvK5J7VCgRYmi3UI+KKPI=; b=ldoaqNmKezItI4qQHBSGBRwdCLHwWVvYrByk8RrW6oCgvczwpfeJgJQ7zeDa78XHzL dC7MSQuXlS9dMeQzWP/FA1F/GYQguYPDaNj+3wkAajTnx234n1s1StwmK0d1HIX+QOLx qj29L6W/cS2wHbB1SI/NJnC9xvlF23sNLSG6SHieX0NythOKaJN6RFIVM2h06ftnvIU0 q9FKsOmXiSauCQrYA8Uqvy7O/i2DAYYmM18vl0ZAkDc9Y89huX7+Rul4nzlY/A3hl3K1 Jrh13CEagVwb2P0CRJ7Xc/1Di0SJTjPmb0zBSkuoJYaWnJjlKStb45+5NxlBgNl+kCL9 qdgA== X-Gm-Message-State: AOAM531J9xsOhdpamtwVVb3YRqQmYSUKEvg9Zw7poativcz87zZtDI1m toAy81hx72cN3M76L1AN1ucsS00fnU6/egSF1UWBHI3wPSGXj8a/zBXkz1jtsril7IjuO96clm7 V8ao2WtzZ51fjPdohgz4WV/uzymLpufuKi/G2H7mu X-Received: by 2002:a17:90a:dac2:b0:1bd:fecf:6bd1 with SMTP id g2-20020a17090adac200b001bdfecf6bd1mr3049402pjx.113.1646474835962; Sat, 05 Mar 2022 02:07:15 -0800 (PST) X-Received: by 2002:a17:90a:dac2:b0:1bd:fecf:6bd1 with SMTP id g2-20020a17090adac200b001bdfecf6bd1mr3049372pjx.113.1646474835671; Sat, 05 Mar 2022 02:07:15 -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: Benjamin Tissoires Date: Sat, 5 Mar 2022 11:07:04 +0100 Message-ID: Subject: Re: [PATCH bpf-next v2 01/28] bpf: add new is_sys_admin_prog_type() helper To: Song Liu 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=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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. Regarding BPF_PROG_TYPE_EXT, it was already in both is_net_admin_prog_type() and is_perfmon_prog_type(), so I duplicated it here, but I agree, given that it's already in the first function there, CPA_SYS_ADMIN is already checked. Cheers, Benjamin > > Thanks, > Song > > [...] >