Bug 369362

Summary: Bad sigaction arguments crash valgrind
Product: [Developer tools] valgrind Reporter: Mark Wielaard <mark>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Fix crash in linux [rt_]sigaction wrapper with bad old/new sigaction handler.

Description Mark Wielaard 2016-09-25 22:31:05 UTC
LTP testcases/kernel/syscalls/rt_sigaction/rt_sigaction02 crashes valgrind:

--29814-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exi
ting
--29814-- si_code=1;  Faulting address: 0xA;  sp: 0x80327ad70

valgrind: the 'impossible' happened:
   Killed by fatal signal

host stacktrace:
==29814==    at 0x380AF328: vgSysWrap_linux_sys_rt_sigaction_before (syswrap-lin
ux.c:3376)
==29814==    by 0x38092CDF: vgPlain_client_syscall (syswrap-main.c:1906)
==29814==    by 0x3808F8B2: handle_syscall (scheduler.c:1118)
==29814==    by 0x38090E76: vgPlain_scheduler (scheduler.c:1435)
==29814==    by 0x380A027A: thread_wrapper (syswrap-linux.c:103)
==29814==    by 0x380A027A: run_a_thread_NORETURN (syswrap-linux.c:156)


Reproducible: Always
Comment 1 Mark Wielaard 2016-09-25 22:33:18 UTC
Created attachment 101290 [details]
Fix crash in linux [rt_]sigaction wrapper with bad old/new sigaction handler.

Since we try to modify the old/new sigaction handler before passing it
to the kernel we must make sure that (if they aren't NULL) it is safe
to use. If not we should bail out early with EFAULT.
Comment 2 Mark Wielaard 2016-10-01 11:58:19 UTC
valgrind svn r15994