Linux kernel out-of-bounds access in block I/O iterator fallback
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 |
|
|
7.3.57.4-rc1In the Linux kernel, the following vulnerability has been resolved:
block: restore the iterator when rejecting a misaligned bio
bio_iov_iter_get_pages() can extract some iovecs before encountering a misaligned one. It releases the pages and rejects the entire bio, but leaves the supplied iterator advanced.
An iomap direct-I/O caller may subsequently reexpand the iterator's byte count and fall back to buffered I/O. The reexpanded count then includes bytes before the iterator's current segment, potentially causing iterate_iovec() to read beyond the imported iovec array.
In a reproducer using an initial empty iovec followed by 10-byte and 1015-byte segments, writev() returned 1015 instead of 1025 and KASAN reported an 8-byte read beyond the nine-element iovec allocation. Saving and restoring the iterator on the rejected-bio path makes writev() return 1025 and eliminates the KASAN report.
Restore the entire iterator rather than reverting a byte count: advancing past an empty segment changes its position without consuming any bytes.
Leave successful and partially accepted bio paths unchanged.
From the CVE record · Linux
The Linux kernel can leave an iovec iterator advanced after rejecting a misaligned bio. If an iomap direct-I/O caller then falls back to buffered I/O, it may read beyond the imported iovec array. A local writev() reproducer triggered the read; authentication requirements are not specified.
Engineers running the Linux kernel should check their versions; affected versions are not specified.