CRED: Add some configurable debugging [try #6]
authorDavid Howells <dhowells@redhat.com>
Wed, 2 Sep 2009 08:13:40 +0000 (09:13 +0100)
committerJames Morris <jmorris@namei.org>
Wed, 2 Sep 2009 11:29:01 +0000 (21:29 +1000)
commite0e817392b9acf2c98d3be80c233dddb1b52003d
treeee680c020039313c9f9c40ab3542bb30a7363381
parented6d76e4c32de0c2ad5f1d572b948ef49e465176
CRED: Add some configurable debugging [try #6]

Add a config option (CONFIG_DEBUG_CREDENTIALS) to turn on some debug checking
for credential management.  The additional code keeps track of the number of
pointers from task_structs to any given cred struct, and checks to see that
this number never exceeds the usage count of the cred struct (which includes
all references, not just those from task_structs).

Furthermore, if SELinux is enabled, the code also checks that the security
pointer in the cred struct is never seen to be invalid.

This attempts to catch the bug whereby inode_has_perm() faults in an nfsd
kernel thread on seeing cred->security be a NULL pointer (it appears that the
credential struct has been previously released):

http://www.kerneloops.org/oops.php?number=252883

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
fs/nfsd/auth.c
fs/nfsd/nfssvc.c
fs/nfsd/vfs.c
fs/open.c
include/linux/cred.h
kernel/cred.c
kernel/exit.c
kernel/fork.c
kernel/kmod.c
lib/Kconfig.debug
security/selinux/hooks.c