linux: make ptrace(2) return EIO when trying to peek invalid address

Previously we've returned the error from native ptrace(2), ENOMEM.
This confused Linux strace(2).

Reviewed By:	emaste
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29925
This commit is contained in:
Edward Tomasz Napierala 2021-04-24 11:37:06 +01:00
parent a9b66dbd91
commit 77651151f3

View File

@ -313,6 +313,8 @@ linux_ptrace_peek(struct thread *td, pid_t pid, void *addr, void *data)
error = kern_ptrace(td, PT_READ_I, pid, addr, 0);
if (error == 0)
error = copyout(td->td_retval, data, sizeof(l_int));
else if (error == ENOMEM)
error = EIO;
td->td_retval[0] = error;
return (error);