Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171199972
D32367.id96982.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D32367.id96982.diff
View Options
Index: sys/amd64/linux/linux_ptrace.c
===================================================================
--- sys/amd64/linux/linux_ptrace.c
+++ sys/amd64/linux/linux_ptrace.c
@@ -71,6 +71,7 @@
#define LINUX_PTRACE_SEIZE 0x4206
#define LINUX_PTRACE_GET_SYSCALL_INFO 0x420e
+#define LINUX_PTRACE_EVENT_EXEC 4
#define LINUX_PTRACE_EVENT_EXIT 6
#define LINUX_PTRACE_O_TRACESYSGOOD 1
@@ -144,8 +145,12 @@
lwpinfo.pl_flags & PL_FLAG_SCE)
status |= (LINUX_SIGTRAP | 0x80) << 8;
if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) &&
- lwpinfo.pl_flags & PL_FLAG_SCX)
- status |= (LINUX_SIGTRAP | 0x80) << 8;
+ lwpinfo.pl_flags & PL_FLAG_SCX) {
+ if (lwpinfo.pl_flags & PL_FLAG_EXEC)
+ status |= (LINUX_SIGTRAP | LINUX_PTRACE_EVENT_EXEC << 8) << 8;
+ else
+ status |= (LINUX_SIGTRAP | 0x80) << 8;
+ }
if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACEEXIT) &&
lwpinfo.pl_flags & PL_FLAG_EXITED)
status |= (LINUX_SIGTRAP | LINUX_PTRACE_EVENT_EXIT << 8) << 8;
Index: sys/kern/subr_syscall.c
===================================================================
--- sys/kern/subr_syscall.c
+++ sys/kern/subr_syscall.c
@@ -254,6 +254,17 @@
if (__predict_false(traced ||
(td->td_dbgflags & (TDB_EXEC | TDB_FORK)) != 0)) {
PROC_LOCK(p);
+ /*
+ * Linux debuggers expect an additional stop for exec,
+ * between the usual syscall entry and exit. Clear
+ * TDB_EXEC, so that linux_ptrace_status() can tell
+ * them apart.
+ */
+ if ((td->td_dbgflags & TDB_EXEC) != 0 &&
+ SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) {
+ ptracestop(td, SIGTRAP, NULL);
+ td->td_dbgflags &= ~TDB_EXEC;
+ }
/*
* If tracing the execed process, trap to the debugger
* so that breakpoints can be set before the program
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Sep 10, 11:28 AM (15 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38643669
Default Alt Text
D32367.id96982.diff (1 KB)
Attached To
Mode
D32367: linux: implement PTRACE_EVENT_EXEC
Attached
Detach File
Event Timeline
Log In to Comment