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  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:   Fri, 8 Jan 2021 19:07:23 +0100
From:   Borislav Petkov <bp@...e.de>
To:     "Chang S. Bae" <chang.seok.bae@...el.com>
Cc:     tglx@...utronix.de, mingo@...nel.org, luto@...nel.org,
        x86@...nel.org, len.brown@...el.com, dave.hansen@...el.com,
        hjl.tools@...il.com, Dave.Martin@....com, jannh@...gle.com,
        mpe@...erman.id.au, tony.luck@...el.com, ravi.v.shankar@...el.com,
        libc-alpha@...rceware.org, linux-arch@...r.kernel.org,
        linux-api@...r.kernel.org, linux-kernel@...r.kernel.org,
        Borislav Petkov <bp@...en8.de>, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v3 4/4] selftest/x86/signal: Include test cases for
 validating sigaltstack

On Tue, Dec 22, 2020 at 05:53:12PM -0800, Chang S. Bae wrote:
> +static int setup_altstack(void *start, unsigned long size)
> +{
> +	stack_t ss;
> +
> +	memset(&ss, 0, sizeof(ss));
> +	ss.ss_size = size;
> +	ss.ss_sp = start;
> +
> +	return sigaltstack(&ss, NULL);
> +}
> +
> +static jmp_buf jmpbuf;
> +
> +static void sigsegv(int sig, siginfo_t *info, void *ctx_void)
> +{
> +	if (sigalrm_expected) {
> +		printf("[FAIL]\tSIGSEGV signal delivery is wrong.\n");

			 	"Wrong signal delivered: SIGSEGV (expected SIGALRM)."

> +		nerrs++;
> +	} else {
> +		printf("[OK]\tSIGSEGV signal is delivered.\n");

					s/is //

> +	}
> +
> +	siglongjmp(jmpbuf, 1);
> +}
> +
> +static void sigalrm(int sig, siginfo_t *info, void *ctx_void)
> +{
> +	if (!sigalrm_expected) {
> +		printf("[FAIL]\tSIGALRM sigal delivery is wrong.\n");

See above.

> +		nerrs++;
> +	} else {
> +		printf("[OK]\tSIGALRM signal is delivered.\n");

Ditto.

> +	}
> +}
> +
> +static void test_sigaltstack(void *altstack, unsigned long size)
> +{
> +	if (setup_altstack(altstack, size))
> +		err(1, "sigaltstack()");
> +
> +	sigalrm_expected = (size > at_minstack_size) ? true : false;
> +
> +	sethandler(SIGSEGV, sigsegv, 0);
> +	sethandler(SIGALRM, sigalrm, SA_ONSTACK);
> +
> +	if (sigsetjmp(jmpbuf, 1) == 0) {

	if (!sigsetjmp...)

> +		printf("[RUN]\tTest an (%s) alternate signal stack\n",

			"Test an alternate signal stack of %ssufficient size.\n"

> +		       sigalrm_expected ? "enough" : "too-small");

					 "" : "in");

> +		printf("\tRaise SIGALRM. %s is expected to be delivered.\n",
> +		       sigalrm_expected ? "It" : "But SIGSEGV");

					"It" : "SIGSEGV"

Drop "But".

Ask if something's not clear.

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imend├Ârffer, HRB 36809, AG N├╝rnberg

Powered by blists - more mailing lists