9pfs: fix V9fsPath heap buffer overflow
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest6 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | hw/9pfs: add NULL check in v9fs_path_is_ancestor()hw/ | +3 | 0 replies | |
| 2/6 | hw/9pfs: change V9fsPath.size to size_t and v9fs_path_sprintf() return typefsdev/ hw/ hw/ | +14 | 0 replies | |
| 3/6 | hw/9pfs: add error handling to v9fs_fix_path()hw/ | +4 | 0 replies | |
| 4/6 | hw/9pfs: let callers of v9fs_path_sprintf() and v9fs_fix_path() handle errorshw/ hw/ | +29 | 0 replies | |
| 5/6 | tests/qtest/libqos: add qvirtqueue_reset_pool() for descriptor pool resettests/ tests/ | +25 | 1 reply | |
| 6/6 | tests/9pfs: add deep absolute path testtests/ | +69 | 0 replies |
Reviews trailers per patch
1 of 6 patches has a Reviewed-by or Acked-by.
| Patch | Fabiano Rosas |
|---|---|
| 1/6 | |
| 2/6 | |
| 3/6 | |
| 4/6 | |
| 5/6 | A-b |
| 6/6 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/6] 9pfs: fix V9fsPath heap buffer overflow
This series fixes a heap buffer overflow vulnerability in the 9pfs local backend. The vulnerability occurs when handling paths exceeding 65536 bytes, due to the V9fsPath.size field being limited to 16 bits.
The fix consists of:
- Changing V9fsPath.size from uint16_t to size_t.
- Converting v9fs_path_sprintf() to return int for error handling.
- Adding error propagation through all path manipulation functions.
Invididual Patches:
- Patch 1 is just an additional defensive patch.
- Actual fixes are patches 2..4, where patch 2..3 are prepatory, and patch 4 is the actual behaviour fix.
- Patch 5 adds a reset function to the virtio test client for the new test to work.
- Patch 6 adds a new test to guard this buffer overflow issue. It must be enabled explicitly by -m slow for it to run.
More details about this issue:
https://gitlab.com/qemu-project/qemu/-/issues/3358
Christian Schoenebeck (6):
hw/9pfs: add NULL check in v9fs_path_is_ancestor() hw/9pfs: change V9fsPath.size to size_t and v9fs_path_sprintf() return
type
hw/9pfs: add error handling to v9fs_fix_path()
hw/9pfs: let callers of v9fs_path_sprintf() and v9fs_fix_path() handle
errors
tests/qtest/libqos: add qvirtqueue_reset_pool() for descriptor pool
reset
tests/9pfs: add deep absolute path test
fsdev/file-op-9p.h | 2 +- hw/9pfs/9p-local.c | 23 ++++++++---- hw/9pfs/9p.c | 41 +++++++++++++++------ hw/9pfs/9p.h | 4 +-- tests/qtest/libqos/virtio.c | 23 ++++++++++++ tests/qtest/libqos/virtio.h | 2 ++ tests/qtest/virtio-9p-test.c | 69 ++++++++++++++++++++++++++++++++++++ 7 files changed, 144 insertions(+), 20 deletions(-)
Signature · 1 line
2.47.3