mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@list.ru>
To: Andy Lutomirski <luto@kernel.org>, x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Brian Gerst <brgerst@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-api@vger.kernel.org
Subject: Re: [PATCH 2/4] selftests/sigaltstack: Fix the sas test on old kernels
Date: Sat, 7 May 2016 18:02:26 +0300	[thread overview]
Message-ID: <abedee05-5671-7ba7-c256-41e61fb596cb@list.ru> (raw)
In-Reply-To: <f3e739bf435beeaecbd5f038f1359d2eac6d1e63.1462296606.git.luto@kernel.org>

03.05.2016 20:31, Andy Lutomirski пишет:
> The handling for old kernels was wrong.  Fix it.
>
> Reported-by: Ingo Molnar <mingo@kernel.org>
> Cc: Stas Sergeev <stsp@list.ru>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Brian Gerst <brgerst@gmail.com>
> Cc: Denys Vlasenko <dvlasenk@redhat.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Pavel Emelyanov <xemul@parallels.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Shuah Khan <shuahkh@osg.samsung.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-api@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
> ---
>   tools/testing/selftests/sigaltstack/sas.c | 21 ++++++++++++++-------
>   1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/sigaltstack/sas.c b/tools/testing/selftests/sigaltstack/sas.c
> index 57da8bfde60b..a98c3ef8141f 100644
> --- a/tools/testing/selftests/sigaltstack/sas.c
> +++ b/tools/testing/selftests/sigaltstack/sas.c
> @@ -15,6 +15,7 @@
>   #include <alloca.h>
>   #include <string.h>
>   #include <assert.h>
> +#include <errno.h>
>   
>   #ifndef SS_AUTODISARM
>   #define SS_AUTODISARM  (1 << 4)
> @@ -117,13 +118,19 @@ int main(void)
>   	stk.ss_flags = SS_ONSTACK | SS_AUTODISARM;
>   	err = sigaltstack(&stk, NULL);
>   	if (err) {
> -		perror("[FAIL]\tsigaltstack(SS_ONSTACK | SS_AUTODISARM)");
> -		stk.ss_flags = SS_ONSTACK;
> -	}
> -	err = sigaltstack(&stk, NULL);
> -	if (err) {
> -		perror("[FAIL]\tsigaltstack(SS_ONSTACK)");
> -		return EXIT_FAILURE;
> +		if (errno == EINVAL) {
> +			printf("[NOTE]\tThe running kernel doesn't support SS_AUTODISARM\n");
> +			/*
> +			 * If test cases for the !SS_AUTODISARM variant were
> +			 * added, we could still run them.  We don't have any
> +			 * test cases like that yet, so just exit and report
> +			 * success.
> +			 */
But that was the point, please see how it handles the
old kernels:

$ ./sas
[FAIL]    sigaltstack(SS_ONSTACK | SS_AUTODISARM): Invalid argument
[RUN]    signal USR1
[FAIL]    ss_flags=1, should be SS_DISABLE
[RUN]    switched to user ctx
[RUN]    signal USR2
[FAIL]    sigaltstack re-used
[FAIL]    Stack corrupted
[RUN]    Aborting

Unfortunalely, for Ingo it crashed...
I am not sure why, I can't reproduce. :(
So if you disable all the "old" tests, you can as well
remove them, or... find the bug and re-enable. :)

  parent reply	other threads:[~2016-05-07 15:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 17:31 [PATCH 0/4] SS_AUTODISARM fixes and an ABI change Andy Lutomirski
2016-05-03 17:31 ` [PATCH 1/4] signals/sigaltstack: If SS_AUTODISARM, bypass on_sig_stack Andy Lutomirski
2016-05-04  6:32   ` Ingo Molnar
2016-05-04 23:02     ` Andy Lutomirski
2016-05-04  7:12   ` [tip:core/signals] signals/sigaltstack: If SS_AUTODISARM, bypass on_sig_stack() tip-bot for Andy Lutomirski
2016-05-07 14:37   ` [PATCH 1/4] signals/sigaltstack: If SS_AUTODISARM, bypass on_sig_stack Stas Sergeev
2016-05-09  1:32     ` Andy Lutomirski
2016-05-09  2:04       ` Stas Sergeev
2016-05-14  4:18         ` Andy Lutomirski
2016-05-14 11:18           ` Stas Sergeev
2016-05-14 16:35             ` Andy Lutomirski
2016-05-03 17:31 ` [PATCH 2/4] selftests/sigaltstack: Fix the sas test on old kernels Andy Lutomirski
2016-05-04  7:13   ` [tip:core/signals] selftests/sigaltstack: Fix the sigaltstack " tip-bot for Andy Lutomirski
2016-05-07 15:02   ` Stas Sergeev [this message]
2016-05-09  1:32     ` [PATCH 2/4] selftests/sigaltstack: Fix the sas " Andy Lutomirski
2016-05-03 17:31 ` [PATCH 3/4] signals/sigaltstack: Report current flag bits in sigaltstack() Andy Lutomirski
2016-05-04  6:33   ` Ingo Molnar
2016-05-04  7:13   ` [tip:core/signals] " tip-bot for Andy Lutomirski
2016-05-03 17:31 ` [PATCH 4/4] signals/sigaltstack: Change SS_AUTODISARM to (1U << 31) Andy Lutomirski
2016-05-04  7:13   ` [tip:core/signals] " tip-bot for Andy Lutomirski
2016-05-07 15:16   ` [PATCH 4/4] " Stas Sergeev
2016-05-04  6:25 ` [PATCH 0/4] SS_AUTODISARM fixes and an ABI change Ingo Molnar

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=abedee05-5671-7ba7-c256-41e61fb596cb@list.ru \
    --to=stsp@list.ru \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=shuahkh@osg.samsung.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    --cc=xemul@parallels.com \
    /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®