Re: Race in block/blk-mq-sched.c blk_mq_sched_dispatch_requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/17/24 12:17, Jens Axboe wrote:
On 1/17/24 1:16 PM, Gabriel Ryan wrote:
We found a race in the block message queue for kernel v5.18-rc5 using
a race testing tool we are developing. We are reporting this race
because it appears to be potentially harmful. The race occurs in

block/blk-mq-sched.c:333 blk_mq_sched_dispatch_requests

     hctx->run++;

where multiple threads can schedule dispatch requests and increment
the request counter htctx->run simultaneously. This appears to lead to
undefined behavior where multiple conflicting updates to the hctx->run
value could result in it not matching the number of requests that
have been scheduled with calls to blk_mq_sched_dispatch_requests.

I suggest you take a closer look at how that variable is actually
used.

It's probably a good idea to explain this in a comment above the
code that increments hctx->runs because others may also be wondering
what the impact is of concurrent hctx->runs increments.

Thanks,

Bart.






[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux