On Wed, Jul 03, 2002 at 04:04:50PM -0400, jmjonesat_private wrote: > Things I'd Like To See As a Module Maintainer: > [...] > 2) Have the module pass the length of the structure it is registering when > it registers the structure (most likely as "number of hooks".) This could > be simply another integer in the registration function call, since the > registration code would probably know the size of a pointer. Where would you get the size of this structure? Count all the entries? izeof(security_ops)? The first is tedius, non-standard, and error-prone. The second will fix only a certain class of problems: when a module compiled for kernel version X is loaded into kernel version Y -- which is already pretty well marked as unsupported. (Modutils will refuse to do it without --force.) When the module source is recompiled against the kernel it will be used with, this check will never trigger. (#include <linux/security.h> in module source...) > 3) Copy the default pointer to all the pointers in the internal structure > before doing anything else. > > 4) Copy the specified structure into the functional structure, based on > the number of hooks specified. Perhaps the biggest downside to this approach is that it would require some novel approach to populating a structure with function pointers, rather than relying on the compiler to get all the details right. All my attempts to sketch out what it might look like make me think it would never be allowed into the kernel. One possibility is that I just can't think of a clean method of doing it, so if you can put together a patch that (a) does this in an SMP-safe fashion and (b) doesn't look horrendous I'd be less hostile to the idea. :) (Modifying SELinux, LIDS, capabilities, euid==0, DTE, and owlsm modules to use your new idea would also be keen. :) One other thing to consider: to my knowledge, no other kernel system tries to prevent out of date modules from doing Stupid Things. If LSM does, it would be the first, aside from the message insmod prints when it refuses to laod a module compiled for a different kernel version. -- http://www.wirex.com/
This archive was generated by hypermail 2b30 : Wed Jul 03 2002 - 14:18:51 PDT