aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2006-12-08 05:36:04 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:28:38 -0500
commit24ec839c431eb79bb8f6abc00c4e1eb3b8c4d517 (patch)
tree2ff478b1925159eeac007913c2a8f19d5f5e6010 /include/linux/tty.h
parent562f9c574e0707f9159a729ea41faf53b221cd30 (diff)
[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>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f717f0898238..1d29999a3439 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -309,6 +309,12 @@ extern void tty_ldisc_flush(struct tty_struct *tty);
309extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 309extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
310 unsigned long arg); 310 unsigned long arg);
311 311
312extern dev_t tty_devnum(struct tty_struct *tty);
313extern void proc_clear_tty(struct task_struct *p);
314extern void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
315extern void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
316extern struct tty_struct *get_current_tty(void);
317
312extern struct mutex tty_mutex; 318extern struct mutex tty_mutex;
313 319
314/* n_tty.c */ 320/* n_tty.c */
@@ -335,10 +341,5 @@ extern void console_print(const char *);
335extern int vt_ioctl(struct tty_struct *tty, struct file * file, 341extern int vt_ioctl(struct tty_struct *tty, struct file * file,
336 unsigned int cmd, unsigned long arg); 342 unsigned int cmd, unsigned long arg);
337 343
338static inline dev_t tty_devnum(struct tty_struct *tty)
339{
340 return MKDEV(tty->driver->major, tty->driver->minor_start) + tty->index;
341}
342
343#endif /* __KERNEL__ */ 344#endif /* __KERNEL__ */
344#endif 345#endif