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:   Mon, 11 Jul 2022 10:03:29 -0700
From:   "Chang S. Bae" <chang.seok.bae@...el.com>
To:     linux-kselftest@...r.kernel.org, shuah@...nel.org,
        linux-kernel@...r.kernel.org
Cc:     dave.hansen@...ux.intel.com, tglx@...utronix.de, bp@...e.de,
        chang.seok.bae@...el.com
Subject: [PATCH v2 1/2] selftests/x86/signal: Adjust the test to the kernel's altstack check

The test assumes an insufficient altstack is allowed. Then it raises a
signal to test the delivery failure due to an altstack overflow.

The kernel now provides the STRICT_SIGALTSTACK_SIZE option to tweak
sigaltstack()'s sanity check to prevent an insufficient altstack. ENOMEM is
returned on the check failure.

Adjust the code to skip the test when this option is on.

Signed-off-by: Chang S. Bae <chang.seok.bae@...el.com>
Reviewed-by: Shuah Khan <skhan@...uxfoundation.org>
Cc: linux-kselftest@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
---
Changes from v1:
* Call out the config name (Shuah Khan).
* Massage the print message (Shuah Khan).
---
 tools/testing/selftests/x86/sigaltstack.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/x86/sigaltstack.c b/tools/testing/selftests/x86/sigaltstack.c
index f689af75e979..0e9842e69ca4 100644
--- a/tools/testing/selftests/x86/sigaltstack.c
+++ b/tools/testing/selftests/x86/sigaltstack.c
@@ -88,8 +88,20 @@ static void sigalrm(int sig, siginfo_t *info, void *ctx_void)
 
 static void test_sigaltstack(void *altstack, unsigned long size)
 {
-	if (setup_altstack(altstack, size))
+	if (setup_altstack(altstack, size)) {
+		/*
+		 * If the kernel rejects an insufficient altstack with
+		 * ENOMEM, then skip the test.
+		 */
+		if (errno == ENOMEM && size < at_minstack_size) {
+			printf("[SKIP]\tThe running kernel disallows an insufficient altstack with "
+			       "the STRICT_SIGALTSTACK_SIZE option. As the altstack was already "
+			       "measured, the overflow test is not needed.\n");
+			return;
+		}
+
 		err(1, "sigaltstack()");
+	}
 
 	sigalrm_expected = (size > at_minstack_size) ? true : false;
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ