Subject: Re: CVS commit: src/lib/libpthread
To: YAMAMOTO Takashi <yamt@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: source-changes
Date: 11/20/2003 19:42:49
On Thu, Nov 20, 2003 at 19:38:51 +0300, Valeriy E. Ushakov wrote:

> On Thu, Nov 20, 2003 at 15:46:42 +0000, YAMAMOTO Takashi wrote:
> 
> > Module Name:	src
> > Committed By:	yamt
> > Date:		Thu Nov 20 15:46:42 UTC 2003
> > 
> > Modified Files:
> > 	src/lib/libpthread: pthread_sig.c
> > 
> > Log Message:
> > pthread__deliver_signal: swap oldmask and siginfo so that signal
> > handler's stack doesn't stomp siginfo.
> > this also fixes !__HAVE_SIGINFO, in that case
> > pthread__signal_tramp assumes uc->uc_stack.ss_sp points the old
> > signal mask.
> > 
> > pointed by uwe@.
> 
> Uh... I probably don't understand this code fully, but consider that
> the uc is on the stack right above (lower addresses) the sigset_t
> pointed to by maskp.  So if you set ss_sp in the uc to maskp and if
> the platform passes arguments via stack, makecontext will write them
> at the end of uc (above ss_sp = maskp).  We probably get away with
> this because of the PAD in the ucontext.

Before maskp was added in 1.1.2.12, the code read:

    uc->uc_stack.ss_sp = uc;

i.e. stack above uc (ss_size is zero) - which, I think, is the correct
fix.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen