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]
Message-ID: <20240630151808.GA13321@redhat.com>
Date: Sun, 30 Jun 2024 17:18:08 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Dev Jain <dev.jain@....com>
Cc: shuah@...nel.org, mingo@...nel.org, tglx@...utronix.de,
	mark.rutland@....com, ryan.roberts@....com, broonie@...nel.org,
	suzuki.poulose@....com, Anshuman.Khandual@....com,
	DeepakKumar.Mishra@....com, aneesh.kumar@...nel.org,
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] selftests: Add a test mangling with uc_sigmask

I see nothing wrong, but perhaps this test can be simplified?
Feel free to ignore.

Say,

On 06/27, Dev Jain wrote:
>
> +void handler_usr(int signo, siginfo_t *info, void *uc)
> +{
> +	int ret;
> +
> +	/*
> +	 * Break out of infinite recursion caused by raise(SIGUSR1) invoked
> +	 * from inside the handler
> +	 */
> +	++cnt;
> +	if (cnt > 1)
> +		return;
> +
> +	ksft_print_msg("In handler_usr\n");
> +
> +	/* SEGV blocked during handler execution, delivered on return */
> +	if (raise(SIGSEGV))
> +		ksft_exit_fail_perror("raise");
> +
> +	ksft_print_msg("SEGV bypassed successfully\n");

You could simply do sigprocmask(SIG_SETMASK, NULL, &oldset) and check if
SIGSEGV is blocked in oldset. SIG_SETMASK has no effect if newset == NULL.

Likewise,

> +	/*
> +	 * Mangle ucontext; this will be copied back into &current->blocked
> +	 * on return from the handler.
> +	 */
> +	if (sigaddset(&((ucontext_t *)uc)->uc_sigmask, SIGUSR2))
> +		ksft_exit_fail_perror("sigaddset");
> +}

The caller (main) can do the same rather than raise(SIGUSR2).

But again, I won't insist.

Oleg.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ