Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107603830
D32455.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
D32455.diff
View Options
diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c
--- a/sys/amd64/linux/linux_ptrace.c
+++ b/sys/amd64/linux/linux_ptrace.c
@@ -97,6 +97,11 @@
#define LINUX_PTRACE_SYSCALL_INFO_ENTRY 1
#define LINUX_PTRACE_SYSCALL_INFO_EXIT 2
+#define LINUX_PTRACE_PEEKUSER_ORIG_RAX 120
+#define LINUX_PTRACE_PEEKUSER_RIP 128
+#define LINUX_PTRACE_PEEKUSER_CS 136
+#define LINUX_PTRACE_PEEKUSER_DS 184
+
#define LINUX_ARCH_AMD64 0xc000003e
static int
@@ -286,9 +291,37 @@
static int
linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data)
{
+ struct reg b_reg;
+ uint64_t val;
+ int error;
- linux_msg(td, "PTRACE_PEEKUSER not implemented; returning EINVAL");
- return (EINVAL);
+ error = kern_ptrace(td, PT_GETREGS, pid, &b_reg, 0);
+ if (error != 0)
+ return (error);
+
+ switch ((uintptr_t)addr) {
+ case LINUX_PTRACE_PEEKUSER_ORIG_RAX:
+ val = b_reg.r_rax;
+ break;
+ case LINUX_PTRACE_PEEKUSER_RIP:
+ val = b_reg.r_rip;
+ break;
+ case LINUX_PTRACE_PEEKUSER_CS:
+ val = b_reg.r_cs;
+ break;
+ case LINUX_PTRACE_PEEKUSER_DS:
+ val = b_reg.r_ds;
+ break;
+ default:
+ linux_msg(td, "PTRACE_PEEKUSER offset %ld not implemented; "
+ "returning EINVAL", (uintptr_t)addr);
+ return (EINVAL);
+ }
+
+ error = copyout(&val, data, sizeof(val));
+ td->td_retval[0] = error;
+
+ return (error);
}
static int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 17, 1:02 PM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15838826
Default Alt Text
D32455.diff (1 KB)
Attached To
Mode
D32455: linux: Implement some bits of PTRACE_PEEKUSER
Attached
Detach File
Event Timeline
Log In to Comment