Commit 20c0b38
io_uring: Use WRITE_ONCE() when writing to sq_flags
The compiler should be forbidden from any strange optimization for async
writes to user visible data-structures. Without proper protection, the
compiler can cause write-tearing or invent writes that would confuse the
userspace.
However, there are writes to sq_flags which are not protected by
WRITE_ONCE(). Use WRITE_ONCE() for these writes.
This is purely a theoretical issue. Presumably, any compiler is very
unlikely to do such optimizations.
Fixes: 75b28af ("io_uring: allocate the two rings together")
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Nadav Amit <namit@vmware.com>
Link: https://lore.kernel.org/r/20210808001342.964634-3-namit@vmware.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent ef98eb0 commit 20c0b38
1 file changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
1503 | | - | |
| 1503 | + | |
| 1504 | + | |
1504 | 1505 | | |
1505 | 1506 | | |
1506 | 1507 | | |
| |||
1579 | 1580 | | |
1580 | 1581 | | |
1581 | 1582 | | |
1582 | | - | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
1583 | 1586 | | |
1584 | 1587 | | |
1585 | 1588 | | |
| |||
6804 | 6807 | | |
6805 | 6808 | | |
6806 | 6809 | | |
6807 | | - | |
| 6810 | + | |
| 6811 | + | |
6808 | 6812 | | |
6809 | 6813 | | |
6810 | 6814 | | |
6811 | 6815 | | |
6812 | 6816 | | |
6813 | 6817 | | |
6814 | | - | |
| 6818 | + | |
| 6819 | + | |
6815 | 6820 | | |
6816 | 6821 | | |
6817 | 6822 | | |
| |||
0 commit comments