[PATCH] mips: fix errno setting after syscall

Alexander Gordeev lasaine at lvk.cs.msu.su
Wed Oct 27 23:18:32 UTC 2010


В Wed, 27 Oct 2010 15:47:41 -0700
Khem Raj <raj.khem at gmail.com> пишет:

> On Wed, Oct 27, 2010 at 2:26 PM, Alexander Gordeev
> <lasaine at lvk.cs.msu.su> wrote:
> > В Wed, 27 Oct 2010 21:38:19 +0200
> > Bernhard Reutner-Fischer <rep.dot.nop at gmail.com> пишет:
> >
> >> On Wed, Oct 13, 2010 at 06:16:34PM +0400, Alexander Gordeev wrote:
> >> >В Thu,  7 Oct 2010 18:54:24 +0400
> >> >Alexander Gordeev <lasaine at lvk.cs.msu.su> пишет:
> >> >
> >> >> If there was an error during syscall then after it's completion a3
> >> >> register holds a non-zero value and v0 holds an actual error code which
> >> >> should be saved in errno. This can be achieved by calling
> >> >> __syscall_error with the value from v0 as a parameter. So this value
> >> >> should be stored in a0, but the appropriate assembly instructions are
> >> >> missing. Fixed this now by adding "move a0, v0".
> >> >>
> >> >> I think it was once fixed by 58c5f8ba4cdf62342d05a546d15404cbbb3c4e07
> >> >> but then something went wrong. Again...
> >> >>
> >> >> Signed-off-by: Alexander Gordeev <lasaine at lvk.cs.msu.su>
> >> >[snip]
> >> >
> >> >Nobody interested?
> >>
> >> It sounds a bit heavy to me, but i'm applying it as a workaround.
> >> What abi are you using?
> >
> > Sorry, I don't know. I learned MIPS assembly right to fix this bug. I
> > use Openwrt compiled with uClibc 0.9.32 with NPTL support (commit
> > ef487a35f428da6240003dca23b9d29908e2285e with several other patches) if
> > that helps. I think this bug should appear on all MIPS platforms. I've
> > also seen it in qemu emulating Malta little-endian.
> 
> 
> that rev is a bit old and there have been some fixes related to mips
> errno handling on nptl then went it. Could you try latest git version
> and see if this patch is still needed.

Sure, I can test it but only a week later (have a flight in a few
hours).

If you mean commit 8b48f745be1e086d6e486bbb8167e770f3d1fbc5, it doesn't
fix the error I'm reporting.
I also checked history of all three files that my commit modifies and
there is nothing related as well.
I'm quite sure this bug could be fixed in these files only because it
happens on a very tiny path from "syscall" instruction to "j
__syscall_error" which is completely inside of these files. Maybe it
was not seen before because there are several other code paths that
could have been used instead by others.

> >> Perhaps someone with a mips setup can look into this some more since
> >> it adds up to every syscall..
> >> Dan, you seem to have added that move a0,v0 initially as a uClibc
> >> specific workaround.
> >>
> >> PS: and it would be nice to get rid of libc/string/mips/sysdep.h
> >> PPS: i'm sorry for the long delay
> >
> > No problem. :)
> >
> >> PPPS: that move should use the MOVE macro instead
> >
> > Hmm, you mean I should just replace "move" with "MOVE"?

-- 
  Alexander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20101028/3aac759c/attachment-0001.pgp>


More information about the uClibc mailing list