diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2021-10-17 10:49:42 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2021-10-17 10:49:46 +0000 |
commit | 75a9d95b4d0a043ac0f3f8d1efc0982156337eac (patch) | |
tree | b8a8c53e6e905eb7d46b97dd16a3b8e79394ddfd | |
parent | 7e7859e7c2b900fd1b1af6e90ed31d51b9b5514d (diff) | |
download | src-75a9d95b4d0a043ac0f3f8d1efc0982156337eac.tar.gz src-75a9d95b4d0a043ac0f3f8d1efc0982156337eac.zip |
linux: Adjust PTRACE_GET_SYSCALL_INFO buffer size semantics
The tests/ptrace_syscall_info test from strace(1) complained
about this.
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32368
-rw-r--r-- | sys/amd64/linux/linux_ptrace.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index eb39e3c9ada6..a59702757972 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -524,7 +524,7 @@ linux_ptrace_seize(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) static int linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, - l_ulong addr, l_ulong data) + l_ulong len, l_ulong data) { struct ptrace_lwpinfo lwpinfo; struct ptrace_sc_ret sr; @@ -589,7 +589,8 @@ linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, si.instruction_pointer = b_reg.r_rip; si.stack_pointer = b_reg.r_rsp; - error = copyout(&si, (void *)data, sizeof(si)); + len = MIN(len, sizeof(si)); + error = copyout(&si, (void *)data, len); if (error == 0) td->td_retval[0] = sizeof(si); |