mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Solar Designer <solar@openwall.com>
To: musl@lists.openwall.com
Subject: Re: cluts review
Date: Wed, 13 Jul 2011 21:03:29 +0400	[thread overview]
Message-ID: <20110713170329.GA25024@openwall.com> (raw)
In-Reply-To: <4E1DC70F.7000501@gmail.com>

Luka,

On Wed, Jul 13, 2011 at 06:25:51PM +0200, Luka Mar??eti?? wrote:
> >>-    act.sa_flags   = SA_NODEFER;
> >>+    act.sa_flags   = 0;
> >This was being used as part of the longjmp trick.
> 
> Can you remind me what this does exactly? I can't remember anymore, 
> seemed to me it really was not needed. man says so as to not prevent the 
> signal handler from (paraphrasing:) calling a signal itself. I don't 
> need this, but you probably suggested it for some other reason then. 
> Please do remind me. Thanks.

As Rich reminded me (in here), this was needed to keep the signal
unblocked even after longjmp() back into your main program.  Otherwise,
the kernel blocks the signal when calling the signal handler, the signal
handler longjmp()s (doesn't return), and the signal remains blocked.

My recommended fix is to keep sa_flags at 0 (as changed above), but to
switch to using sigjmp_buf/sigsetjmp/siglongjmp.

> >By the way, there are a lot of warnings about local vars potentially
> >clobbered by longjmp. Those are worth checking out. I found gcc was
> >pretty strict about breaking my code in the dynamic linker when I
> >broke the rules for longjmp...
> 
> These result from the -02 parameter.

This doesn't mean that they are harmless.  It only means that gcc
doesn't always see the problems.

Do you understand what clobbering by longjmp means and why it occurs?

Alexander


      reply	other threads:[~2011-07-13 17:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 11:07 Solar Designer
2011-07-13 12:02 ` Luka Marčetić
2011-07-13 12:21   ` Solar Designer
2011-07-13 12:57     ` Luka Marčetić
2011-07-13 13:42       ` Rich Felker
2011-07-13 14:21         ` Solar Designer
2011-07-13 13:54       ` Solar Designer
2011-07-13 14:00         ` Rich Felker
2011-07-13 14:31           ` Solar Designer
2011-07-13 14:03     ` Rich Felker
2011-07-13 14:37       ` Solar Designer
2011-07-13 16:03   ` Solar Designer
2011-07-13 16:55     ` Luka Marčetić
2011-07-13 17:05       ` Solar Designer
2011-07-13 17:25         ` Luka Marčetić
2011-07-13 17:52           ` Solar Designer
2011-07-13 19:29             ` Luka Marčetić
2011-07-13 19:55               ` Rich Felker
2011-07-13 20:39               ` Solar Designer
2011-07-13 21:44                 ` Solar Designer
2011-07-13 19:52             ` Rich Felker
2011-07-13 20:03       ` Rich Felker
2011-07-14 18:56       ` Rich Felker
2011-07-13 13:38 ` Rich Felker
2011-07-13 14:12   ` Solar Designer
2011-07-13 14:26     ` Rich Felker
2011-07-13 14:46       ` Solar Designer
2011-07-13 16:25   ` Luka Marčetić
2011-07-13 17:03     ` Solar Designer [this message]

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=20110713170329.GA25024@openwall.com \
    --to=solar@openwall.com \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).