git: 0737ef6fbce4 - stable/13 - linux: make ptrace(2) return EIO when trying to peek invalid address
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Feb 2022 13:48:50 UTC
The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=0737ef6fbce49026d67ecf2cf898b31365005009 commit 0737ef6fbce49026d67ecf2cf898b31365005009 Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-04-24 10:37:06 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2022-02-21 13:19:30 +0000 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 (cherry picked from commit 77651151f3caec7d2440404f8c0f1819757d1d5d) --- sys/amd64/linux/linux_ptrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 8fb87a8536b6..6516453dd5e4 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -282,6 +282,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);