diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-10-02 05:17:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:14 -0400 |
commit | bde0d2c98bcfc9acc83ac79c33a6ac1335b95a92 (patch) | |
tree | 1bacec61e5bd5fadaef630e95e8cc1ae618b94ff /include/linux/console_struct.h | |
parent | 81af8d67d4fc35b1ee6e0feb1f1b34b3a33eeb44 (diff) |
[PATCH] vt: Make vt_pid a struct pid (making it pid wrap around safe).
I took a good hard look at the locking and it appears the locking on vt_pid
is the console semaphore. Every modified path is called under the console
semaphore except reset_vc when it is called from fn_SAK or do_SAK both of
which appear to be in interrupt context. In addition I need to be careful
because in the presence of an oops the console_sem may be arbitrarily
dropped.
Which leads me to conclude the current locking is inadequate for my needs.
Given the weird cases we could hit because of oops printing instead of
introducing an extra spin lock to protect the data and keep the pid to
signal and the signal to send in sync, I have opted to use xchg on just the
struct pid * pointer instead.
Due to console_sem we will stay in sync between vt_pid and vt_mode except
for a small window during a SAK, or oops handling. SAK handling should
kill any user space process that care, and oops handling we are broken
anyway. Besides the worst that can happen is that I try to send the wrong
signal.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/console_struct.h')
-rw-r--r-- | include/linux/console_struct.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index 25423f79bf9f..ed6c0fee1ac7 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
@@ -54,7 +54,7 @@ struct vc_data { | |||
54 | struct tty_struct *vc_tty; /* TTY we are attached to */ | 54 | struct tty_struct *vc_tty; /* TTY we are attached to */ |
55 | /* data for manual vt switching */ | 55 | /* data for manual vt switching */ |
56 | struct vt_mode vt_mode; | 56 | struct vt_mode vt_mode; |
57 | int vt_pid; | 57 | struct pid *vt_pid; |
58 | int vt_newvt; | 58 | int vt_newvt; |
59 | wait_queue_head_t paste_wait; | 59 | wait_queue_head_t paste_wait; |
60 | /* mode flags */ | 60 | /* mode flags */ |