linux/security/selinux
Linus Torvalds 95f4efb2d7 selinux: simplify and clean up inode_has_perm()
This is a rather hot function that is called with a potentially NULL
"struct common_audit_data" pointer argument.  And in that case it has to
provide and initialize its own dummy common_audit_data structure.

However, all the _common_ cases already pass it a real audit-data
structure, so that uncommon NULL case not only creates a silly run-time
test, more importantly it causes that function to have a big stack frame
for the dummy variable that isn't even used in the common case!

So get rid of that stupid run-time behavior, and make the (few)
functions that currently call with a NULL pointer just call a new helper
function instead (naturally called inode_has_perm_noapd(), since it has
no adp argument).

This makes the run-time test be a static code generation issue instead,
and allows for a much denser stack since none of the common callers need
the dummy structure.  And a denser stack not only means less stack space
usage, it means better cache behavior.  So we have a win-win-win from
this simplification: less code executed, smaller stack footprint, and
better cache behavior.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-06-08 15:11:56 -07:00
..
include Merge branch 'master' of git://git.infradead.org/users/eparis/selinux into for-linus 2011-05-24 23:20:19 +10:00
ss selinux: don't pass in NULL avd to avc_has_perm_noaudit 2011-05-26 18:13:57 -07:00
.gitignore SELinux: add .gitignore files for dynamic classes 2009-10-24 09:42:27 +08:00
avc.c selinux: don't pass in NULL avd to avc_has_perm_noaudit 2011-05-26 18:13:57 -07:00
exports.c secmark: make secmark object handling generic 2010-10-21 10:12:48 +11:00
hooks.c selinux: simplify and clean up inode_has_perm() 2011-06-08 15:11:56 -07:00
Kconfig selinux: Deprecate and schedule the removal of the the compat_net functionality 2008-12-31 12:54:11 -05:00
Makefile selinux: change to new flag variable 2010-10-21 10:12:40 +11:00
netif.c security,rcu: convert call_rcu(sel_netif_free) to kfree_rcu() 2011-05-07 22:51:05 -07:00
netlabel.c Fix common misspellings 2011-03-31 11:26:23 -03:00
netlink.c Merge branch 'master' into next 2010-05-06 10:56:07 +10:00
netnode.c SELinux: silence build warning when !CONFIG_BUG 2011-04-25 10:18:27 -04:00
netport.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
nlmsgtab.c SELinux: define permissions for DCB netlink messages 2010-12-16 12:50:17 -05:00
selinuxfs.c Merge branch 'master' of git://git.infradead.org/users/eparis/selinux into for-linus 2011-05-24 23:20:19 +10:00
xfrm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2011-03-16 16:29:25 -07:00