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: <20230725151909.GT4253@hirez.programming.kicks-ass.net>
Date:   Tue, 25 Jul 2023 17:19:09 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Jens Axboe <axboe@...nel.dk>
Cc:     io-uring@...r.kernel.org, linux-kernel@...r.kernel.org,
        andres@...razel.de
Subject: Re: [PATCH 06/10] io_uring: add support for futex wake and wait

On Tue, Jul 25, 2023 at 07:57:28AM -0600, Jens Axboe wrote:

> Something like the below - totally untested, but just to show what I
> mean. Will need to get split and folded into the two separate patches.
> Will test and fold them later today.
> 
> 
> diff --git a/io_uring/futex.c b/io_uring/futex.c
> index 4c9f2c841b98..b0f90154d974 100644
> --- a/io_uring/futex.c
> +++ b/io_uring/futex.c
> @@ -168,7 +168,7 @@ bool io_futex_remove_all(struct io_ring_ctx *ctx, struct task_struct *task,
>  	return found;
>  }
>  
> -int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
> +static int __io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>  {
>  	struct io_futex *iof = io_kiocb_to_cmd(req, struct io_futex);
>  	u32 flags;
> @@ -179,9 +179,6 @@ int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>  	iof->uaddr = u64_to_user_ptr(READ_ONCE(sqe->addr));
>  	iof->futex_val = READ_ONCE(sqe->addr2);
>  	iof->futex_mask = READ_ONCE(sqe->addr3);
> -	iof->futex_nr = READ_ONCE(sqe->len);
> -	if (iof->futex_nr && req->opcode != IORING_OP_FUTEX_WAITV)
> -		return -EINVAL;
>  
>  	flags = READ_ONCE(sqe->futex_flags);
>  	if (flags & ~FUTEX2_MASK)
> @@ -191,14 +188,36 @@ int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>  	if (!futex_flags_valid(iof->futex_flags))
>  		return -EINVAL;
>  
> -	if (!futex_validate_input(iof->futex_flags, iof->futex_val) ||
> -	    !futex_validate_input(iof->futex_flags, iof->futex_mask))
> +	if (!futex_validate_input(iof->futex_flags, iof->futex_mask))
>  		return -EINVAL;
>  
> -	iof->futexv_owned = 0;
>  	return 0;
>  }

I think you can/should split more into io_futex_prep(), specifically
waitv should also have zero @val and @mask.

But yes, something like this makes sense.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ