Bug 770746

Summary: Valgrind does not support F_GETOWN_EX fcntl
Product: [Fedora] Fedora Reporter: Jerry James <loganjerry>
Component: valgrindAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 16CC: dodji, jakub
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-27 19:41:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Patch to add support for F_SETOWN_EX and F_GETOWN_EX none

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.