io_uring/kbuf: always use READ_ONCE() to read ring provided buffer lengths
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
io_uring/kbuf: always use READ_ONCE() to read ring provided buffer lengths
Since the buffers are mapped from userspace, it is prudent to use READ_ONCE() to read the value into a local variable, and use that for any other actions taken. Having a stable read of the buffer length avoids worrying about it changing after checking, or being read multiple times.
Similarly, the buffer may well change in between it being picked and being committed. Ensure the looping for incremental ring buffer commit stops if it hits a zero sized buffer, as no further progress can be made at that point.
From the CVE record · Linux
The Linux kernel's io_uring/kbuf code reads buffer lengths from memory mapped by userspace without ensuring a stable value. A local user who changes a buffer length during processing could cause the incremental buffer-commit loop to stop making progress if the length becomes zero.
Operators running Linux kernels with the affected io_uring/kbuf code should check their kernel version against the vendor advisory; affected versions were not provided.