kernel-ark/kernel
Peter Zijlstra 24ec839c43 [PATCH] tty: ->signal->tty locking
Fix the locking of signal->tty.

Use ->sighand->siglock to protect ->signal->tty; this lock is already used
by most other members of ->signal/->sighand.  And unless we are 'current'
or the tasklist_lock is held we need ->siglock to access ->signal anyway.

(NOTE: sys_unshare() is broken wrt ->sighand locking rules)

Note that tty_mutex is held over tty destruction, so while holding
tty_mutex any tty pointer remains valid.  Otherwise the lifetime of ttys
are governed by their open file handles.  This leaves some holes for tty
access from signal->tty (or any other non file related tty access).

It solves the tty SLAB scribbles we were seeing.

(NOTE: the change from group_send_sig_info to __group_send_sig_info needs to
       be examined by someone familiar with the security framework, I think
       it is safe given the SEND_SIG_PRIV from other __group_send_sig_info
       invocations)

[schwidefsky@de.ibm.com: 3270 fix]
[akpm@osdl.org: various post-viro fixes]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Alan Cox <alan@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: James Morris <jmorris@namei.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Jan Kara <jack@ucw.cz>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-08 08:28:38 -08:00
..
irq [PATCH] CPEI gets warning at kernel/irq/migration.c:27/move_masked_irq() 2006-12-08 08:28:37 -08:00
power [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
time
.gitignore
acct.c [PATCH] tty: ->signal->tty locking 2006-12-08 08:28:38 -08:00
audit.c [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
audit.h
auditfilter.c [PATCH] kernel core: replace kmalloc+memset with kzalloc 2006-12-07 08:39:41 -08:00
auditsc.c [PATCH] tty: ->signal->tty locking 2006-12-08 08:28:38 -08:00
capability.c
compat.c
configs.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
cpu.c [PATCH] suspend: don't change cpus_allowed for task initiating the suspend 2006-12-07 08:39:28 -08:00
cpuset.c [PATCH] cpuset: allow a larger buffer for writes to cpuset files 2006-12-07 08:39:48 -08:00
delayacct.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
dma.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
exec_domain.c
exit.c [PATCH] tty: ->signal->tty locking 2006-12-08 08:28:38 -08:00
extable.c
fork.c Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6 2006-12-07 08:59:11 -08:00
futex_compat.c
futex.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
hrtimer.c
itimer.c
kallsyms.c [PATCH] move kallsyms data to .rodata 2006-12-08 08:28:37 -08:00
Kconfig.hz [PATCH] HZ: 300Hz support 2006-12-07 08:39:36 -08:00
Kconfig.preempt
kexec.c Merge branch 'release' of master.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6 2006-12-07 15:39:22 -08:00
kfifo.c
kmod.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-12-05 14:37:56 +00:00
kprobes.c [PATCH] kprobes: enable booster on the preemptible kernel 2006-12-07 08:39:38 -08:00
ksysfs.c
kthread.c WorkStruct: Pass the work_struct pointer instead of context data 2006-11-22 14:55:48 +00:00
latency.c [PATCH] severing module.h->sched.h 2006-12-04 02:00:22 -05:00
lockdep_internals.h [PATCH] lockdep: more chains 2006-12-07 08:39:43 -08:00
lockdep_proc.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
lockdep.c Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6 2006-12-07 08:59:11 -08:00
Makefile
module.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
mutex-debug.c [PATCH] lockdep: show more details about self-test failures 2006-12-07 08:39:43 -08:00
mutex-debug.h
mutex.c
mutex.h
nsproxy.c
panic.c
params.c
pid.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
posix-cpu-timers.c
posix-timers.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
printk.c [PATCH] add ignore_loglevel boot option 2006-12-07 08:39:47 -08:00
profile.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
ptrace.c
rcupdate.c [PATCH] rcu: add a prefetch() in rcu_do_batch() 2006-12-07 08:39:40 -08:00
rcutorture.c [PATCH] Add Sparse annotations to SRCU wrapper functions in rcutorture 2006-12-07 08:39:44 -08:00
relay.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
resource.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
rtmutex_common.h
rtmutex-debug.c
rtmutex-debug.h
rtmutex-tester.c [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
rtmutex.c
rtmutex.h
rwsem.c
sched.c [PATCH] struct seq_operations and struct file_operations constification 2006-12-07 08:39:46 -08:00
seccomp.c
signal.c [PATCH] make kernel/signal.c:kill_proc_info() static 2006-12-07 08:39:39 -08:00
softirq.c [PATCH] softirq: remove BUG_ONs which can incorrectly trigger 2006-12-07 08:39:43 -08:00
softlockup.c
spinlock.c [PATCH] lockdep: spin_lock_irqsave_nested() 2006-11-25 13:28:34 -08:00
srcu.c
stacktrace.c
stop_machine.c
sys_ni.c
sys.c [PATCH] tty: ->signal->tty locking 2006-12-08 08:28:38 -08:00
sysctl.c Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6 2006-12-07 08:59:11 -08:00
taskstats.c [PATCH] taskstats: cleanup reply assembling 2006-12-07 08:39:34 -08:00
time.c
timer.c
tsacct.c
uid16.c
unwind.c [PATCH] unwinder: move .eh_frame to RODATA 2006-12-07 02:14:19 +01:00
user.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
utsname.c
wait.c
workqueue.c Add "run_scheduled_work()" workqueue function 2006-12-07 09:28:19 -08:00