qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [Bug 1035572] Re: Bug in Qemu User Mode


From: Dietmar Stölting
Subject: [Qemu-devel] [Bug 1035572] Re: Bug in Qemu User Mode
Date: Tue, 14 Aug 2012 01:01:44 -0000

Hi,
with this new syscall.c content above things are going in the right 
direction:-).
I make a test with strace from the program testthread of the Qemu testsuite.
When I understand the result right,
threading works now with this new compiled qemu-i386.
The child and the parents tidptr NOW have the same number in one thread, and 
different but also same  in other thread.
This means for the not working program testclone: The functioncall with its 
sets of parameters is just wrong there.
When you do a function call with those Flags as in testthread, threads can be 
builded with qemu-i386.
So, the error is in the wrong calling of the function clone(). This can be 
corrected. Please tell me your thoughts,
Dietmar

address@hidden:/home/pi/raspidev# qemu-i386 -strace testthread
1583 brk(NULL) = 0x0804a000
1583 uname(0x4300d4ca) = 0
1583 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
1583 mmap2(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 
0x4311c000
1583 access("/etc/ld.so.preload",R_OK) = -1 errno=2 (No such file or directory)
1583 open("/etc/ld.so.cache",O_RDONLY) = 3
1583 fstat64(3,0x4300d184) = 0
1583 mmap2(NULL,41656,PROT_READ,MAP_PRIVATE,3,0) = 0x4311e000
1583 close(3) = 0
1583 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
1583 open("/lib/i386-linux-gnu/tls/i686/sse2/cmov/libpthread.so.0",O_RDONLY) = 
-1 errno=2 (No such file or directory)
1583 stat64("/lib/i386-linux-gnu/tls/i686/sse2/cmov",0x4300d1e8) = -1 errno=2 
(No such file or directory)
1583 open("/lib/i386-linux-gnu/tls/i686/sse2/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/lib/i386-linux-gnu/tls/i686/sse2",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/lib/i386-linux-gnu/tls/i686/cmov/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/lib/i386-linux-gnu/tls/i686/cmov",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/lib/i386-linux-gnu/tls/i686/libpthread.so.0",O_RDONLY) = -1 errno=2 
(No such file or directory)
1583 stat64("/lib/i386-linux-gnu/tls/i686",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/lib/i386-linux-gnu/tls/sse2/cmov/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/lib/i386-linux-gnu/tls/sse2/cmov",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/lib/i386-linux-gnu/tls/sse2/libpthread.so.0",O_RDONLY) = -1 errno=2 
(No such file or directory)
1583 stat64("/lib/i386-linux-gnu/tls/sse2",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/lib/i386-linux-gnu/tls/cmov/libpthread.so.0",O_RDONLY) = -1 errno=2 
(No such file or directory)
1583 stat64("/lib/i386-linux-gnu/tls/cmov",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/lib/i386-linux-gnu/tls/libpthread.so.0",O_RDONLY) = -1 errno=2 (No 
such file or directory)
1583 stat64("/lib/i386-linux-gnu/tls",0x4300d1e8) = -1 errno=2 (No such file or 
directory)
1583 open("/lib/i386-linux-gnu/i686/sse2/cmov/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/lib/i386-linux-gnu/i686/sse2/cmov",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/lib/i386-linux-gnu/i686/sse2/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/lib/i386-linux-gnu/i686/sse2",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/lib/i386-linux-gnu/i686/cmov/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/lib/i386-linux-gnu/i686/cmov",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/lib/i386-linux-gnu/i686/libpthread.so.0",O_RDONLY) = -1 errno=2 (No 
such file or directory)
1583 stat64("/lib/i386-linux-gnu/i686",0x4300d1e8) = -1 errno=2 (No such file 
or directory)
1583 open("/lib/i386-linux-gnu/sse2/cmov/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/lib/i386-linux-gnu/sse2/cmov",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/lib/i386-linux-gnu/sse2/libpthread.so.0",O_RDONLY) = -1 errno=2 (No 
such file or directory)
1583 stat64("/lib/i386-linux-gnu/sse2",0x4300d1e8) = -1 errno=2 (No such file 
or directory)
1583 open("/lib/i386-linux-gnu/cmov/libpthread.so.0",O_RDONLY) = -1 errno=2 (No 
such file or directory)
1583 stat64("/lib/i386-linux-gnu/cmov",0x4300d1e8) = -1 errno=2 (No such file 
or directory)
1583 open("/lib/i386-linux-gnu/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such 
file or directory)
1583 stat64("/lib/i386-linux-gnu",0x4300d1e8) = -1 errno=2 (No such file or 
directory)
1583 
open("/usr/lib/i386-linux-gnu/tls/i686/sse2/cmov/libpthread.so.0",O_RDONLY) = 
-1 errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/tls/i686/sse2/cmov",0x4300d1e8) = -1 
errno=2 (No such file or directory)
1583 open("/usr/lib/i386-linux-gnu/tls/i686/sse2/libpthread.so.0",O_RDONLY) = 
-1 errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/tls/i686/sse2",0x4300d1e8) = -1 errno=2 
(No such file or directory)
1583 open("/usr/lib/i386-linux-gnu/tls/i686/cmov/libpthread.so.0",O_RDONLY) = 
-1 errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/tls/i686/cmov",0x4300d1e8) = -1 errno=2 
(No such file or directory)
1583 open("/usr/lib/i386-linux-gnu/tls/i686/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/tls/i686",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/usr/lib/i386-linux-gnu/tls/sse2/cmov/libpthread.so.0",O_RDONLY) = 
-1 errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/tls/sse2/cmov",0x4300d1e8) = -1 errno=2 
(No such file or directory)
1583 open("/usr/lib/i386-linux-gnu/tls/sse2/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/tls/sse2",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/usr/lib/i386-linux-gnu/tls/cmov/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/tls/cmov",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/usr/lib/i386-linux-gnu/tls/libpthread.so.0",O_RDONLY) = -1 errno=2 
(No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/tls",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/usr/lib/i386-linux-gnu/i686/sse2/cmov/libpthread.so.0",O_RDONLY) = 
-1 errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/i686/sse2/cmov",0x4300d1e8) = -1 errno=2 
(No such file or directory)
1583 open("/usr/lib/i386-linux-gnu/i686/sse2/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/i686/sse2",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/usr/lib/i386-linux-gnu/i686/cmov/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/i686/cmov",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/usr/lib/i386-linux-gnu/i686/libpthread.so.0",O_RDONLY) = -1 errno=2 
(No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/i686",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/usr/lib/i386-linux-gnu/sse2/cmov/libpthread.so.0",O_RDONLY) = -1 
errno=2 (No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/sse2/cmov",0x4300d1e8) = -1 errno=2 (No 
such file or directory)
1583 open("/usr/lib/i386-linux-gnu/sse2/libpthread.so.0",O_RDONLY) = -1 errno=2 
(No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/sse2",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/usr/lib/i386-linux-gnu/cmov/libpthread.so.0",O_RDONLY) = -1 errno=2 
(No such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu/cmov",0x4300d1e8) = -1 errno=2 (No such 
file or directory)
1583 open("/usr/lib/i386-linux-gnu/libpthread.so.0",O_RDONLY) = -1 errno=2 (No 
such file or directory)
1583 stat64("/usr/lib/i386-linux-gnu",0x4300d1e8) = -1 errno=2 (No such file or 
directory)
1583 open("/lib/tls/i686/sse2/cmov/libpthread.so.0",O_RDONLY) = -1 errno=2 (No 
such file or directory)
1583 stat64("/lib/tls/i686/sse2/cmov",0x4300d1e8) = -1 errno=2 (No such file or 
directory)
1583 open("/lib/tls/i686/sse2/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such 
file or directory)
1583 stat64("/lib/tls/i686/sse2",0x4300d1e8) = -1 errno=2 (No such file or 
directory)
1583 open("/lib/tls/i686/cmov/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such 
file or directory)
1583 stat64("/lib/tls/i686/cmov",0x4300d1e8) = -1 errno=2 (No such file or 
directory)
1583 open("/lib/tls/i686/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such file 
or directory)
1583 stat64("/lib/tls/i686",0x4300d1e8) = -1 errno=2 (No such file or directory)
1583 open("/lib/tls/sse2/cmov/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such 
file or directory)
1583 stat64("/lib/tls/sse2/cmov",0x4300d1e8) = -1 errno=2 (No such file or 
directory)
1583 open("/lib/tls/sse2/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such file 
or directory)
1583 stat64("/lib/tls/sse2",0x4300d1e8) = -1 errno=2 (No such file or directory)
1583 open("/lib/tls/cmov/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such file 
or directory)
1583 stat64("/lib/tls/cmov",0x4300d1e8) = -1 errno=2 (No such file or directory)
1583 open("/lib/tls/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such file or 
directory)
1583 stat64("/lib/tls",0x4300d1e8) = -1 errno=2 (No such file or directory)
1583 open("/lib/i686/sse2/cmov/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such 
file or directory)
1583 stat64("/lib/i686/sse2/cmov",0x4300d1e8) = -1 errno=2 (No such file or 
directory)
1583 open("/lib/i686/sse2/libpthread.so.0",O_RDONLY) = -1 errno=2 (No such file 
or directory)
1583 stat64("/lib/i686/sse2",0x4300d1e8) = 0
1583 open("/lib/i686/cmov/libpthread.so.0",O_RDONLY) = 3
1583 read(3,0x4300d2b8,512) = 512
1583 fstat64(3,0x4300d1d8) = 0
1583 mmap2(NULL,98816,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 
0x43129000
1583 
mmap2(0x4313e000,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x14)
 = 0x4313e000
1583 
mmap2(0x43140000,4608,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0)
 = 0x43140000
1583 close(3) = 0
1583 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
1583 open("/lib/i686/sse2/libc.so.6",O_RDONLY) = -1 errno=2 (No such file or 
directory)
1583 open("/lib/i686/cmov/libc.so.6",O_RDONLY) = 3
1583 read(3,0x4300d29c,512) = 512
1583 fstat64(3,0x4300d1bc) = 0
1583 mmap2(NULL,1427832,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 
0x43142000
1583 mprotect(0x43298000,4096,PROT_NONE) = 0
1583 
mmap2(0x43299000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x156)
 = 0x43299000
1583 
mmap2(0x4329c000,10616,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0)
 = 0x4329c000
1583 close(3) = 0
1583 mmap2(NULL,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 
0x4329f000
1583 mmap2(NULL,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 
0x432a0000
1583 set_thread_area(1124128384,1125224436,1126824768,1,0,1124128412) = 0
1583 mprotect(0x43299000,8192,PROT_READ) = 0
1583 mprotect(0x4313e000,4096,PROT_READ) = 0
1583 mprotect(0x43118000,4096,PROT_READ) = 0
1583 munmap(0x4311e000,41656) = 0
1583 set_tid_address(1126824872,1125380084,1126824872,47,29,1124128640) = 1583
1583 set_robust_list(1126824880,12,1125380084,47,1126824768,1124128640) = -1 
errno=38 (Function not implemented)
1583 futex(0x4300d770,FUTEX_PRIVATE_FLAG|265,1,NULL,NULL,0) = -1 errno=38 
(Function not implemented)
1583 rt_sigaction(320x4300d41c,NULL) = 0
1583 rt_sigaction(330x4300d41c,NULL) = -1 errno=22 (Invalid argument)
1583 rt_sigprocmask(SIG_UNBLOCK,0x4300d6d8,NULL) = 0
1583 ugetrlimit(3,1124128608,1126805492,8,1,1124127924) = 0
1583 uname(0x4300d4d4) = 0
1583 
mmap2(NULL,8392704,PROT_EXEC|PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0)
 = 0x432a1000
1583 brk(NULL) = 0x0804a000
1583 brk(0x0806b000) = 0x0806b000
1583 mprotect(0x432a1000,4096,PROT_NONE) = 0
1583 
clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x43aa1494,parent_tidptr=0x43aa1bd8,tls=0x4300d6c8,child_tidptr=0x43aa1bd8)
 = 1584
1583 
mmap2(NULL,8392704,PROT_EXEC|PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0)
 = 0x43aa4000
1583 set_robust_list(1135221728,12,1125380084,0,4001536,1135219864) = -1 
errno=38 (Function not implemented)
1583 mprotect(0x43aa4000,4096,PROT_NONE) = 0
1583 
clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x442a4494,parent_tidptr=0x442a4bd8,tls=0x4300d6b8,child_tidptr=0x442a4bd8)
 = 1585
1583 1583 set_robust_list(1143622624,12,1125380084,0,4001536,1143620760) = -1 
errno=38 (Function not implemented)
1583 futex(0x43aa1bd8,FUTEX_WAIT,1584,NULL,0x4313eff4,1125380084)1583 
write(1,0x43aa1198,18)thread1: 0 hello1
 = 18
1583 write(1,0x442a4198,18)thread2: 0 hello2
 = 18
1583 
nanosleep(1143619920,0,1143619992,0,1143620011,1143619928)nanosleep(1135219024,0,1135219096,0,1135219115,1135219032)
 = 0
1583 write(1,0x43aa1198,18)thread1: 1 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,1,1135219115,1135219032) = 0
1583 write(1,0x442a4198,18)thread2: 1 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,1,1143620011,1143619928) = 0
1583 write(1,0x43aa1198,18)thread1: 2 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,2,1135219115,1135219032) = 0
1583 write(1,0x442a4198,18)thread2: 2 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,2,1143620011,1143619928) = 0
1583 write(1,0x43aa1198,18)thread1: 3 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,3,1135219115,1135219032) = 0
1583 write(1,0x43aa1198,18)thread1: 4 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,4,1135219115,1135219032) = 0
1583 write(1,0x442a4198,18)thread2: 3 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,3,1143620011,1143619928) = 0
1583 write(1,0x43aa1198,18)thread1: 5 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,5,1135219115,1135219032) = 0
1583 write(1,0x442a4198,18)thread2: 4 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,4,1143620011,1143619928) = 0
1583 write(1,0x43aa1198,18)thread1: 6 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,6,1135219115,1135219032) = 0
1583 write(1,0x43aa1198,18)thread1: 7 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,7,1135219115,1135219032) = 0
1583 write(1,0x442a4198,18)thread2: 5 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,5,1143620011,1143619928) = 0
1583 write(1,0x43aa1198,18)thread1: 8 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,8,1135219115,1135219032) = 0
1583 write(1,0x442a4198,18)thread2: 6 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,6,1143620011,1143619928) = 0
1583 write(1,0x43aa1198,18)thread1: 9 hello1
 = 18
1583 nanosleep(1135219024,0,1135219096,9,1135219115,1135219032) = 0
1583 madvise(1126830080,8372224,4,1135221616,1135221616,1135219864) = 0
1583 exit(0)
 = 0
1583 futex(0x442a4bd8,FUTEX_WAIT,1585,NULL,0x4313eff4,1125380084) = 0
1583 write(1,0x442a4198,18)thread2: 7 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,7,1143620011,1143619928) = 0
1583 write(1,0x442a4198,18)thread2: 8 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,8,1143620011,1143619928) = 0
1583 write(1,0x442a4198,18)thread2: 9 hello2
 = 18
1583 nanosleep(1143619920,0,1143619992,9,1143620011,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 10 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,10,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 11 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,11,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 12 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,12,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 13 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,13,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 14 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,14,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 15 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,15,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 16 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,16,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 17 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,17,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 18 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,18,1143620012,1143619928) = 0
1583 write(1,0x442a4198,19)thread2: 19 hello2
 = 19
1583 nanosleep(1143619920,0,1143619992,19,1143620012,1143619928) = 0
1583 madvise(1135230976,8372224,4,1143622512,1143622512,1143620760) = 0
1583 exit(0)
 = 0
1583 fstat64(1,0x4300d094) = 0
1583 mmap2(NULL,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 
0x44312000
1583 write(1,0x44312000,21)End of pthread test.
 = 21
1583 exit_group(0)
address@hidden:/home/pi/raspidev#

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1035572

Title:
  Bug in Qemu User Mode

Status in QEMU:
  New

Bug description:
  Hi,
  I make an interesting discovery.
  My aim is to have a working qemu-i386 on Raspberry Pi.
  After long searching in the dark what goes wrong with ANY Qemu version for 
User Mode until today,
  I find the following: The bug must be in at least one function, that the 
program testclone
  from the testpackage for i386 in linux-user-test-0.3 calls.
  The wrong function is in the part, which enables more than one thread at the 
same time, NPTL.
  Funny, how I find this out: All the programs from the tests in 
linux-user-test-0.3 I can now run succesfull with my new builded qemu-i386 for 
Raspi.
  But the program testclone does not stop after it gives out all the right 
messages.
  The program testclone stops on my Desktop computer with Debian Wheezy 
installed.
  So, the error is not in the program testclone.
  So I make a look, what is going on there with strace. With strace you get 
informations about all the values in the working program, here testclone.
  I see, that the reason, why testclone not stops is in an infinite loop 
because of 
  while (waitpid(pid1, &status1, 0) != pid1);
  while (waitpid(pid2, &status2, 0) != pid2);
  at its end is never fullfilled. 
  This is the reason for the famous error message from Qemu User Mode 

  qemu: uncaught target signal 11 (Segmentation fault) - core dumped 
  Segmentation fault 

  stack1 = malloc(STACK_SIZE);
  pid1 = clone(thread1_func, stack1 + STACK_SIZE,
  CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello1");

  stack2 = malloc(STACK_SIZE);
  pid2 = clone(thread2_func, stack2 + STACK_SIZE, 
  CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2");

  The error happens early in the program testclone. Strace says, it is because 
no childprocess at all can be found. So, some basiccalculations in those four 
lines must be done wrong from Qemu.
  I think, that the adressspace for each thread is calculated wrong, or 
overlapps.
  Funny, it has nothing to do with the ARM processor. I get exact the same 
errormessages, when I run the program testclone on my desktopcompi i386 with a 
Wheezy in Qemu and then qemu-i386 testclone.
  This is a good message, because it means it is an error, that belongs at 
least to the i386 family but I think, every processor in Qemu User Mode is 
involved, so until now NPTL does not work.
  Today I make a hand by hand calculation with the source code from testclone 
and compare it with the values, that Qemu User Mode give. The handcalculated 
values should  be the same which my 
  Desktop computer with Wheezy with tesclone produces, but who knows,
  Dietmar

  PS: I hope, that this is the right source code for testclone. Any help
  is welcome:-)!

  
  Code: Select all
  #include <stdlib.h>
  #include <stdio.h>
  #include <string.h>
  #include <signal.h>
  #include <unistd.h>
  #include <inttypes.h>
  #include <pthread.h>
  #include <sys/wait.h>
  #include <sched.h>

  int thread1_func(void *arg)
  {
      int i;
      char buf[512];

      for(i=0;i<10;i++) {
          snprintf(buf, sizeof(buf), "thread1: %d %s\n", i, (char *)arg);
         write(1, buf, strlen(buf));
          usleep(100 * 1000);
      }
      return 0;
  }

  int thread2_func(void *arg)
  {
      int i;
      char buf[512];
      for(i=0;i<20;i++) {
          snprintf(buf, sizeof(buf), "thread2: %d %s\n", i, (char *)arg);
          write(1, buf, strlen(buf));
          usleep(120 * 1000);
      }
      return 0;
  }

  #define STACK_SIZE 16384

  void test_clone(void)
  {
      uint8_t *stack1, *stack2;
      int pid1, pid2, status1, status2;

      stack1 = malloc(STACK_SIZE);
      pid1 = clone(thread1_func, stack1 + STACK_SIZE, 
                   CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello1");

      stack2 = malloc(STACK_SIZE);
      pid2 = clone(thread2_func, stack2 + STACK_SIZE, 
                  CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2");

      while (waitpid(pid1, &status1, 0) != pid1);
      while (waitpid(pid2, &status2, 0) != pid2);
      printf("status1=0x%x\n", status1);
      printf("status2=0x%x\n", status2);
      printf("End of clone test.\n");
  }

  int main(int argc, char **argv)
  {
      test_clone();
      return 0;
  }
  Posts: 210
  Joined: 04 Sep 2011 17:43

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1035572/+subscriptions



reply via email to

[Prev in Thread] Current Thread [Next in Thread]