Skip to contentSkip to conversation

ptrace: mv task_struct->last_siginfo ptrace_ctx->infop

RFC PATCH In review Oleg Nesterov 1 participant 1 message May 30, 2009

Subsystems (2)
lore
Share & tools
lore

Oleg Nesterov

author maintainer
#0 lore raw

RFC PATCH v3 10/12 ptrace: mv task_struct->last_siginfo ptrace_ctx->infop

Move task_struct->last_siginfo into ptrace_ctx->infop.

---

 include/linux/sched.h  |    1 -
 include/linux/ptrace.h |    1 +
 kernel/ptrace.c        |    8 ++++----
 kernel/signal.c        |    8 ++++----
 4 files changed, 9 insertions(+), 9 deletions(-)
include/linux/sched.h renamed from include/linux/sched.h~10_SIGINFO +0 -1
@@ -1348,7 +1348,6 @@ struct task_struct {
 	struct io_context *io_context;
 
 	unsigned long ptrace_message;
-	siginfo_t *last_siginfo; /* For ptrace use.  */
 	struct task_io_accounting ioac;
 #if defined(CONFIG_TASK_XACCT)
 	u64 acct_rss_mem1;	/* accumulated rss usage */
include/linux/ptrace.h renamed from include/linux/ptrace.h~10_SIGINFO +1 -0
@@ -78,6 +78,7 @@
 struct ptrace_context {
 	unsigned long		flags;
 	struct task_struct	*tracer;
+	struct siginfo		*infop;
 };
 
 extern int alloc_ptrace_context(struct task_struct *child);
kernel/ptrace.c renamed from kernel/ptrace.c~10_SIGINFO +4 -4
@@ -469,8 +469,8 @@ static int ptrace_getsiginfo(struct task
 
 	if (lock_task_sighand(child, &flags)) {
 		error = -EINVAL;
-		if (likely(child->last_siginfo != NULL)) {
-			*info = *child->last_siginfo;
+		if (likely(child->ptrace_ctx->infop != NULL)) {
+			*info = *child->ptrace_ctx->infop;
 			error = 0;
 		}
 		unlock_task_sighand(child, &flags);
@@ -485,8 +485,8 @@ static int ptrace_setsiginfo(struct task
 
 	if (lock_task_sighand(child, &flags)) {
 		error = -EINVAL;
-		if (likely(child->last_siginfo != NULL)) {
-			*child->last_siginfo = *info;
+		if (likely(child->ptrace_ctx->infop != NULL)) {
+			*child->ptrace_ctx->infop = *info;
 			error = 0;
 		}
 		unlock_task_sighand(child, &flags);
kernel/signal.c renamed from kernel/signal.c~10_SIGINFO +4 -4
@@ -1568,7 +1568,7 @@ static int sigkill_pending(struct task_s
  * This must be called with current->sighand->siglock held.
  *
  * This should be the path for all ptrace stops.
- * We always set current->last_siginfo while stopped here.
+ * We always set ptrace_ctx->infop while stopped here.
  * That makes it a way to test a stopped process for
  * being ptrace-stopped vs being job-control-stopped.
  *
@@ -1603,7 +1603,7 @@ static void ptrace_stop(int exit_code, i
 	if (current->signal->group_stop_count > 0)
 		--current->signal->group_stop_count;
 
-	current->last_siginfo = info;
+	current->ptrace_ctx->infop = info;
 	current->exit_code = exit_code;
 
 	/* Let the debugger run.  */
@@ -1642,11 +1642,11 @@ static void ptrace_stop(int exit_code, i
 
 	/*
 	 * We are back.  Now reacquire the siglock before touching
-	 * last_siginfo, so that we are sure to have synchronized with
+	 * ->infop, so that we are sure to have synchronized with
 	 * any signal-sending on another CPU that wants to examine it.
 	 */
 	spin_lock_irq(&current->sighand->siglock);
-	current->last_siginfo = NULL;
+	current->ptrace_ctx->infop = NULL;
 
 	/*
 	 * Queued signals ignored us while we were stopped for tracing.