lkml.org 
[lkml]   [2022]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] selftests/x86/signal: Adjust the test to the kernel's altstack check
From
Date
On 4/1/22 4:10 PM, Chang S. Bae wrote:
> 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.

Mention the option name here and in the Skip message.

>
> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
> Cc: linux-kselftest@vger.kernel.org
> Cc: linux-kernel@vger.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");

Please improve this message to clearly why it is okay to skip the test.
Mention that the option to disallowing insufficient is enabled and that
the test can't be run.


> + return;
> + }
> +
> err(1, "sigaltstack()");
> + }
>
> sigalrm_expected = (size > at_minstack_size) ? true : false;
>
>

With these changes:

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

\
 
 \ /
  Last update: 2022-06-17 00:49    [W:0.101 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site