diff options
author | Cedric Le Goater <clg@fr.ibm.com> | 2006-10-02 05:19:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:25 -0400 |
commit | 9ec52099e4b8678a60e9f93e41ad87885d64f3e6 (patch) | |
tree | a68fe051b39f8f8e8be469cbd3c2f653b9b71a9d /include | |
parent | 1a657f78dcc8ea7c53eaa1f2a45ea2315738c15f (diff) |
[PATCH] replace cad_pid by a struct pid
There are a few places in the kernel where the init task is signaled. The
ctrl+alt+del sequence is one them. It kills a task, usually init, using a
cached pid (cad_pid).
This patch replaces the pid_t by a struct pid to avoid pid wrap around
problem. The struct pid is initialized at boot time in init() and can be
modified through systctl with
/proc/sys/kernel/cad_pid
[ I haven't found any distro using it ? ]
It also introduces a small helper routine kill_cad_pid() which is used
where it seemed ok to use cad_pid instead of pid 1.
[akpm@osdl.org: cleanups, build fix]
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sched.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 9ba959e34266..38530232d92f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1065,6 +1065,8 @@ static inline int is_init(struct task_struct *tsk) | |||
1065 | return tsk->pid == 1; | 1065 | return tsk->pid == 1; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | extern struct pid *cad_pid; | ||
1069 | |||
1068 | extern void free_task(struct task_struct *tsk); | 1070 | extern void free_task(struct task_struct *tsk); |
1069 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) | 1071 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) |
1070 | 1072 | ||
@@ -1292,6 +1294,11 @@ extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *); | |||
1292 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); | 1294 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); |
1293 | extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); | 1295 | extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); |
1294 | 1296 | ||
1297 | static inline int kill_cad_pid(int sig, int priv) | ||
1298 | { | ||
1299 | return kill_pid(cad_pid, sig, priv); | ||
1300 | } | ||
1301 | |||
1295 | /* These can be the second arg to send_sig_info/send_group_sig_info. */ | 1302 | /* These can be the second arg to send_sig_info/send_group_sig_info. */ |
1296 | #define SEND_SIG_NOINFO ((struct siginfo *) 0) | 1303 | #define SEND_SIG_NOINFO ((struct siginfo *) 0) |
1297 | #define SEND_SIG_PRIV ((struct siginfo *) 1) | 1304 | #define SEND_SIG_PRIV ((struct siginfo *) 1) |