From: Nicholas Miell <nmiell@comcast.net>
To: Xavier Roche <roche+kml2@exalead.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: sigaction's ucontext_t with incorrect stack reference when SA_SIGINFO is being used ?
Date: Mon, 22 Jan 2007 21:37:57 -0800 [thread overview]
Message-ID: <1169530677.2995.8.camel@entropy> (raw)
In-Reply-To: <45B47C68.2000903@exalead.com>
On Mon, 2007-01-22 at 09:57 +0100, Xavier Roche wrote:
> Hi folks,
>
> I have a probably louzy question regarding sigaction() behaviour when an
> alternate signal stack is used: it seems that I can not get the user
> stack reference in the ucontext_t stack context ; ie. the uc_stack
> member contains reference of the alternate signal stack, not the stack
> that was used before the crash.
>
> Is this is a normal behaviour ? Is there a way to retrieve the original
> user's stack inside the signal callback ?
>
> The example given below demonstrates the issue:
> top of stack==0x7fffff3d7000, alternative_stack==0x501010
> SEGV==0x7fffff3d6ff8; sp==0x501010; current stack is the alternate stack
>
> It is obvious that the SEGV was a stack overflow: the si_addr address is
> just on the page below the stack limit.
POSIX says:
"the third argument can be cast to a pointer to an object of type
ucontext_t to refer to the receiving thread's context that was
interrupted when the signal was delivered."
so if uc_stack doesn't point to the stack in use immediately prior to
signal generation, this is a bug.
(In theory I should be able to pass the ucontext_t supplied to the
signal handler to setcontext() and resume execution exactly where I left
off -- glibc's refusal to support kernel-generated ucontexts gets in the
way of this, but the point still stands.)
I have no idea who to bother about i386 signal delivery, though. (And I
suspect this bug has probably been copied to other architectures as
well.)
--
Nicholas Miell <nmiell@comcast.net>
next prev parent reply other threads:[~2007-01-23 5:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-22 8:57 sigaction's ucontext_t with incorrect stack reference when SA_SIGINFO is being used ? Xavier Roche
2007-01-23 5:37 ` Nicholas Miell [this message]
2007-01-24 7:44 ` Xavier Roche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1169530677.2995.8.camel@entropy \
--to=nmiell@comcast.net \
--cc=linux-kernel@vger.kernel.org \
--cc=roche+kml2@exalead.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox