Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp351202rwe; Fri, 14 Apr 2023 04:01:33 -0700 (PDT) X-Google-Smtp-Source: AKy350YKFA45IkuNA5CdAi750THh8U7IxlLNRUfLVEFX/9PxtIsFMpA3M9h3UzfIIrqtz7VkWqx0 X-Received: by 2002:a05:6870:ec9f:b0:184:1d37:f215 with SMTP id eo31-20020a056870ec9f00b001841d37f215mr3591779oab.27.1681470093591; Fri, 14 Apr 2023 04:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681470093; cv=none; d=google.com; s=arc-20160816; b=THCyyXyHIdR3ibQp2cT++kH+aMQa4WQ4o5VQEXd/96JT+4/lIVm3MwxnQJRZDqybm4 WFjwpyj/NT8Dtg/IZEmwROmNJfHzHYsXXb6++cscXT4LAo9q0eU1E7+qjPQw4nvYlOMl Tka/YFWIgFBnAkIsj0qB5ZD8gvHLHle0rIl5I8s9u7NwxUrJ6jSxXQUr9FpDHBkbdmjW kxXr2CoQCCYMIioxqclHZqoh4YCult7Eb+dXcNaonlXmfcB5WIos1s7AIXFB/tXnQUsH xQc33+38ui1bg0BmRm0M+N4wGgl3kE/dv4cpAw7y3xbT77vMdrAmukg2TAldnc0azne0 zVQQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0IgaFXRmis5Y8lw1mhiElTRY6ohLFgA8NBuE/kzdp74=; b=QW9H7et3QFgwEzD8cE5FPl5SbFIMXiniUCv6d5uJddjlhmkha/Ld2vhpt5VIOXzBF9 EKl+NrEp8fIHyRgEo0pt/tTosVs1U5+xOhGNL3u8+JagagwrP4wX4BsAurocpmTv1VV4 bbUUguiPOdbWCGhiq5Nw3uf+r7cM1jWsuUrFXWF0NF37/2mjT0F1YsixhgXz1WL/JNNy tC0rzniEbsP7/5VTGPKV5uqjlzD/rEhRDZaRXTGk/jY8UFvZH9cUe40kFXWF/kcU4ghh VbqU7TvOQpSfX5NC+5W/eMv5oJj9umCNUVWsqzCe1GqmUNU2GN/J8rdQnA4TnzIeF3+V fOWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mess.org header.s=2020 header.b=DASlhFii; 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=mess.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w25-20020a056870b39900b0017b00be351esi3823113oap.175.2023.04.14.04.01.20; Fri, 14 Apr 2023 04:01:33 -0700 (PDT) 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=@mess.org header.s=2020 header.b=DASlhFii; 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=mess.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229874AbjDNK6y (ORCPT + 99 others); Fri, 14 Apr 2023 06:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjDNK6x (ORCPT ); Fri, 14 Apr 2023 06:58:53 -0400 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C0BC35B1; Fri, 14 Apr 2023 03:58:51 -0700 (PDT) Received: by gofer.mess.org (Postfix, from userid 1000) id 1F8B110006C; Fri, 14 Apr 2023 11:58:49 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mess.org; s=2020; t=1681469929; bh=xKiD6D1LLlILVuQ63mXofNbz+Er3mjpqtu6nPh1Rix4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DASlhFii98NU/JfhobCC0DOl9M0BmHu4kE4MAY2cThrVTDyYDK0/h7yuHUT31E/gj Ir66Tf09vvBeXCOMvv4sfg68RdeM3+hweFIqWv7M/dfIDLtUEQiXogUcAr+uuLoMVA xiaGVNmnWU0s9+g/gMPNaNkMSJUCwkIU+iZRKFJtUUNcJDi8YNggyaFU4/it3D6+BP 4qBXgc0ecSLvTKab3fBjj+Rlu4Pq0wfQ0Qd/dfj3ZQit/a2D31yKLxtIjU9BwRxO1q l/6HmButEPLq2NV9CnoFMitN+cpV6JUSDilPngcEBmlHOjYCf87+Ac16OPP/DokbTw brmBhlGK9qDrg== Date: Fri, 14 Apr 2023 11:58:49 +0100 From: Sean Young To: Alexei Starovoitov Cc: Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf , LKML , linux-media@vger.kernel.org Subject: Re: [PATCH] bpf: lirc program type should not require SYS_CAP_ADMIN Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,LOTS_OF_MONEY,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 Thu, Apr 13, 2023 at 04:54:21PM -0700, Alexei Starovoitov wrote: > On Thu, Apr 13, 2023 at 1:28 AM Sean Young wrote: > > > > On Wed, Apr 12, 2023 at 04:14:05PM -0700, Alexei Starovoitov wrote: > > > On Tue, Apr 11, 2023 at 8:45 AM Sean Young wrote: > > > > > > > > Make it possible to load lirc program type with just CAP_BPF. > > > > > > Is it safe? > > > If the user can load with just CAP_BPF the FD to the prog and target_fd > > > will allow attach as well. > > > > Exactly, that's the $1m question of course. > > > > I think it's safe from a lirc perspective because you need to be able to > > open the /dev/lirc0 device in the first place; if you can open it, you > > alter all sorts of lirc receiving options already. Changing the IR protocol > > decoder is no different in that perspective. > > > > The other side of course, is it save to load a bpf lirc program as a normal > > user. I don't see any issue with this; I guess this depends on whether the > > subset of functions in lirc_mode2_func_proto() is safe. I am hoping that > > the expert opinion everyone here can help answer that question. > > That part is fine under CAP_BPF. > I don't know how lirc devices are typically setup. > If they need root to open them > then why bother relaxing bpf loading part? I'd like to get a point where /dev/lircN can have the same permissions as for example /dev/videoN devices: group read/write, so that local users don't have to become root to use them. Without relaxing the bpf side, this seems like a chicken and egg problem (tiktaalik and egg?). Also - the CAP_NET_ADMIN requirement seems completely arbitrary compared to other program types. Sean