Re: [tip:core/signals] signals/sigaltstack: Implement SS_AUTODISARM flag
From: Andy Lutomirski
Date: Tue May 03 2016 - 12:28:19 EST
On Tue, May 3, 2016 at 12:50 AM, tip-bot for Stas Sergeev
> Commit-ID: 2a74213838104a41588d86fd5e8d344972891ace
> Gitweb: http://git.kernel.org/tip/2a74213838104a41588d86fd5e8d344972891ace
> Author: Stas Sergeev <stsp@xxxxxxx>
> AuthorDate: Thu, 14 Apr 2016 23:20:04 +0300
> Committer: Ingo Molnar <mingo@xxxxxxxxxx>
> CommitDate: Tue, 3 May 2016 08:37:59 +0200
> signals/sigaltstack: Implement SS_AUTODISARM flag
> This patch implements the SS_AUTODISARM flag that can be OR-ed with
> SS_ONSTACK when forming ss_flags.
> When this flag is set, sigaltstack will be disabled when entering
> the signal handler; more precisely, after saving sas to uc_stack.
> When leaving the signal handler, the sigaltstack is restored by
> When this flag is used, it is safe to switch from sighandler with
> swapcontext(). Without this flag, the subsequent signal will corrupt
> the state of the switched-away sighandler.
> To detect the support of this functionality, one can do:
> err = sigaltstack(SS_DISABLE | SS_AUTODISARM);
> if (err && errno == EINVAL)
One of my review comments from last time got lost, I think. I'll send
a followup patch.
> +/* bit-flags */
> +#define SS_AUTODISARM (1 << 4) /* disable sas during sighandling */
Before this gets enshrined as ABI, could we perhaps change this to (1
<< 31)? I don't see why we should pick a bit in the middle of the
field as our first flag bit.