Bug 372861

Summary: Test pselect_alarm for Bug 359871 seg faults on RHEL 4
Product: [Developer tools] valgrind Reporter: Tushar <ntushar>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: mark
Priority: NOR    
Version First Reported In: 3.12 SVN   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Tushar 2016-11-23 22:33:26 UTC
Linux cacofonix 2.6.9-89.0.9.ELsmp #1 SMP Wed Aug 19 08:06:10 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

The crash occurs at line

assert(pselect(0, NULL, NULL, NULL, NULL, (sigset_t *)12) == -1);

RHEL 4 does not handle bad address by returning EFAULT

If the goal is to have pselect fail, can the test be replace with 

assert(pselect(-1, NULL, NULL, NULL, NULL, NULL) == -1);
assert(errno == EINVAL);

These changes work on RHEL 4, 5 and 6.
Comment 1 Tushar 2017-03-07 05:44:13 UTC
The stack trace after commenting out lines 51 and 54 from the test code pselect_alarm.c and running the compiled binary on RHEL 4 machine

cacofonix<tdnair>:/home/tdnair> /opt/gdb-7.9.1/bin/gdb pselect_alarm.EL4 -c core.8357 
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from pselect_alarm.EL4...done.

warning: core file may not match specified executable file.
[New LWP 8357]
[New LWP 8358]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/tls/libthread_db.so.1".
Core was generated by `./pselect_alarm.EL4'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000382b22e799 in sigprocmask () from /lib64/tls/libc.so.6
(gdb) where
#0  0x000000382b22e799 in sigprocmask () from /lib64/tls/libc.so.6
#1  0x000000382b2c3438 in pselect () from /lib64/tls/libc.so.6
#2  0x0000000000400a2a in main () at pselect_alarm.c:52