[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220401221014.13556-2-chang.seok.bae@intel.com>
Date: Fri, 1 Apr 2022 15:10:13 -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 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 an 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>
Cc: linux-kselftest@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
---
tools/testing/selftests/x86/sigaltstack.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/x86/sigaltstack.c b/tools/testing/selftests/x86/sigaltstack.c
index f689af75e979..22a88b764a8e 100644
--- a/tools/testing/selftests/x86/sigaltstack.c
+++ b/tools/testing/selftests/x86/sigaltstack.c
@@ -88,8 +88,18 @@ 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)) {
+ /*
+ * The kernel may return ENOMEM when the altstack size
+ * is insufficient. Skip the test in this case.
+ */
+ if (errno == ENOMEM && size < at_minstack_size) {
+ printf("[SKIP]\tThe running kernel disallows an insufficient size.\n");
+ return;
+ }
+
err(1, "sigaltstack()");
+ }
sigalrm_expected = (size > at_minstack_size) ? true : false;
--
2.17.1
Powered by blists - more mailing lists