|
From: Matthias S. <zz...@ge...> - 2012-02-09 20:38:28
|
Hi all, I tried to run a win32 application under valgrind+wine on a gentoo x86 installation. Sadly this failed on an internal error like in https://bugs.kde.org/show_bug.cgi?id=275673 The error looks like this part from the bug: strace.txt:61324:[pid 2563] pipe([20, 21]) = 0 strace.txt:61325:[pid 2563] fcntl(20, F_DUPFD, 1014) = -1 EINVAL (Invalid argument) strace.txt:61327:[pid 2563] gettid() = 2563 strace.txt:61408:[pid 2563] fcntl(-1, F_SETFD, FD_CLOEXEC) = -1 EBADF (Bad file descriptor) strace.txt:61413:[pid 2563] gettid() = 2563 strace.txt:61509:[pid 2563] poll([{fd=1019, events=POLLIN}], 1, -1 The duplicating of the fd fails. The reason is, that before prlimit64 is called to change RLIMIT_NOFILE. But valgrind does not emulate it like setrlimit and getrlimit. (The second call to set FD_CLOEXEC could be avoided on error of F_DUPFD before.) I changed valgrind to make prlimit64 behave like the setrlimit and getrlimit syscalls. The patch also contains a testcase for setrlimit64 and getrlimit64 for fileno. I needed to move all code to the pre-handler, as it is possible to call prlimit64 with both set and get parameter. This also deserves a testcase. What also is missing is: only using the emulation if pid is 0 or equal the current pid. The attached patch applies against valgrind svn revision 12373. Tested on a Gentoo amd64 installation built for 64bit and also built for 32bit (with --enable-only32bit). Regards, Matthias |