Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Apr 2021 10:52:35 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 77651151f3ca - main - linux: make ptrace(2) return EIO when trying to peek invalid address
Message-ID:  <202104241052.13OAqZtb001182@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz:

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

commit 77651151f3caec7d2440404f8c0f1819757d1d5d
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-04-24 10:37:06 +0000
Commit:     Edward Tomasz Napierala <trasz@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104241052.13OAqZtb001182>