aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-06-17 10:50:37 -0400
committerOleg Nesterov <oleg@redhat.com>2011-06-22 13:26:28 -0400
commita288eecce5253cc1565d400a52b9b476a157e040 (patch)
treea933dd8c9791be83b7a67a33502c79e7b441960e /kernel
parentf3c04b934d429b1ace21866f011b66de328c0dc9 (diff)
ptrace: kill trivial tracehooks
At this point, tracehooks aren't useful to mainline kernel and mostly just add an extra layer of obfuscation. Although they have comments, without actual in-kernel users, it is difficult to tell what are their assumptions and they're actually trying to achieve. To mainline kernel, they just aren't worth keeping around. This patch kills the following trivial tracehooks. * Ones testing whether task is ptraced. Replace with ->ptrace test. tracehook_expect_breakpoints() tracehook_consider_ignored_signal() tracehook_consider_fatal_signal() * ptrace_event() wrappers. Call directly. tracehook_report_exec() tracehook_report_exit() tracehook_report_vfork_done() * ptrace_release_task() wrapper. Call directly. tracehook_finish_release_task() * noop tracehook_prepare_release_task() tracehook_report_death() This doesn't introduce any behavior change. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/exit.c7
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/signal.c8
3 files changed, 7 insertions, 10 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index e5cc05644609..d49134a7f250 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -169,7 +169,6 @@ void release_task(struct task_struct * p)
169 struct task_struct *leader; 169 struct task_struct *leader;
170 int zap_leader; 170 int zap_leader;
171repeat: 171repeat:
172 tracehook_prepare_release_task(p);
173 /* don't need to get the RCU readlock here - the process is dead and 172 /* don't need to get the RCU readlock here - the process is dead and
174 * can't be modifying its own credentials. But shut RCU-lockdep up */ 173 * can't be modifying its own credentials. But shut RCU-lockdep up */
175 rcu_read_lock(); 174 rcu_read_lock();
@@ -179,7 +178,7 @@ repeat:
179 proc_flush_task(p); 178 proc_flush_task(p);
180 179
181 write_lock_irq(&tasklist_lock); 180 write_lock_irq(&tasklist_lock);
182 tracehook_finish_release_task(p); 181 ptrace_release_task(p);
183 __exit_signal(p); 182 __exit_signal(p);
184 183
185 /* 184 /*
@@ -868,8 +867,6 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
868 wake_up_process(tsk->signal->group_exit_task); 867 wake_up_process(tsk->signal->group_exit_task);
869 write_unlock_irq(&tasklist_lock); 868 write_unlock_irq(&tasklist_lock);
870 869
871 tracehook_report_death(tsk, signal, cookie, group_dead);
872
873 /* If the process is dead, release it - nobody will wait for it */ 870 /* If the process is dead, release it - nobody will wait for it */
874 if (signal == DEATH_REAP) 871 if (signal == DEATH_REAP)
875 release_task(tsk); 872 release_task(tsk);
@@ -924,7 +921,7 @@ NORET_TYPE void do_exit(long code)
924 */ 921 */
925 set_fs(USER_DS); 922 set_fs(USER_DS);
926 923
927 tracehook_report_exit(&code); 924 ptrace_event(PTRACE_EVENT_EXIT, code);
928 925
929 validate_creds_for_do_exit(tsk); 926 validate_creds_for_do_exit(tsk);
930 927
diff --git a/kernel/fork.c b/kernel/fork.c
index 0276c30401a0..d4f0dff9d617 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1527,7 +1527,7 @@ long do_fork(unsigned long clone_flags,
1527 freezer_do_not_count(); 1527 freezer_do_not_count();
1528 wait_for_completion(&vfork); 1528 wait_for_completion(&vfork);
1529 freezer_count(); 1529 freezer_count();
1530 tracehook_report_vfork_done(p, nr); 1530 ptrace_event(PTRACE_EVENT_VFORK_DONE, nr);
1531 } 1531 }
1532 } else { 1532 } else {
1533 nr = PTR_ERR(p); 1533 nr = PTR_ERR(p);
diff --git a/kernel/signal.c b/kernel/signal.c
index 0f3370872506..1550aee34f42 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -87,7 +87,7 @@ static int sig_ignored(struct task_struct *t, int sig, int from_ancestor_ns)
87 /* 87 /*
88 * Tracers may want to know about even ignored signals. 88 * Tracers may want to know about even ignored signals.
89 */ 89 */
90 return !tracehook_consider_ignored_signal(t, sig); 90 return !t->ptrace;
91} 91}
92 92
93/* 93/*
@@ -493,7 +493,8 @@ int unhandled_signal(struct task_struct *tsk, int sig)
493 return 1; 493 return 1;
494 if (handler != SIG_IGN && handler != SIG_DFL) 494 if (handler != SIG_IGN && handler != SIG_DFL)
495 return 0; 495 return 0;
496 return !tracehook_consider_fatal_signal(tsk, sig); 496 /* if ptraced, let the tracer determine */
497 return !tsk->ptrace;
497} 498}
498 499
499/* 500/*
@@ -981,8 +982,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
981 if (sig_fatal(p, sig) && 982 if (sig_fatal(p, sig) &&
982 !(signal->flags & (SIGNAL_UNKILLABLE | SIGNAL_GROUP_EXIT)) && 983 !(signal->flags & (SIGNAL_UNKILLABLE | SIGNAL_GROUP_EXIT)) &&
983 !sigismember(&t->real_blocked, sig) && 984 !sigismember(&t->real_blocked, sig) &&
984 (sig == SIGKILL || 985 (sig == SIGKILL || !t->ptrace)) {
985 !tracehook_consider_fatal_signal(t, sig))) {
986 /* 986 /*
987 * This signal will be fatal to the whole group. 987 * This signal will be fatal to the whole group.
988 */ 988 */