nvmet-tcp: Do not WARN on remotely-controlled oversized SGL allocations
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 872d26a391da92ed8f0c0f5cb5fef428067b7f30 · < 9c95f7e66c62ee6c6abedcf1c04311f430ff5833| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
nvmet-tcp: Do not WARN on remotely-controlled oversized SGL allocations
When fuzzing the nvme target code, I tripped a kernel warning in nvmet_tcp_map_data() because the length passed into the allocator is controlled by the remote initiator.
A remote initiator that sends a command with an SGL claiming a huge number, can create a scatterlist and iovec allocation of over 1 million entries, which causes the backing kmalloc call to exceed MAX_PAGE_ORDER and then the page allocator will trip on a WARN_ON_ONCE_GFP() message:
WARNING: mm/page_alloc.c:5280 __alloc_frozen_pages_noprof Workqueue: nvmet_tcp_wq nvmet_tcp_io_work ... sgl_alloc_order nvmet_tcp_map_data nvmet_tcp_try_recv_pdu
As it's never good to trip a kernel warning remotely due to many systems having panic-on-warn enabled, let's silence it by just add GFP_NOWARN to the allocation flags.
From the CVE record · Linux
The Linux kernel's NVMe-over-TCP target can issue a kernel warning when allocating memory for an oversized scatter-gather list. A remote initiator can trigger it by sending a command whose SGL claims a huge number of entries; systems with panic-on-warn enabled may panic. The input does not specify authentication or user-interaction requirements.
Operators of Linux systems running the NVMe-over-TCP target should check their kernel versions; affected versions are not specified.