Summary: | CALL_FN_W_6W is possibly broken on Darwin | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Alexander Potapenko <glider> |
Component: | general | Assignee: | Julian Seward <jseward> |
Status: | RESOLVED NOT A BUG | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 3.6 SVN | ||
Target Milestone: | --- | ||
Platform: | Unlisted Binaries | ||
OS: | macOS | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | A patch that adds an mmap() interceptor to Helgrind. |
Description
Alexander Potapenko
2010-02-25 15:57:36 UTC
Does memcheck/tests/wrap6.c work? In fact you should verify that all the memcheck/tests/wrap*.c tests work. Yes, each of them works. I've also tried to make a binary with a 6-args function that prints its own arguments and wrap this function -- the arguments seemed to be passed correctly. Could the system calls like mmap pass their arguments in a different way? NB: the misbehaviour of mmap is observed iff the file descriptor used by mmap is returned by shm_open called for "apple.shm.notification_center". Maybe the problem is really mmap-specific. The extract from the Helgrind run with --trace-syscalls: $ valgrind --trace-syscalls=yes -v --tool=helgrind ./shm ... SYSCALL[67703,1](mach: 27) mach_thread_self()[sync] --> Success(0x0:0x50b) thread 0x50b SYSCALL[67703,1](mach: 27) mach_thread_self()[sync] --> Success(0x0:0x50b) thread 0x50b SYSCALL[67703,1](unix:266) shm_open(0x1fc0(apple.shm.notification_center), 0, 0) --> [async] ... SYSCALL[67703,1](unix:266) ... [async] --> Success(0xbffffaec:0x3) SYSCALL[67703,1](unix:339) fstat64 ( 1, 0xbffff254 )[sync] --> Success(0x153:0x0) --67703-- REDIR: 0x200af8 (mmap) redirected to 0x17f42 (mmap) SYSCALL[67703,1](unix:197) mmap ( 0x0, 4096, 1, 1, 3, -4294967296 )[sync] --> Failure(0x16) ... Looks like the last parameter is -0x100000000 instead of 0. CALL_FN_*_** only work for word-sized args. Are you sure all the args are 32-bit values? Oh, looks like the last mmap() argument is a 64-bit value on Darwin. Is it possible to wrap such a function? Looks like CALL_FN_W_7W should work for mmap. Sorry for bothering. |