Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323349

Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas within sighandler

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas within sighandler
Date 2016-02-01 18:30 +0100
Message-ID <qXqsA-6bL-41@gated-at.bofh.it> (permalink)
References <qX2Tf-5OH-3@gated-at.bofh.it> <qX32W-5Tv-11@gated-at.bofh.it> <qXpd9-5p0-41@gated-at.bofh.it> <qXpZw-5Jg-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 02/01, Stas Sergeev wrote:
>
> >So the sequence is
> >
> >	// running on alt stack
> >
> >	sigaltstack(SS_DISABLE);
> >
> >	temporary_run_on_another_stack();
> >
> >	sigaltstack(SS_ONSTACK);
> >
> >and SS_DISABLE saves us from another SA_ONSTACK signal, right?
> Yes.
> Note: there is a test-case in that patch serie from which
> you can see or copy/paste the sample code.

OK, I wasn't cc'ed

> >But afaics it can only help after we change the stack. Suppose that SA_ONSTACK signal
> >comess before temporary_run_on_another_stack(). get_sigframe() should be fine after
> >your changes (afaics), it won't pick the alt stack after SS_DISABLE.
> >
> >However, unless I missed something save_altstack_ex() will record SS_ONSTACK in
> >uc_stack->ss_flags, and after return from signal handler restore_altstack() will
> >enable alt stack again?
> I don't think so. Please see the following hunk:

Yes, see another email, I already noticed this change.

> So I understand this is very confusing, but I think the patch
> is correct.

Not sure, but I can hardly read this patch and I can't apply it.

> Do you think adding the SS_FORCE flag would be a better solution?

Yes, certainly. I see no point to remember that a thread actually has the alt stack
but it was disabled.

Oleg.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] make sigaltstack() compatible with swapcontext() Stas Sergeev <stsp@list.ru> - 2016-01-31 17:20 +0100
  [PATCH 1/4] selftests: Add test for sigaltstack(SS_DISABLE) inside  sighandler Stas Sergeev <stsp@list.ru> - 2016-01-31 17:20 +0100
  [PATCH 2/4] score: signal: fix sigaltstack check Stas Sergeev <stsp@list.ru> - 2016-01-31 17:30 +0100
    Re: [PATCH 2/4] score: signal: fix sigaltstack check Lennox Wu <lennox.wu@gmail.com> - 2016-02-02 20:10 +0100
  [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas within  sighandler Stas Sergeev <stsp@list.ru> - 2016-01-31 17:30 +0100
    Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Andy Lutomirski <luto@amacapital.net> - 2016-01-31 18:10 +0100
      Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-01-31 18:40 +0100
        Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Andy Lutomirski <luto@amacapital.net> - 2016-01-31 20:10 +0100
          Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-01-31 21:00 +0100
            Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Andy Lutomirski <luto@amacapital.net> - 2016-01-31 21:20 +0100
              Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-01-31 23:40 +0100
                Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Andy Lutomirski <luto@amacapital.net> - 2016-01-31 23:50 +0100
                Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-02-01 00:50 +0100
    Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Oleg Nesterov <oleg@redhat.com> - 2016-02-01 17:10 +0100
      Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-02-01 18:00 +0100
        Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Oleg Nesterov <oleg@redhat.com> - 2016-02-01 18:30 +0100
      Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Oleg Nesterov <oleg@redhat.com> - 2016-02-01 18:20 +0100
        Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-02-01 18:30 +0100
          Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Oleg Nesterov <oleg@redhat.com> - 2016-02-01 19:10 +0100
            Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-02-01 19:20 +0100
              Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Andy Lutomirski <luto@amacapital.net> - 2016-02-01 19:30 +0100
                Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-02-01 19:50 +0100
              Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Oleg Nesterov <oleg@redhat.com> - 2016-02-01 20:00 +0100
                Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-02-01 20:10 +0100
                Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Oleg Nesterov <oleg@redhat.com> - 2016-02-01 20:30 +0100
                Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-02-01 20:50 +0100
                Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Oleg Nesterov <oleg@redhat.com> - 2016-02-01 21:50 +0100
                Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas  within sighandler Stas Sergeev <stsp@list.ru> - 2016-02-02 00:10 +0100
  [PATCH 3/4] x86: signal: unify the sigaltstack check with other  arches Stas Sergeev <stsp@list.ru> - 2016-01-31 17:30 +0100
    Re: [PATCH 3/4] x86: signal: unify the sigaltstack check with other arches Andy Lutomirski <luto@amacapital.net> - 2016-01-31 18:00 +0100
      Re: [PATCH 3/4] x86: signal: unify the sigaltstack check with other  arches Stas Sergeev <stsp@list.ru> - 2016-01-31 19:10 +0100

csiph-web