Skip to contentSkip to conversation

ptrace: temporary revert the recent ptrace/jobctl rework

PATCH In review Tom Zanussi 1 participant 1 message Sep 5, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ptrace: temporary revert the recent ptrace/jobctl rework

Temporary revert the following patches to keep utrace/utrace-ptrace working:

	40ae717d1e78d982bd469b2013a4cbf4ec1ca434
	ptrace: fix signal->wait_chldexit usage in task_clear_group_stop_trapping()

	321fb561971ba0f10ce18c0f8a4b9fbfc7cef4b9
	ptrace: ptrace_check_attach() should not do s/STOPPED/TRACED/

	ee77f075921730b2b465880f9fd4367003bdab39
	signal: Turn SIGNAL_STOP_DEQUEUED into GROUP_STOP_DEQUEUED

	780006eac2fe7f4d2582da16a096e5a44c4767ff
	signal: do_signal_stop: Remove the unneeded task_clear_group_stop_pending()

	244056f9dbbc6dc4126a301c745fa3dd67d8af3c
	job control: Don't send duplicate job control stop notification while ptraced

	ceb6bd67f9b9db765e1c29405f26e8460391badd
	job control: Notify the real parent of job control events regardless of ptrace

	62bcf9d992ecc19ea4f37ff57ee0b3333e3e843e
	job control: Job control stop notifications should always go to the real parent

	75b95953a56969a990e6ce154b260be83818fe71
	job control: Add @for_ptrace to do_notify_parent_cldstop()

	45cb24a1da53beb70f09efccc0373f6a47a9efe0
	job control: Allow access to job control events through ptracees

	9b84cca2564b9a5b2d064fb44d2a55a5b44473a0
	job control: Fix ptracer wait(2) hang and explain notask_error clearing

	408a37de6c95832a4880a88a742f89f0cc554d06
	job control: Don't set group_stop exit_code if re-entering job control stop

	0e9f0a4abfd80f8adca624538d479d95159b16d8
	ptrace: Always put ptracee into appropriate execution state

	e3bd058f62896ec7a2c605ed62a0a811e9147947
	ptrace: Collapse ptrace_untrace() into __ptrace_unlink()

	d79fdd6d96f46fabb779d86332e3677c6f5c2a4f
	ptrace: Clean transitions between TASK_STOPPED and TRACED

	5224fa3660ad3881d2f2ad726d22614117963f10
	ptrace: Make do_signal_stop() use ptrace_stop() if the task is being ptraced

	0ae8ce1c8c5b9007ce6bfc83ec2aa0dfce5bbed3
	ptrace: Participate in group stop from ptrace_stop() iff the task is trapping for group stop

	39efa3ef3a376a4e53de2f82fc91182459d34200
	signal: Use GROUP_STOP_PENDING to stop once for a single group stop

	e5c1902e9260a0075ea52cb5ef627a8d9aaede89
	signal: Fix premature completion of group stop when interfered by ptrace

	fe1bc6a0954611b806f9e158eb0817cf8ba21660
	ptrace: Add @why to ptrace_stop()

	edf2ed153bcae52de70db00a98b0e81a5668e563
	ptrace: Kill tracehook_notify_jctl()

This obviously reverts some user-visible fixes, but the fixed problems are very old and minor, they were never reported. In the long term we need another solution.

---
 fs/exec.c                 |    1 -
 include/linux/sched.h     |   17 +--
 include/linux/tracehook.h |   27 ++++
 kernel/exit.c             |   77 ++---------
 kernel/ptrace.c           |  116 +++++-----------
 kernel/signal.c           |  339 +++++++++------------------------------------
 6 files changed, 148 insertions(+), 429 deletions(-)
fs/exec.c +0 -1
index 6075a1e..82b5379 100644
@@ -1769,7 +1769,6 @@ static int zap_process(struct task_struct *start, int exit_code)
 
 	t = start;
 	do {
-		task_clear_group_stop_pending(t);
 		if (t != current && t->mm) {
 			sigaddset(&t->pending.signal, SIGKILL);
 			signal_wake_up(t, 1);
include/linux/sched.h +3 -14
index 14a6c7b..63294a7 100644
@@ -663,8 +663,9 @@ struct signal_struct {
  * Bits in flags field of signal_struct.
  */
 #define SIGNAL_STOP_STOPPED	0x00000001 /* job control stop in effect */
-#define SIGNAL_STOP_CONTINUED	0x00000002 /* SIGCONT since WCONTINUED reap */
-#define SIGNAL_GROUP_EXIT	0x00000004 /* group exit in progress */
+#define SIGNAL_STOP_DEQUEUED	0x00000002 /* stop signal dequeued */
+#define SIGNAL_STOP_CONTINUED	0x00000004 /* SIGCONT since WCONTINUED reap */
+#define SIGNAL_GROUP_EXIT	0x00000008 /* group exit in progress */
 /*
  * Pending notifications to parent.
  */
@@ -1292,7 +1293,6 @@ struct task_struct {
 	int exit_state;
 	int exit_code, exit_signal;
 	int pdeath_signal;  /*  The signal sent when the parent dies  */
-	unsigned int group_stop;	/* GROUP_STOP_*, siglock protected */
 	/* ??? */
 	unsigned int personality;
 	unsigned did_exec:1;
@@ -1812,17 +1812,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
 #define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
 #define used_math() tsk_used_math(current)
 
-/*
- * task->group_stop flags
- */
-#define GROUP_STOP_SIGMASK	0xffff    /* signr of the last group stop */
-#define GROUP_STOP_PENDING	(1 << 16) /* task should stop for group stop */
-#define GROUP_STOP_CONSUME	(1 << 17) /* consume group stop count */
-#define GROUP_STOP_TRAPPING	(1 << 18) /* switching from STOPPED to TRACED */
-#define GROUP_STOP_DEQUEUED	(1 << 19) /* stop signal dequeued */
-
-extern void task_clear_group_stop_pending(struct task_struct *task);
-
 #ifdef CONFIG_PREEMPT_RCU
 
 #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
include/linux/tracehook.h +27 -0
index e95f523..ebcfa4e 100644
@@ -469,6 +469,33 @@ static inline int tracehook_get_signal(struct task_struct *task,
 }
 
 /**
+ * tracehook_notify_jctl - report about job control stop/continue
+ * @notify:		zero, %CLD_STOPPED or %CLD_CONTINUED
+ * @why:		%CLD_STOPPED or %CLD_CONTINUED
+ *
+ * This is called when we might call do_notify_parent_cldstop().
+ *
+ * @notify is zero if we would not ordinarily send a %SIGCHLD,
+ * or is the %CLD_STOPPED or %CLD_CONTINUED .si_code for %SIGCHLD.
+ *
+ * @why is %CLD_STOPPED when about to stop for job control;
+ * we are already in %TASK_STOPPED state, about to call schedule().
+ * It might also be that we have just exited (check %PF_EXITING),
+ * but need to report that a group-wide stop is complete.
+ *
+ * @why is %CLD_CONTINUED when waking up after job control stop and
+ * ready to make a delayed @notify report.
+ *
+ * Return the %CLD_* value for %SIGCHLD, or zero to generate no signal.
+ *
+ * Called with the siglock held.
+ */
+static inline int tracehook_notify_jctl(int notify, int why)
+{
+	return notify ?: (current->ptrace & PT_PTRACED) ? why : 0;
+}
+
+/**
  * tracehook_finish_jctl - report about return from job control stop
  *
  * This is called by do_signal_stop() after wakeup.
kernel/exit.c +14 -63

94 lines not on this page · raw message

kernel/ptrace.c +35 -81

158 lines not on this page · raw message

kernel/signal.c +69 -270

504 lines not on this page · raw message

Signature · 1 line
1.7.0.4