git: 77651151f3ca - main - linux: make ptrace(2) return EIO when trying to peek invalid address

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Apr 24 10:52:36 UTC 2021


The branch main has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=77651151f3caec7d2440404f8c0f1819757d1d5d

commit 77651151f3caec7d2440404f8c0f1819757d1d5d
Author:     Edward Tomasz Napierala <trasz at FreeBSD.org>
AuthorDate: 2021-04-24 10:37:06 +0000
Commit:     Edward Tomasz Napierala <trasz at FreeBSD.org>
CommitDate: 2021-04-24 10:37:50 +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
---
 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 89fda7979359..76ad9b1e25c4 100644
--- a/sys/amd64/linux/linux_ptrace.c
+++ b/sys/amd64/linux/linux_ptrace.c
@@ -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);


More information about the dev-commits-src-all mailing list