public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, bpf <bpf@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] bpf: lirc program type should not require SYS_CAP_ADMIN
Date: Fri, 14 Apr 2023 11:58:49 +0100	[thread overview]
Message-ID: <ZDkx6WAWmwHpBJ6m@gofer.mess.org> (raw)
In-Reply-To: <CAADnVQLOmDEQsHX4XfgETXUte9mJ+-qphR_E7dcjXB2PMDaZnA@mail.gmail.com>

On Thu, Apr 13, 2023 at 04:54:21PM -0700, Alexei Starovoitov wrote:
> On Thu, Apr 13, 2023 at 1:28 AM Sean Young <sean@mess.org> 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 <sean@mess.org> 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

  reply	other threads:[~2023-04-14 10:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 15:44 [PATCH] bpf: lirc program type should not require SYS_CAP_ADMIN Sean Young
2023-04-12 23:14 ` Alexei Starovoitov
2023-04-13  8:28   ` Sean Young
2023-04-13 23:54     ` Alexei Starovoitov
2023-04-14 10:58       ` Sean Young [this message]
2023-04-14 15:39         ` Alexei Starovoitov
2023-04-14 17:49           ` Sean Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZDkx6WAWmwHpBJ6m@gofer.mess.org \
    --to=sean@mess.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox