Bug 464000

Summary: Test timerfd-syscall stops/fails when compiled with _TIME_BITS=64 on 32bit
Product: [Developer tools] valgrind Reporter: Taketo Kabe <dkabe>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: sam
Priority: NOR    
Version First Reported In: 3.19.0   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: patch for timerfd-syscall test failure with _TIME_BITS=64

Description Taketo Kabe 2023-01-08 12:10:57 UTC
Created attachment 155104 [details]
patch for timerfd-syscall test failure with _TIME_BITS=64

SUMMARY
Test timerfd-syscall stops/fails when compiled with _TIME_BITS=64 on 32bit

STEPS TO REPRODUCE
1.  On LInux, prepare a 32bit compile environment.  Installing 32bit development env and "setarch i686" is often enough.
2.  CPPFLAGS="-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" ./configure
3.  make
4.  make check

OBSERVED RESULT
Test halts at:
timerfd-syscall: valgrind   ./timerfd-syscall

EXPECTED RESULT
All tests pass.

SOFTWARE/OS VERSIONS

Linux:  5.14.0-162.6.1.el9_1.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Nov 28 18:44:09 UTC 2022 i686 i686 i386 GNU/Linux
glibc: glibc-2.34-28.el9_0.v1.i586

ADDITIONAL INFORMATION
timerfd-syscall.c overrides system function timerfd_settime() and timerfd_gettime(), 
but when _TIME_BITS=64 is enabled on GLIBC system, these function calls become alias to  __timerfd_settime64(), __timerfd_gettime64().  timerfd-syscall.c should call the correct underlining system call under _TIME_BITS=64.

The attached patch seems to fix this.
Note that #include <sys/timerfd.h> is not surrounded by #if defined(HAVE_SYS_TIMERFD_H), since configure does not yet detect this.