Bug 102998 - nptl sigcancel_handler ignores context pointer [third argument]
Summary: nptl sigcancel_handler ignores context pointer [third argument]
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc
Version: 3.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-08-24 22:03 UTC by John Reiser
Modified: 2007-11-30 22:06 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-08-25 11:56:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description John Reiser 2003-08-24 22:03:24 UTC
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 11:56:15 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.