* Re: [PATCH v2 0/4] Firmware LSM hook
[not found] ` <20260424221310.GA804026@ziepe.ca>
@ 2026-05-04 22:33 ` Paul Moore
2026-05-12 8:51 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Paul Moore @ 2026-05-04 22:33 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Leon Romanovsky, Roberto Sassu, KP Singh, Matt Bobrowski,
Alexei Starovoitov, Daniel Borkmann, John Fastabend,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Saeed Mahameed, Itay Avraham, Dave Jiang, Jonathan Cameron, bpf,
linux-kernel, linux-kselftest, linux-rdma, Chiara Meiohas,
Maher Sanalla, linux-security-module
On Fri, Apr 24, 2026 at 6:13 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
>
> ... I wonder if we are even speaking the same language.
Let's reset the conversation.
As I understand it, based on our discussion in this thread and Leon's
previous patchsets, the basic idea is to enable LSMs to enforce access
control over fwctl requests/commands sent from userspace. I'm going
to start with that as a basis.
Using the kernel's docs on fwctl, the userspace API appears to consist
mostly of ioctls with some basic sysfs interfaces. It looks like we
can mostly ignore the sysfs interface and focus on the ioctl side of
the API, do you agree?
https://docs.kernel.org/userspace-api/fwctl/fwctl.html
While normally I would suggest simply using the existing
security_file_ioctl() hook, Leon previously mentioned that the hook is
too early for fwctl as the userspace copy happens much later. Looking
at the code, it appears that the copy happens in fwctl_fops_ioctl()
for all fwctl ioctls regardless of the device or ioctl, is that
correct?
Assuming the above is correct, how about the following LSM hook,
called after the copy_struct_from_user() in fwctl_fops_ioctl()?
union fwctl_data {
struct fwctl_info info;
struct fwctl_rpc rpc;
}
int security_fwctl_ioctl(struct file *filep, unsigned int cmd, union
fwctl_data *arg)
Where @filep is the file/device being sent the ioctl, @cmd is the
ioctl command number (e.g. FWCTL_RPC), and @arg is the copied ioctl
data (e.g. ucmd.cmd in fwctl_fops_ioctl). In addition to applying
access controls based on the ioctl command number, a capability that
already exists via the security_file_ioctl() hook, LSMs could also
apply access controls based on the RPC scope as well as any other well
defined data in the ioctl payload.
I expect most of the existing LSMs would implement callbacks for this
new hook with the subject being the process submitting the ioctl, the
object being the file/device that is being operated on with the
ioctl() call, and the access/privilege/verb/etc. being something along
the lines of INFO, RPC_CONFIG, RPC_DEBUG_READ, RPC_DEBUG_WRITE, or
RPC_DEBUG_WRITE_FULL. Of course these are just quick examples to
demonstrate a point, please don't take those names as hard
requirements. Each LSM is free to characterize the access request
however they like, in a way that best aligns with their security
model.
--
paul-moore.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2 0/4] Firmware LSM hook
2026-05-04 22:33 ` [PATCH v2 0/4] Firmware LSM hook Paul Moore
@ 2026-05-12 8:51 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2026-05-12 8:51 UTC (permalink / raw)
To: Paul Moore
Cc: Jason Gunthorpe, Roberto Sassu, KP Singh, Matt Bobrowski,
Alexei Starovoitov, Daniel Borkmann, John Fastabend,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Saeed Mahameed, Itay Avraham, Dave Jiang, Jonathan Cameron, bpf,
linux-kernel, linux-kselftest, linux-rdma, Chiara Meiohas,
Maher Sanalla, linux-security-module
On Mon, May 04, 2026 at 06:33:45PM -0400, Paul Moore wrote:
> On Fri, Apr 24, 2026 at 6:13 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> >
> > ... I wonder if we are even speaking the same language.
>
> Let's reset the conversation.
>
> As I understand it, based on our discussion in this thread and Leon's
> previous patchsets, the basic idea is to enable LSMs to enforce access
> control over fwctl requests/commands sent from userspace. I'm going
> to start with that as a basis.
Yes, we proposed two users: FWCTL and RDMA DevX. Both are relevant, but
FWCTL is the higher priority.
>
> Using the kernel's docs on fwctl, the userspace API appears to consist
> mostly of ioctls with some basic sysfs interfaces. It looks like we
> can mostly ignore the sysfs interface and focus on the ioctl side of
> the API, do you agree?
Yes, all FW commands are routed through ioctls.
>
> https://docs.kernel.org/userspace-api/fwctl/fwctl.html
>
> While normally I would suggest simply using the existing
> security_file_ioctl() hook, Leon previously mentioned that the hook is
> too early for fwctl as the userspace copy happens much later.
I talked about general verbs interface in RDMA.
Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-12 8:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260413164220.GP3694781@ziepe.ca>
[not found] ` <CAHC9VhR1Uke9P==CELKavBcogHoNCtMZFfNWUbgm5HYUfomhtw@mail.gmail.com>
[not found] ` <20260413231920.GS3694781@ziepe.ca>
[not found] ` <CAHC9VhTLamfe4C81ZNRVT=H32x+KLxSqH3o0eBfrHsWAgAqxCA@mail.gmail.com>
[not found] ` <20260415134705.GG2577880@ziepe.ca>
[not found] ` <CAHC9VhSECYihup=tURo_Qk__xUdYYPkHgnz5CWA0BrRAkvwbog@mail.gmail.com>
[not found] ` <20260417191749.GK2577880@ziepe.ca>
[not found] ` <CAHC9VhQbpS9XpO6dWu7gOiX=ppjtAxnNBOFe6s5wjEZNpMRjgw@mail.gmail.com>
[not found] ` <20260424143603.GB3611611@ziepe.ca>
[not found] ` <CAHC9VhR++21SD+v4Bb16SQmYHgJYZ0ytQ+BecGPNK+fEOe4G7g@mail.gmail.com>
[not found] ` <20260424221310.GA804026@ziepe.ca>
2026-05-04 22:33 ` [PATCH v2 0/4] Firmware LSM hook Paul Moore
2026-05-12 8:51 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox