Bug 770746 - Valgrind does not support F_GETOWN_EX fcntl
Summary: Valgrind does not support F_GETOWN_EX fcntl
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: valgrind
Version: 16
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-28 21:59 UTC by Jerry James
Modified: 2012-01-27 19:41 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-01-27 19:41:13 UTC
Type: ---


Attachments (Terms of Use)
Patch to add support for F_SETOWN_EX and F_GETOWN_EX (4.31 KB, patch)
2011-12-28 22:22 UTC, Jerry James
no flags Details | Diff

Description Jerry James 2011-12-28 21:59:15 UTC
Description of problem:
I'm trying to track down a memory leak in XEmacs.  I ran it under valgrind, and got this (with --trace-syscalls=yes):

SYSCALL[14973,1]( 72) sys_fcntl[UNKNOWN] ( 6, 16, 34342956080 )
valgrind: m_syswrap/syswrap-linux.c:3660 (vgSysWrap_linux_sys_fcntl_before): Assertion 'Unimplemented functionality' failed.
valgrind: valgrind
==14973==    at 0x3804ACB6: report_and_quit (m_libcassert.c:209)
==14973==    by 0x3804AE5C: vgPlain_assert_fail (m_libcassert.c:283)
==14973==    by 0x380A67DA: vgSysWrap_linux_sys_fcntl_before (syswrap-linux.c:3660)
==14973==    by 0x38085BD7: vgPlain_client_syscall (syswrap-main.c:1491)
==14973==    by 0x38082A8C: handle_syscall (scheduler.c:899)
==14973==    by 0x38083C39: vgPlain_scheduler (scheduler.c:1095)
==14973==    by 0x38093684: run_a_thread_NORETURN (syswrap-linux.c:94)

followed by valgrind quitting.  Number 16 is F_GETOWN_EX.

Version-Release number of selected component (if applicable):
valgrind-3.6.1-6.fc16.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Run XEmacs under valgrind
2.
3.
  
Actual results:
Valgrind reports an unimplemented fcntl and quits.

Expected results:
Valgrind keeps going so I can find the leak.

Additional info:
The source line of code in XEmacs does this: "fcntl (filedesc, F_GETOWN, 0);".  It looks like glibc transforms that into a F_GETOWN_EX call; see do_fcntl() in sysdeps/unix/sysv/linux/fcntl.c.

Comment 1 Jerry James 2011-12-28 22:22:01 UTC
Created attachment 549867 [details]
Patch to add support for F_SETOWN_EX and F_GETOWN_EX

I'm attaching the patch that I think is needed to fix this.  However, attempting to build valgrind to try this patch failed in the configure step:

checking for a supported OS... ok (linux-gnu)
checking for the kernel version... unsupported (3.1.6-1.fc16.x86_64)
configure: error: Valgrind works on kernels 2.4, 2.6
error: Bad exit status from /var/tmp/rpm-tmp.PACcHW (%build)

How is valgrind supposed to be built on Fedora 16?

Comment 2 Jerry James 2011-12-28 22:45:05 UTC
I added this to the end of %prep:

sed -i "s/2\.6\.\*)/2.6.*|3.*)/" configure

and the package built successfully.  The patch from comment 1 does, in fact, fix the problem.

Comment 3 Jakub Jelinek 2012-01-27 19:41:13 UTC
Should be fixed in valgrind-3.7.0-1.fc17.


Note You need to log in before you can comment on or make changes to this bug.