mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@list.ru>
To: stsp@list.ru
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org
Subject: [PATCH v3 0/2] make sigaltstack() compatible with swapcontext()
Date: Mon, 29 Feb 2016 00:13:18 +0300	[thread overview]
Message-ID: <1456694000-16395-1-git-send-email-stsp@list.ru> (raw)

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.

[PATCH 1/2] sigaltstack: implement SS_AUTODISARM flag
	This patch implements SS_AUTODISARM flag
[PATCH 2/2] selftests: Add test for sigaltstack(SS_AUTODISARM)
	This patch adds the selftest code for new functionality

CC: linux-kernel@vger.kernel.org
CC: linux-api@vger.kernel.org

Diffstat:
 include/linux/sched.h                        |    1 
 include/linux/signal.h                       |    4 
 include/uapi/linux/signal.h                  |    3 
 kernel/fork.c                                |    4 
 kernel/signal.c                              |   23 ++--
 tools/testing/selftests/Makefile             |    1 
 tools/testing/selftests/sigaltstack/Makefile |    8 +
 tools/testing/selftests/sigaltstack/sas.c    |  151 +++++++++++++++++++++++++++
 8 files changed, 182 insertions(+), 13 deletions(-)

             reply	other threads:[~2016-02-28 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-28 21:13 Stas Sergeev [this message]
2016-02-28 21:13 ` [PATCH 1/2] sigaltstack: implement SS_AUTODISARM flag Stas Sergeev
2016-02-29  6:29   ` Stas Sergeev
2016-02-28 21:13 ` [PATCH 2/2] selftests: Add test for sigaltstack(SS_AUTODISARM) Stas Sergeev

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=1456694000-16395-1-git-send-email-stsp@list.ru \
    --to=stsp@list.ru \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®