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] [day] [month] [year] [list]
Message-ID: <35d4b9be-3d08-4eaa-8750-7b34ec6e6064@kernel.dk>
Date: Wed, 5 Feb 2025 11:45:24 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Nam Cao <namcao@...utronix.de>,
 Anna-Maria Behnsen <anna-maria@...utronix.de>,
 Frederic Weisbecker <frederic@...nel.org>,
 Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 05/12] io_uring: Use helper function
 hrtimer_update_function()

On 2/5/25 3:55 AM, Nam Cao wrote:
> The field 'function' of struct hrtimer should not be changed directly, as
> the write is lockless and a concurrent timer expiry might end up using the
> wrong function pointer.
> 
> Switch to use hrtimer_update_function() which also performs runtime checks
> that it is safe to modify the callback.
> 
> Signed-off-by: Nam Cao <namcao@...utronix.de>
> Cc: Jens Axboe <axboe@...nel.dk>
> ---
>  io_uring/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index ceacf6230e34..936f8b4106cf 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -2421,7 +2421,7 @@ static enum hrtimer_restart io_cqring_min_timer_wakeup(struct hrtimer *timer)
>  			goto out_wake;
>  	}
>  
> -	iowq->t.function = io_cqring_timer_wakeup;
> +	hrtimer_update_function(&iowq->t, io_cqring_timer_wakeup);
>  	hrtimer_set_expires(timer, iowq->timeout);
>  	return HRTIMER_RESTART;
>  out_wake:

The timer is known expired here, it's inside the callback. Is this
really necessary or useful?

-- 
Jens Axboe


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ