NetBSD Problem Report #49613

From www@NetBSD.org  Thu Jan 29 16:51:42 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id DF020A6567
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Jan 2015 16:51:41 +0000 (UTC)
Message-Id: <20150129165140.CCFB7A65B0@mollari.NetBSD.org>
Date: Thu, 29 Jan 2015 16:51:40 +0000 (UTC)
From: oshima-ya@yagoto-urayama.jp
Reply-To: oshima-ya@yagoto-urayama.jp
To: gnats-bugs@NetBSD.org
Subject: errno does not set by some systemcall at error case
X-Send-Pr-Version: www-1.0

>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:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 29 16:55:00 +0000 2015
>Closed-Date:    Wed Feb 18 08:58:14 +0000 2015
>Last-Modified:  Wed Feb 18 08:58:14 +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 */

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->pending-pullups
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Sun, 15 Feb 2015 12:26:37 +0000
State-Changed-Why:
[pullup-7 #524] 
[pullup-6 #1254]


State-Changed-From-To: pending-pullups->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Wed, 18 Feb 2015 08:58:14 +0000
State-Changed-Why:
Fixed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.