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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-158b67b5c5ccda9b909f18028a3cd17185ca1efd@git.kernel.org>
Date:	Wed, 4 May 2016 00:13:07 -0700
From:	tip-bot for Andy Lutomirski <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	luto@...nel.org, shuahkh@....samsung.com,
	akpm@...ux-foundation.org, bp@...en8.de, brgerst@...il.com,
	oleg@...hat.com, peterz@...radead.org, tglx@...utronix.de,
	hpa@...or.com, dvlasenk@...hat.com, torvalds@...ux-foundation.org,
	linux-kernel@...r.kernel.org, mingo@...nel.org,
	luto@...capital.net, xemul@...allels.com, stsp@...t.ru,
	viro@...iv.linux.org.uk
Subject: [tip:core/signals] selftests/sigaltstack: Fix the sigaltstack test
 on old kernels

Commit-ID:  158b67b5c5ccda9b909f18028a3cd17185ca1efd
Gitweb:     http://git.kernel.org/tip/158b67b5c5ccda9b909f18028a3cd17185ca1efd
Author:     Andy Lutomirski <luto@...nel.org>
AuthorDate: Tue, 3 May 2016 10:31:50 -0700
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Wed, 4 May 2016 08:34:13 +0200

selftests/sigaltstack: Fix the sigaltstack test on old kernels

The handling for old kernels was wrong, resulting in a segfault.  Fix it.

Reported-by: Ingo Molnar <mingo@...nel.org>
Signed-off-by: Andy Lutomirski <luto@...nel.org>
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: Stas Sergeev <stsp@...t.ru>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-api@...r.kernel.org
Link: http://lkml.kernel.org/r/f3e739bf435beeaecbd5f038f1359d2eac6d1e63.1462296606.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@...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 57da8bf..a98c3ef 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.
+			 */
+			return 0;
+		} else {
+			perror("[FAIL]\tsigaltstack(SS_ONSTACK | SS_AUTODISARM)");
+			return EXIT_FAILURE;
+		}
 	}
 
 	ustack = mmap(NULL, SIGSTKSZ, PROT_READ | PROT_WRITE,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ