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]
Date: Fri, 10 May 2024 07:28:41 -0700
From: Bart Van Assche <bvanassche@....org>
To: Breno Leitao <leitao@...ian.org>, Jens Axboe <axboe@...nel.dk>
Cc: paulmck@...nel.org, "open list:BLOCK LAYER"
 <linux-block@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] block: Annotate a racy read in blk_do_io_stat()

On 5/10/24 07:19, Breno Leitao wrote:
> diff --git a/block/blk.h b/block/blk.h
> index d9f584984bc4..57a1d73a0718 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -353,7 +353,8 @@ int blk_dev_init(void);
>    */
>   static inline bool blk_do_io_stat(struct request *rq)
>   {
> -	return (rq->rq_flags & RQF_IO_STAT) && !blk_rq_is_passthrough(rq);
> +	/* Disk stats reading isn’t critical, let it race */
> +	return (data_race(rq->rq_flags) & RQF_IO_STAT) && !blk_rq_is_passthrough(rq);
>   }
>   
>   void update_io_ticks(struct block_device *part, unsigned long now, bool end);

Why to annotate this race with data_race() instead of READ_ONCE()? Are
there any cases in which it is better to use data_race() than
READ_ONCE()?

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ