On Tue, Sep 05, 2017 at 10:20:12PM -0600, Philip Guenther wrote:
> CVSROOT:      /cvs
> Module name:  src
> Changes by:   guent...@cvs.openbsd.org        2017/09/05 22:20:12
> 
> Modified files:
>       regress/sys/kern/ptrace: ptrace.c 
> 
> Log message:
> Fix declarations
> ptrace(PT_IO) memory protection faults return EACCES, not EFAULT

Now the test fails on i386.

/usr/src/regress/sys/kern/ptrace/ptrace -Irib
ptrace: ptrace(PT_IO): Bad address                   
*** Error 1 in . (Makefile:19 'io_read_i_bad')
FAILED                                          

Apparently i386 and amd64 return different errors.  Do you know
why?  Is it worth to invesitgate or shoud we just accept both cases?

bluhm

Index: ptrace.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/regress/sys/kern/ptrace/ptrace.c,v
retrieving revision 1.4
diff -u -p -r1.4 ptrace.c
--- ptrace.c    6 Sep 2017 04:20:12 -0000       1.4
+++ ptrace.c    8 Sep 2017 11:26:01 -0000
@@ -132,7 +132,7 @@ main(int argc, char **argv)
 
                        if (ptrace(PT_IO, pid, (caddr_t)&piod, 0) == -1) {
                                warn("ptrace(PT_IO)");
-                               if (errno == EACCES)
+                               if (errno == EACCES || errno == EFAULT)
                                        ret = 1;
                                else
                                        ret = -1;

Reply via email to