NetBSD Problem Report #20246

Received: (qmail 25708 invoked by uid 605); 8 Feb 2003 01:26:17 -0000
Message-Id: <20030208012615.93BD31114C@narn.netbsd.org>
Date: Fri,  7 Feb 2003 17:26:15 -0800 (PST)
From: cgd@netbsd.org
Sender: gnats-bugs-owner@netbsd.org
Reply-To: cgd@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: libposix broken on MIPS (at least)
X-Send-Pr-Version: www-1.0

>Number:         20246
>Category:       port-mips
>Synopsis:       libposix broken on MIPS (at least)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-mips-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 08 01:27:00 +0000 2003
>Closed-Date:    Sat Mar 05 14:57:50 +0000 2011
>Last-Modified:  Sat Mar 05 14:57:50 +0000 2011
>Originator:     Chris Demetriou
>Release:        1.6N as of 2003-02-05 00:00 UTC.
>Organization:
>Environment:
uname -mrs:
NetBSD 1.6N sbmips
w/ a GENERIC kernel.
>Description:
libposix on NetBSD MIPS ports is broken.

in the case of errors, __cerror is used... but __cerror
is in libc and for dynamically-linked executables
(the default), the first time each libposix fn gets
an error it has to bind __cerror.  doing that corrupts
the register (v0 on MIPS) used to indicate errno!

PR marked as high priority because it causes MIPS ports
to fail the existing regression tests.
>How-To-Repeat:
run the regress/lib/libposix/prn1 test on mips.

i came to the hypothesis above by modifying the test code to
do the rename of no/such/file/or/dir twice, with printouts
between them.  In that case, only the first failing rename
produces a bogus errno!
>Fix:
unknown.  Possibilities include:

* making libposix include its own copy of __cerror.

	I don't know what's involved in this one...

* making ld.so not clobber v0 on mips.

	If this is done, other ports should be checked to
	make sure they don't suffer the same problem.

* making libposix implement its syscalls via syscall().

	This would be fine, but adds a level of indirection.
	I don't know if we care about the absolute performance
	of POSIX chosk(), fchown(), lchown() and rename().

* making libposix implement its syscalls via the underlying __posix_*
  syscalls...

	Again fine, and probably another level of indirection unless
	it used linker/symbol magic (that i am not sure exists.)

>Release-Note:
>Audit-Trail:
From: "Valeriy E. Ushakov" <uwe@ptc.spbu.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-mips/20246
Date: Sun, 5 Nov 2006 12:35:32 +0300

 I've fixed similar problem for sh3, see

     lib/libc/arch/sh3/sys/cerror.S
     lib/libc/arch/sh3/SYS.h

 -uwe

State-Changed-From-To: open->closed
State-Changed-By: matt@NetBSD.org
State-Changed-When: Sat, 05 Mar 2011 14:57:50 +0000
State-Changed-Why:
libposix and librt now include their own hidden version of __cerror therebby
avoiding the dynamic linker.


>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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.