This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes

Bug 102998

Summary: nptl sigcancel_handler ignores context pointer [third argument]
Product: Red Hat Enterprise Linux 3 Reporter: John Reiser <jreiser>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-25 07:56:15 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description John Reiser 2003-08-24 18:03:24 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030709

Description of problem:
The sigcancel_handler() in nptl/init.c does not use its third argument, void
*ctx, not even in the call to the __do_cancel() macro.  Because of this, deeper
levels of the implementation of canceling (__pthread_unwind,
_Unwind_ForcedUnwind, MD_FALLBACK_FRAME_STATE_FOR, etc.) must assume where the
context is.  Such assumptions easily can be incorrect, for example if the kernel
pushes the siginfo_t and struct ucontext onto the stack in the other order, or
not contiguously with the parameters to the handler [there might be alignment
optimizations, etc.]  

Instead, sigcancel_handler should use the ctx argument, passing it along to
other levels, to allow intended flexibility of placement by the kernel, an
auditing subsystem, etc.


Version-Release number of selected component (if applicable):
glibc-2.3.2-70

How reproducible:
Always

Steps to Reproduce:
1. Inspect the source for sigcancel_handler in nptl/init.c, and __do_cancel in
nptl/pthreadP.h .
2.
3.
    

Actual Results:  The third argument to sigcancel_handler (the "void *ctx" which
on Linux/i386 is "struct ucontext *") is not used.

Expected Results:  The void *ctx argument should be passed along for use by
deeper levels of the implementation of canceling.

Additional info:
Comment 1 Jakub Jelinek 2003-08-25 07:56:15 EDT
MD_FALLBACK_FRAME_STATE_FOR is part of libgcc, not glibc and needs to be able
to unwind through any signal handler, not just SIGCANCEL in NPTL.
Alternative to MD_FALLBACK_FRAME_STATE_FOR is providing .eh_frame unwind
info for signal frames (e.g. in kernel virtual syscall page), but libgcc has
to support older kernels as well, so MD_FALLBACK_FRAME_STATE_FOR needs to stay
anyway.