From: Pavel Begunkov <[email protected]>
To: lizetao <[email protected]>, Jens Axboe <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: [PATCH] io_uring/io-wq: Fix a small time window for reading work->flags
Date: Wed, 15 Jan 2025 12:55:53 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 1/15/25 01:50, lizetao wrote:
> Hi,
>
>> -----Original Message-----
>> From: Pavel Begunkov <[email protected]>
>> Sent: Wednesday, January 15, 2025 12:22 AM
>> To: lizetao <[email protected]>; Jens Axboe <[email protected]>
>> Cc: [email protected]
>> Subject: Re: [PATCH] io_uring/io-wq: Fix a small time window for reading work-
>>> flags
>>
>> On 1/14/25 02:06, lizetao wrote:
>>> There is a small time window that is modified by other tasks after
>>> reading work->flags. It is changed to read before use, which is more
>>
>> Can you elaborate on what races with what? I don't immediately see any race
>> here.
>
> There is such a race context:
>
> worker process
> io_worker_handle_work: IORING_OP_ASYNC_CANCEL
> io_wq_enqueue __io_wq_worker_cancel
> work_flags = atomic_read(&work->flags); // no IO_WQ_WORK_CANCEL
> atomic_or(IO_WQ_WORK_CANCEL, &work->flags);
^^^
That can't happen, the request is not discoverable via iowq yet.
> if (work_flags & IO_WQ_WORK_CANCEL) // false
This check is for requests that came with the flag already set.
--
Pavel Begunkov
prev parent reply other threads:[~2025-01-15 12:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-14 2:06 [PATCH] io_uring/io-wq: Fix a small time window for reading work->flags lizetao
2025-01-14 16:22 ` Pavel Begunkov
2025-01-15 1:50 ` lizetao
2025-01-15 12:55 ` Pavel Begunkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox