Errno handling bug
I posted this patch some time ago, but it was hidden inside an unrelated thread. It applies to .22-[345]um
**Description**
On the i386 arch(and I think others, too) the translation from return value(of calls like open(), fork()...) to errno setting is done in include/asm-i386/unistd.h. Instead,
UML doesn't do it. I'm posting a patch to correct this in include/asm-um/unistd.h for mainline, but I think that parts of the rest of Uml will have to be changed, probably, to conform to the new(and correct) semantic.
**Why it IS needed**
Code inside the kernel relies on this behaviour. It's a things archs must do. So, it will have to end up in, at some point.
**Tested**
Yes, but not everything is clear. Stability is ok, but some error messages I get are strange:
modprobe: modprobe: Can't locate module char-major-10-135 request_module[char-major-10-135]: waitpid(26,...) failed, errno 0 Which however seems to be either fine or not related directly to this: waitpid returns 0 when no child is found, and maybe this happens here. However this is not clear to me.
If you agree that this patch will have to go in, I'll complete it with complete checking for errno. But I think I'll need a working version of -4um(I'm going to test -5um), since I think that version has added/changed also much uses of errno.
Signature · 4 lines
cat <<EOSIGN Paolo Giarrusso, aka Blaisorblade Linux Kernel 2.4.21/2.6.0-test on an i686; Linux registered user n. 292729 EOSIGN
include/asm-um/unistd.h renamed from include/asm-um/unistd.h.notfixed +5 -1
@@ -33,7 +33,11 @@set_fs (KERNEL_DS ); \ ret =sys (args); \set_fs (fs); \ -return ret; +if (ret <0 ) { \ + errno = -ret; \ +return -1 ; \ + } \ +return 0 ;static inline long open (const char *pathname,int flags,int mode) {
Jeff Dike
AppliedQuoted 3 lines · [email protected] said:
I've done it, and discovered that things expected the right behaviour already. The patch I'm posting corrects only 1 use of errno, but it's about the user space errno.
Applied, thanks.
Jeff
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel