Skip to contentSkip to conversation

ptrace compat issue

PATCH David S. Miller 1 participant 1 message Apr 5, 2006

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

Others may run into this too, so I'm mentioning this.

PTRACE_GETEVENTMSG writes a long into the user address space, this has to be made an int for compat tasks. If you get this wrong a lot of debugging things will break, as GDB currently makes extensive use of this facility these days.

It might be nice to try and consolidate this into a single location, but I frankly think that's overkill and doing it in the per-arch ptrace() syscall handler is just the easiest thing to do right now.

diff-tree acdb28098a91c930909c257da1c0837b875a11fb (from c5959ae91b2e6e93000c58d428f91c5b5b46868d)

Author: David S. Miller <[email protected]>
Date:   Tue Apr 4 16:54:40 2006 -0700

[SPARC64]: Translate PTRACE_GETEVENTMSG for 32-bit tasks.

arch/sparc64/kernel/ptrace.c +16 -0
index c910af5..49e6ded 100644
@@ -609,6 +609,22 @@ #endif
 
 	/* PTRACE_DUMPCORE unsupported... */
 
+	case PTRACE_GETEVENTMSG: {
+		int err;
+
+		if (test_thread_flag(TIF_32BIT))
+			err = put_user(child->ptrace_message,
+				       (unsigned int __user *) data);
+		else
+			err = put_user(child->ptrace_message,
+				       (unsigned long __user *) data);
+		if (err)
+			pt_error_return(regs, -err);
+		else
+			pt_succ_return(regs, 0);
+		break;
+	}
+
 	default: {
 		int err = ptrace_request(child, request, addr, data);
 		if (err)