History

ptrace: Move setting/clearing ptrace_message into ptrace_stop

Today ptrace_message is easy to overlook as it not a core part of ptrace_stop. It has been overlooked so much that there are places that set ptrace_message and don't clear it, and places that never set it. So if you get an unlucky sequence of events the ptracer may be able to read a ptrace_message that does not apply to the current ptrace stop. Move setting of ptrace_message into ptrace_stop so that it always gets set before the stop, and always gets cleared after the stop. This prevents non-sense from being reported to userspace and makes ptrace_message more visible in the ptrace helper functions so that kernel developers can see it.

Eric W. Biederman committed 4 years ago

Commit 336d4b81 parent 355f8413 files · +16 −16Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/ptrace.h+1−1
@@ -114,7 +114,7 @@ struct ptrace_rseq_configuration { · 113 unmodified lines
114114
115115 /*
116116 * These values are stored in task->ptrace_message
117− * by ptrace_report_syscall_* to describe the current syscall-stop.
117+ * by ptrace_stop to describe the current syscall-stop.
118118 */
119119 #define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
120120 #define PTRACE_EVENTMSG_SYSCALL_EXIT 2