[PATCH v2 0/4] Firmware LSM hook
Jason Gunthorpe
jgg at ziepe.ca
Fri Apr 24 22:13:10 UTC 2026
On Fri, Apr 24, 2026 at 04:59:30PM -0400, Paul Moore wrote:
> >
> > > Most LSMs will want to know who is initiating the firmware request
> > > (the subject), the requested operation/opcode (the action/verb), and
> > > the target of the request (the object, which in this case is likely
> > > the kernel or the device).
> >
> > How is
> > system_u:object_r:httpd_packet_t:s0
> >
> > A kernel or device?
>
> It's not. It's one of two labels on a packet. I've cautioned you
> about leaning too heavily on the secmark comparison as it falls apart
> in a number of places, this is one of those places.
But I want to label a packet too, you keep going back to it not being
the same thing and I keep repeating that all I want to do is put
labels on FWCTL packets :(
> > It is a label for packet contents. I also want a label for packet contents.
>
> According to your explanations, my understanding is that you want a
> fwctl RPC operation. That is not the same as the secmark label
> assigned by an iptables/nftables rule.
I view fwctl as an opaque packet based messaging subsystem. It
communicates a packet to a remote CPU and returns a response packet
back to the userspace.
Trying to have the kernel assign fixed meaning to the content of the
packets inside the kernel is contrary to the entire design of fwctl.
It is like demanding the netstack parse HTTP packets as a precondition
to using LSM. It makes no sense.
Any LSM integration requires a labeling system that is not hard wired
into the built kernel. I don't much care what it is, so long as the
classification and label space are defined by userspace.
You say it is not like secmark, fine, but I see a perfect mirror in
secmark...
> > You can take that view, it is certainly one valid way to look at it.
> >
> > But it is completely impractical.
>
> Elaborate on that, because from what I can tell that is the valid way
> to look at it from a subject/verb/object perspective.
We cannot have the kernel predefine verb labels.
I'm completely fine with using verb if it can be dynamic and userspace
can tell the kernel what the verbs labels are.
This is the only reason I pointed at secmark, it shows a system that
has both a user controller classifier and dynamic labels that are not
fixed into the built kernel. ie it is flexible.
> > > > The same way secmark cannot pre-identify all the XXX_packet_t's.
> > >
> > > Once again, I think there is a disconnect or misunderstanding, on a
> > > SELinux system using secmark all of the packet types, e.g.
> > > "XXX_packet_t's", *are* pre-defined in the SELinux policy.
> >
> > "Pre-defined" in a text files in user space controlled by the admin.
>
> That's not correct. It's kinda like saying the NIC driver sources are
> simply "text files in user space controlled by the admin".
That's very pedantic. I mean to the point I wonder if we are even
speaking the same language.
I said the labels are defined by userspace, you said no, and then
explained that they are defined by userspace going through a bunch of
steps:
> The SELinux secmark labels are defined in the SELinux policy sources
> which must be compiled and loaded into the kernel before they are
> valid on a running system. Policy must be written not only to define
> the secmark labels, but also to define the access control rules
> which govern how those packets are handled by the system. The
> iptables/nftables command lines simply assign a secmark label to a
> packet; that's important, but only a small part of the total
> equation.
I understand all of this, I am totally fine with it. A package will
install, a distribution will provide, or admin will write these
things, and do all the steps to load them into the kernel. I don't see
any issue with that.
Hardwiring things into the built kernel is a problem that must be
avoided because end users only run the kernel provided by the
distribution. "recompiling the driver" is not an option that is
available.
Jason
More information about the Linux-security-module-archive
mailing list