I'm experimenting with Linux Security Modules, trying to make one.
My main source of knowledge about how they're supposed to work are mailing lists archives and the existing LSMs' sources, plus the few pages about them in the Linux documentation.
I understand that there are two kinds of LSMs.
- Exclusive LSMs like SELinux / AppArmor, which have the
LSM_FLAG_EXCLUSIVE
flag set in their LSM definition. - Non-exclusive LSMs like Yama, capabilities or lockdown.
Browsing the source code of all these LSMs, I figured out non-exclusive ones never make use of security blobs. On the other hand, exclusive ones make heavy use of them.
For instance, see the AppArmor LSM definition, and the one for Yama.
So, can non-exclusive LSMs specify blob sizes and use this feature ?
Trying to find an answer, I explored the framework's source to see if maybe security blobs were switched between each LSM hook call, I guess that would allow each LSM to only have access to its own blobs and not those of another LSM.
However, we can see here in the LSM framework that it is not the case.
If my LSM declares blob sizes, can I use the blobs if my kernel also have SELinux, for instance, enabled ? Won't the structures from SELinux and mine overlap ?