lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 7 May 2016 18:02:26 +0300
From:	Stas Sergeev <stsp@...t.ru>
To:	Andy Lutomirski <luto@...nel.org>, x86@...nel.org
Cc:	linux-kernel@...r.kernel.org, Borislav Petkov <bp@...en8.de>,
	Al Viro <viro@...iv.linux.org.uk>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andy Lutomirski <luto@...capital.net>,
	Brian Gerst <brgerst@...il.com>,
	Denys Vlasenko <dvlasenk@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Oleg Nesterov <oleg@...hat.com>,
	Pavel Emelyanov <xemul@...allels.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Shuah Khan <shuahkh@....samsung.com>,
	Thomas Gleixner <tglx@...utronix.de>, linux-api@...r.kernel.org
Subject: Re: [PATCH 2/4] selftests/sigaltstack: Fix the sas test on old
 kernels

03.05.2016 20:31, Andy Lutomirski пишет:
> The handling for old kernels was wrong.  Fix it.
>
> Reported-by: Ingo Molnar <mingo@...nel.org>
> Cc: Stas Sergeev <stsp@...t.ru>
> Cc: Al Viro <viro@...iv.linux.org.uk>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Andy Lutomirski <luto@...capital.net>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Brian Gerst <brgerst@...il.com>
> Cc: Denys Vlasenko <dvlasenk@...hat.com>
> Cc: H. Peter Anvin <hpa@...or.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Oleg Nesterov <oleg@...hat.com>
> Cc: Pavel Emelyanov <xemul@...allels.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Shuah Khan <shuahkh@....samsung.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: linux-api@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Andy Lutomirski <luto@...nel.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. :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ