NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-sh3/49613: errno does not set by some systemcall at error case



>Number:         49613
>Category:       port-sh3
>Synopsis:       errno does not set by some systemcall at error case
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-sh3-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 29 16:55:00 +0000 2015
>Originator:     Yasushi Oshima
>Release:        NetBSD 7.0_BETA
>Organization:
>Environment:
NetBSD usl5p1 7.0_BETA NetBSD 7.0_BETA (GENERIC) #8: Thu Jan 29 09:45:03 JST 2015  oshima@sweety:/export/netbsd-7/obj/landisk/sys/arch/landisk/compile/GENERIC landisk
>Description:
when run atf-run /usr/tests/lib/libc/sys/t_mkdir mkdir_err,
the following error occurs.

| mkdir_err, failed, /usr/src/tests/lib/libc/sys/t_mkdir.c:74: Expected
| errno 14, got -1944998240, in mkdir((void *)-1, 0500) == -1

mkdir(-1, 0500) failed, this is right but its errno is not valid.

The cause is that copyinstr() in sh3/locore_subr.S mistakes
branch line when the address of argument is invalid.

It exists in netbsd-6, netbsd-7 and -current (after rev.1.53).
>How-To-Repeat:
cd /usr/tests/lib/libc/sys/
atf-run t_mkdir

>Fix:
--- sys/arch/sh3/sh3/locore_subr.S      1 Feb 2011 01:54:14 -0000       1.54
+++ sys/arch/sh3/sh3/locore_subr.S      29 Jan 2015 16:34:47 -0000
@@ -645,7 +645,7 @@

        mov.l   .L_copyinstr_VM_MAXUSER_ADDRESS, r3
        cmp/hi  r3,     r4              /* bomb if usrc isn't in user space */
-       bt      4f
+       bt      5f
        mov     r3,     r0
        sub     r4,     r0
        cmp/hi  r6,     r0              /* don't beyond user space */



Home | Main Index | Thread Index | Old Index