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: <071c02ae-a74d-46d8-990b-262264b62caf@igalia.com>
Date:   Wed, 9 Aug 2023 19:25:19 -0300
From:   André Almeida <andrealmeid@...lia.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, mingo@...hat.com,
        dvhart@...radead.org, dave@...olabs.net, tglx@...utronix.de,
        axboe@...nel.dk, Andrew Morton <akpm@...ux-foundation.org>,
        urezki@...il.com, hch@...radead.org, lstoakes@...il.com,
        Arnd Bergmann <arnd@...db.de>, linux-api@...r.kernel.org,
        linux-mm@...ck.org, linux-arch@...r.kernel.org,
        malteskarupke@....de, Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: Re: [PATCH v2 05/14] futex: Add sys_futex_wake()

Hi Peter,

Em 07/08/2023 09:18, Peter Zijlstra escreveu:
> To complement sys_futex_waitv() add sys_futex_wake(). This syscall
> implements what was previously known as FUTEX_WAKE_BITSET except it
> uses 'unsigned long' for the bitmask and takes FUTEX2 flags.
> 
> The 'unsigned long' allows FUTEX2_SIZE_U64 on 64bit platforms.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Acked-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> ---

[...]

> +/*
> + * sys_futex_wake - Wake a number of futexes
> + * @uaddr:	Address of the futex(es) to wake
> + * @mask:	bitmask
> + * @nr:		Number of the futexes to wake
> + * @flags:	FUTEX2 flags
> + *
> + * Identical to the traditional FUTEX_WAKE_BITSET op, except it is part of the
> + * futex2 family of calls.
> + */
> +
> +SYSCALL_DEFINE4(futex_wake,
> +		void __user *, uaddr,
> +		unsigned long, mask,
> +		int, nr,
> +		unsigned int, flags)
> +{

Do you think we could have a

	if (!nr)
		return 0;

here? Otherwise, calling futex_wake(&f, 0, flags) will wake 1 futex (if 
available), which is a strange undocumented behavior in my opinion.

> +	if (flags & ~FUTEX2_VALID_MASK)
> +		return -EINVAL;
> +
> +	flags = futex2_to_flags(flags);
> +	if (!futex_flags_valid(flags))
> +		return -EINVAL;
> +
> +	if (!futex_validate_input(flags, mask))
> +		return -EINVAL;
> +
> +	return futex_wake(uaddr, flags, nr, mask);
> +}
> +
>   #ifdef CONFIG_COMPAT
>   COMPAT_SYSCALL_DEFINE2(set_robust_list,
>   		struct compat_robust_list_head __user *, head,
> --- a/kernel/sys_ni.c
> +++ b/kernel/sys_ni.c
> @@ -87,6 +87,7 @@ COND_SYSCALL_COMPAT(set_robust_list);
>   COND_SYSCALL(get_robust_list);
>   COND_SYSCALL_COMPAT(get_robust_list);
>   COND_SYSCALL(futex_waitv);
> +COND_SYSCALL(futex_wake);
>   COND_SYSCALL(kexec_load);
>   COND_SYSCALL_COMPAT(kexec_load);
>   COND_SYSCALL(init_module);
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ