From patchwork Mon Apr 17 08:17:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 91377 X-Patchwork-Delegate: sean@mess.org Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1poK3h-0037FO-FR; Mon, 17 Apr 2023 08:17:57 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbjDQIRy (ORCPT + 1 other); Mon, 17 Apr 2023 04:17:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbjDQIRw (ORCPT ); Mon, 17 Apr 2023 04:17:52 -0400 Received: from gofer.mess.org (gofer.mess.org [88.97.38.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 765F526B2; Mon, 17 Apr 2023 01:17:51 -0700 (PDT) Received: by gofer.mess.org (Postfix, from userid 1000) id E7D8610006B; Mon, 17 Apr 2023 09:17:48 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mess.org; s=2020; t=1681719468; bh=7vrhf8jHivfnFCYmFG2HbdBI1KmJjq7kYoSAnAQyO6E=; h=Date:From:To:Subject:From; b=jnAgdxobsyQiBO+mf1lTUJ1l5zVhvTjnfE96jSjMen+Ig9xVjqbgI/Ubnlck59ZXp vzKJEYsWBTXyQrm5bN3Xnvl6okOHiX7XO9BPX1staWHeOTQ0DSyu2PX0FU1KgyG5qg d/qAe9ZCVFPKSMmKRObAIK2YwGHRDOkJEjYRSZ99Y2RwPSExY+DdGi3S4KNP4EyOC+ nbytIPrORFxBMRkD81whgTUHLjBTzLCZXXPC55rw8iSf2kuRwfQBntSnREQqQxTxkN 5hMMWES2xojiQ2CKHMZ0U+GKLRwcjOLzhK7eJpEgd7fejBMwz4CFDAzBTY+3SVv99s OvK3PIULkQP9A== Date: Mon, 17 Apr 2023 09:17:48 +0100 From: Sean Young To: 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, linux-media@vger.kernel.org Subject: [PATCH v2] bpf: lirc program type should not require SYS_CAP_ADMIN Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no Make it possible to load lirc program type with just CAP_BPF. There is nothing exceptional about lirc programs that means they require SYS_CAP_ADMIN. In order to attach or detach a lirc program type you need permission to open /dev/lirc0; if you have permission to do that, you can alter all sorts of lirc receiving options. Changing the IR protocol decoder is no different. Right now on a typical distribution /dev/lirc devices are only read/write by root. Ideally we would make them group read/write like other devices so that local users can use them without becoming root. Signed-off-by: Sean Young --- kernel/bpf/syscall.c | 1 - 1 file changed, 1 deletion(-) v2: improved commit message diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 6d575505f89c..822ebc742a6a 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -2463,7 +2463,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: