kernel-ark/include
David Howells 04c567d931 [PATCH] Keys: Fix race between two instantiators of a key
Add a revocation notification method to the key type and calls it whilst
the key's semaphore is still write-locked after setting the revocation
flag.

The patch then uses this to maintain a reference on the task_struct of the
process that calls request_key() for as long as the authorisation key
remains unrevoked.

This fixes a potential race between two processes both of which have
assumed the authority to instantiate a key (one may have forked the other
for example).  The problem is that there's no locking around the check for
revocation of the auth key and the use of the task_struct it points to, nor
does the auth key keep a reference on the task_struct.

Access to the "context" pointer in the auth key must thenceforth be done
with the auth key semaphore held.  The revocation method is called with the
target key semaphore held write-locked and the search of the context
process's keyrings is done with the auth key semaphore read-locked.

The check for the revocation state of the auth key just prior to searching
it is done after the auth key is read-locked for the search.  This ensures
that the auth key can't be revoked between the check and the search.

The revocation notification method is added so that the context task_struct
can be released as soon as instantiation happens rather than waiting for
the auth key to be destroyed, thus avoiding the unnecessary pinning of the
requesting process.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-22 15:05:56 -07:00
..
acpi Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
asm-alpha Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
asm-arm Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-06-20 17:52:36 -07:00
asm-arm26 Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-cris Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-frv Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-generic Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
asm-h8300 Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-i386 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-05-24 09:22:21 +01:00
asm-ia64 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-05-24 09:22:21 +01:00
asm-m32r Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-m68k Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-m68knommu Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-mips Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
asm-parisc Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-powerpc Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
asm-ppc Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-05-24 09:22:21 +01:00
asm-s390 [PATCH] s390: add __raw_writeq required by __iowrite64_copy 2006-06-20 19:55:53 -07:00
asm-sh Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-sh64 Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-sparc Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6 2006-06-20 17:39:28 -07:00
asm-sparc64 Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6 2006-06-20 17:39:28 -07:00
asm-um Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
asm-v850 Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
asm-x86_64 Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
asm-xtensa Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
keys
linux [PATCH] Keys: Fix race between two instantiators of a key 2006-06-22 15:05:56 -07:00
math-emu
media Revert include/media changes: Mauro says those ioctls are only used in-kernel(!) 2006-05-06 19:47:57 +01:00
mtd Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
net Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2006-06-20 17:39:53 -07:00
pcmcia Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
rdma IB/uverbs: Don't serialize with ib_uverbs_idr_mutex 2006-06-17 20:44:49 -07:00
rxrpc
scsi Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2006-06-21 11:18:25 -07:00
sound [ALSA] version 1.0.12rc1 2006-06-22 21:35:11 +02:00
video Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00