As a general rule, if you think you want to initiate operations on
files, file attributes, pathnames etc. from the kernel you have made
a design error and need to stop and re-evaluate what you are doing.
That's usually true although I don't see any other method that is more
elegant - maybe you do, so let me explain what I'm trying to do :
===
- open() is hooked with Kauth
- if there is some special extended attribute set on the opening file,
handle some security issues before returning a file descriptor, else,
return the proper fd.
===
Do you see any other way to keep track of the files handled by the
security module? (please note that the extended attribute holds some
meaningful data for the kernel)
Sure, now we can question about the purpose of the security module,
why it has to rely on userspace data, etc... but focusing on the
approach I've described, do you see any other solution to keep track
about which files to handle in a special manner?