Skip to content

make sigaltstack() compatible with swapcontext()

Stas Sergeev linux-api lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest4 patches 1 replyIn review
  2. v54 patches 0 repliesSuperseded
  3. v42 patches 10 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v32 patches1 replySuperseded
v24 patches0 repliesSuperseded
v14 patches28 repliesSuperseded

Changes in v6 from the cover letter

- Fix description of patch 4/4

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4x86: signal: unify the sigaltstack check with other archesarch/x86/kernel/signal.c+11 -120 replies
2/4sigaltstack: preparations for adding new SS_xxx flagsinclude/uapi/linux/signal.h kernel/signal.c+9 -100 replies
3/4sigaltstack: implement SS_AUTODISARM flaginclude/linux/sched.h include/linux/signal.h include/uapi/linux/signal.h +2 more+23 -50 replies
4/4selftests: Add test for sigaltstack(SS_ONSTACK|SS_AUTODISARM)tools/testing/selftests/Makefile tools/testing/selftests/sigaltstack/Makefile tools/testing/selftests/sigaltstack/sas.c+165 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/4] make sigaltstack() compatible with swapcontext()

The following patches make it possible to use swapcontext() in a sighandler that works on sigaltstack.
The approach is inspired by Andy Lutomirski's suggestion that sigaltstack should disarm itself after saving into uc_stack:
https://lkml.org/lkml/2016/2/1/594

I add the SS_AUTODISARM flag that does exactly that. On sighandler exit, the sigaltstack is restored from uc_stack. Another possible name could be SS_ONESHOT, but, since it gets always re-enabled, I choose SS_AUTODISARM.

Change since v5:
- Fix description of patch 4/4

Change since v4:
- Implement this Andy Lutomirski's suggestion:
https://lkml.org/lkml/2016/3/6/158
that allows the run-time probing of the existence of the flags added in the future.

[PATCH 1/4] [Cleanup] x86: signal: unify the sigaltstack check with
A clean-up patch that unifies x86's sigaltstack handling with other arches.
[PATCH 2/4] sigaltstack: preparations for adding new SS_xxx flags
Andy's suggested changes
[PATCH 3/4] sigaltstack: implement SS_AUTODISARM flag
This patch implements SS_AUTODISARM flag
[PATCH 4/4] selftests: Add test for
This patch adds the selftest code for new functionality

CC Andy Lutomirski <[email protected]>
CC Oleg Nesterov <[email protected]>
CC Shuah Khan <[email protected]>
CC Ingo Molnar <[email protected]>

Diffstat:

 arch/x86/kernel/signal.c                     |   23 +--
 include/linux/sched.h                        |    8 +
 include/linux/signal.h                       |    4 
 include/uapi/linux/signal.h                  |    7 +
 kernel/fork.c                                |    2 
 kernel/signal.c                              |   26 ++--
 tools/testing/selftests/Makefile             |    1 
 tools/testing/selftests/sigaltstack/Makefile |    8 +
 tools/testing/selftests/sigaltstack/sas.c    |  156 +++++++++++++++++++++++++++
 9 files changed, 208 insertions(+), 27 deletions(-)