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

(cherry picked from commit 75a9d95b4d)
This commit is contained in:
Edward Tomasz Napierala 2021-10-17 11:49:42 +01:00
parent 4cae9d803a
commit 36ff5ce03c

View file

@ -558,7 +558,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;
@ -623,7 +623,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);