From: Blaisorblade <blaisorblade@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net,
Bodo Stroesser <bstroesser@fujitsu-siemens.com>,
Jeff Dike <jdike@addtoit.com>
Cc: user-mode-linux-user@lists.sourceforge.net,
Alexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Subject: [uml-devel] Please test 2.6.13-rc2 in TT mode! Big problem with syscall parameters clobbering
Date: Thu, 7 Jul 2005 20:31:43 +0200 [thread overview]
Message-ID: <200507072031.43862.blaisorblade@yahoo.it> (raw)
[-- Attachment #1: Type: text/plain, Size: 2963 bytes --]
For this kernel (and for -rc1), I've been getting almost no reports (except a
problem with GCC 2.95 I now solved) in TT mode, so I'd like some more
testing, especially for users which have the latest SKAS patch installed. At
least positive / negative reports.
But, for me, it hasn't been working at all, and fails with:
./vmlinux mode=tt
Checking PROT_EXEC mmap in /tmp...OK
switcheroo failed
, unless I apply this apparently
silly patch:
diff -u linux-2.6.git-paolo/arch/um/sys-i386/unmap.c
clean-linux-2.6.11-paolo/arch/um/sys-i386/unmap.c
--- linux-2.6.git-paolo/arch/um/sys-i386/unmap.c 2005-06-07 19:10:51.000000000
+0200
+++ clean-linux-2.6.11-paolo/arch/um/sys-i386/unmap.c 2005-06-08
20:01:21.000000000 +0200
@@ -15,7 +15,8 @@
if(munmap(to, size) < 0){
return(-1);
}
- if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
+ /* if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ */
+ if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){
return(-1);
}
if(munmap(from, size) < 0){
diff -u linux-2.6.git-paolo/arch/um/sys-x86_64/unmap.c
clean-linux-2.6.11-paolo/arch/um/sys-x86_64/unmap.c
--- linux-2.6.git-paolo/arch/um/sys-x86_64/unmap.c 2005-06-07
19:10:51.000000000 +0200
+++ clean-linux-2.6.11-paolo/arch/um/sys-x86_64/unmap.c 2005-06-08
20:01:18.000000000 +0200
@@ -15,7 +15,8 @@
if(munmap(to, size) < 0){
return(-1);
}
- if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
+ /* if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ */
+ if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){
return(-1);
}
if(munmap(from, size) < 0){
It is silly because from the mmap2() API, kernel source, and so on, it will
return either "to" or -1, and from strace output it always returns "to".
mmap2(0xa024f000, 532480, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|
MAP_FIXED, 3, 0) = 0xa024f000
//as you can see the return value is the first parameter!
write(1, "switcheroo failed\n", 18switcheroo failed
) = 18
//but it does fail!
But on my system the comparison fails, because the compiler keeps "to" inside
EBX and after the syscall return the content of EBX is altered!
So, this seems a kernel bug, but it does not happen in the previous form of
the code (which didn't use a direct syscall but rather the glibc version)!
And my system works pretty well, I think;
* I get only some crashes from some KDE components, but I consider them
normal,
* and a lot of problems with GDB and debugging (still looking for the cause).
This is with 2.6.11 + gentoo patchset + skas-v9-pre4 (which is used by many
people). I've been suspicious of Gentoo, libc, gdb, the kernel, now I'm going
to look at everything until I find something.
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
[-- Attachment #2: uml-fix-link-tt-mode-against-nptl.patch --]
[-- Type: text/x-diff, Size: 1214 bytes --]
diff -u linux-2.6.git-paolo/arch/um/sys-i386/unmap.c clean-linux-2.6.11-paolo/arch/um/sys-i386/unmap.c
--- linux-2.6.git-paolo/arch/um/sys-i386/unmap.c 2005-06-07 19:10:51.000000000 +0200
+++ clean-linux-2.6.11-paolo/arch/um/sys-i386/unmap.c 2005-06-08 20:01:21.000000000 +0200
@@ -15,7 +15,8 @@
if(munmap(to, size) < 0){
return(-1);
}
- if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
+ /* if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ */
+ if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){
return(-1);
}
if(munmap(from, size) < 0){
diff -u linux-2.6.git-paolo/arch/um/sys-x86_64/unmap.c clean-linux-2.6.11-paolo/arch/um/sys-x86_64/unmap.c
--- linux-2.6.git-paolo/arch/um/sys-x86_64/unmap.c 2005-06-07 19:10:51.000000000 +0200
+++ clean-linux-2.6.11-paolo/arch/um/sys-x86_64/unmap.c 2005-06-08 20:01:18.000000000 +0200
@@ -15,7 +15,8 @@
if(munmap(to, size) < 0){
return(-1);
}
- if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
+ /* if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ */
+ if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){
return(-1);
}
if(munmap(from, size) < 0){
next reply other threads:[~2005-07-07 18:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-07 18:31 Blaisorblade [this message]
2005-07-11 21:51 ` [uml-devel] Please test 2.6.13-rc2 in TT mode! Big problem with syscall parameters clobbering Blaisorblade
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200507072031.43862.blaisorblade@yahoo.it \
--to=blaisorblade@yahoo.it \
--cc=bstroesser@fujitsu-siemens.com \
--cc=jdike@addtoit.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--cc=user-mode-linux-user@lists.sourceforge.net \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox