Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1322684
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/4] sigaltstack: allow disabling and re-enabling sas within sighandler |
| Date | 2016-01-31 18:10 +0100 |
| Message-ID | <qX3FE-6q4-9@gated-at.bofh.it> (permalink) |
| References | <qX2Tf-5OH-3@gated-at.bofh.it> <qX32W-5Tv-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, Jan 31, 2016 at 8:28 AM, Stas Sergeev <stsp@list.ru> wrote: > > linux implements the sigaltstack() in a way that makes it impossible to > use with swapcontext(). Per the man page, sigaltstack is allowed to return > EPERM if the process is altering its sigaltstack while running on > sigaltstack. > This is likely needed to consistently return oss->ss_flags, that indicates > whether the process is being on sigaltstack or not. > Unfortunately, linux takes that permission to return EPERM too literally: > it returns EPERM even if you don't want to change to another sigaltstack, > but only want to temporarily disable sigaltstack with SS_DISABLE. > You can't use swapcontext() without disabling sigaltstack first, or the > stack will be re-used and overwritten by a subsequent signal. > > With this patch, disabling sigaltstack inside a signal handler became > possible, and the swapcontext() can then be used safely. After switching > back to the sighandler, the app can re-enable the sigatlstack. > The oss->ss_flags will correctly indicate the current use of sigaltstack, > even if it is temporarily disabled. Any attempt to modify the sigaltstack > (rather than to disable or re-enable it) within the sighandler, will still > be punished with EPERM as suggested by POSIX. This seems considerably more complicated than my previous proposal to add an SS_FORCE flag to say "I know what I'm doing. Ignore POSIX and let me change the sigaltstack configuration even if it's in use". What's the advantage? --Andy
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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