Bug 102998 - nptl sigcancel_handler ignores context pointer [third argument]
nptl sigcancel_handler ignores context pointer [third argument]
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2003-08-24 18:03 EDT by John Reiser
Modified: 2007-11-30 17:06 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-25 07:56:15 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
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):

How reproducible:

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

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

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