2019-02-18 11:36:11 +01:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-14 16:46:23 +01:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-18 20:51:45 +08:00
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-29 16:28:19 -07:00
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
2019-04-29 16:28:19 -07:00
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-29 16:28:19 -07:00
|
|
|
|
2019-05-14 14:58:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-29 16:28:19 -07:00
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-29 16:28:19 -07:00
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-25 12:27:36 +00:00
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-24 20:27:10 +02:00
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-18 16:15:59 +03:00
|
|
|
|
2016-09-30 13:51:06 +02:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2018-01-24 20:27:10 +02:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2025-04-03 20:23:56 -03:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
2018-01-24 20:27:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-18 17:21:38 +02:00
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-23 10:35:42 -06:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
nvmet: fix pre-auth out-of-bounds heap read in Discovery Get Log Page
nvmet_execute_disc_get_log_page() validates only the dword alignment
of the host-supplied Log Page Offset (lpo). The 64-bit offset is then
added to a small kzalloc'd buffer that holds the discovery log page
and the result is passed straight to nvmet_copy_to_sgl(), which
memcpy()s data_len bytes out to the host with no source-side bound
check:
u64 offset = nvmet_get_log_page_offset(req->cmd); /* 64-bit host */
size_t data_len = nvmet_get_log_page_len(req->cmd); /* 32-bit host */
...
if (offset & 0x3) { ... } /* only check */
...
alloc_len = sizeof(*hdr) + entry_size * discovery_log_entries(req);
buffer = kzalloc(alloc_len, GFP_KERNEL);
...
status = nvmet_copy_to_sgl(req, 0, buffer + offset, data_len);
The Discovery controller is unauthenticated -- nvmet_host_allowed()
returns true unconditionally for the discovery subsystem -- so the call
is reachable pre-authentication by any TCP/RDMA/FC peer that can reach
the nvmet target. With a discovery log page of ~1 KiB, an attacker
requesting up to 4 KiB starting at offset == alloc_len reads the next
slab page out and gets its content returned over the fabric (an
empirical run on a default nvmet-tcp loopback target leaked 81
canonical kernel pointers in one Get Log Page response). Pointing the
offset at unmapped kernel memory faults the in-kernel memcpy and
crashes (or panics, on panic_on_oops=1) the target host instead.
The attacker-controlled source-side offset pattern
"nvmet_copy_to_sgl(req, 0, buffer + ATTACKER_OFFSET, ...)" is unique
to nvmet_execute_disc_get_log_page in the entire nvmet codebase: every
other Get Log Page handler in admin-cmd.c either ignores lpo (and
silently starts every response at offset 0) or tracks a local
destination offset with a fixed source pointer.
Validate the host-supplied offset against the log page size, cap the
copy length to what is actually available, and zero-fill any remainder
of the host transfer buffer. The zero-fill matches the existing
short-response pattern in nvmet_execute_get_log_changed_ns()
(admin-cmd.c) and prevents leaking transport SGL contents when the
host asks for more bytes than the log page contains.
Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
Cc: stable@vger.kernel.org
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
2026-05-27 15:00:00 -05:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
2021-10-18 17:21:38 +02:00
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
2020-05-19 17:05:59 +03:00
|
|
|
|
2019-10-23 10:35:44 -06:00
|
|
|
|
|
|
|
|
|
2019-10-23 10:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-03 20:57:01 +08:00
|
|
|
|
2019-10-23 10:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
|
|
|
|
|
2021-03-31 14:52:39 +08:00
|
|
|
|
|
|
|
|
|
2024-06-03 20:57:01 +08:00
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
|
|
|
|
|
2021-10-18 17:21:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:39 -08:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2018-01-24 20:27:10 +02:00
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-04 13:59:39 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
nvmet: fix pre-auth out-of-bounds heap read in Discovery Get Log Page
nvmet_execute_disc_get_log_page() validates only the dword alignment
of the host-supplied Log Page Offset (lpo). The 64-bit offset is then
added to a small kzalloc'd buffer that holds the discovery log page
and the result is passed straight to nvmet_copy_to_sgl(), which
memcpy()s data_len bytes out to the host with no source-side bound
check:
u64 offset = nvmet_get_log_page_offset(req->cmd); /* 64-bit host */
size_t data_len = nvmet_get_log_page_len(req->cmd); /* 32-bit host */
...
if (offset & 0x3) { ... } /* only check */
...
alloc_len = sizeof(*hdr) + entry_size * discovery_log_entries(req);
buffer = kzalloc(alloc_len, GFP_KERNEL);
...
status = nvmet_copy_to_sgl(req, 0, buffer + offset, data_len);
The Discovery controller is unauthenticated -- nvmet_host_allowed()
returns true unconditionally for the discovery subsystem -- so the call
is reachable pre-authentication by any TCP/RDMA/FC peer that can reach
the nvmet target. With a discovery log page of ~1 KiB, an attacker
requesting up to 4 KiB starting at offset == alloc_len reads the next
slab page out and gets its content returned over the fabric (an
empirical run on a default nvmet-tcp loopback target leaked 81
canonical kernel pointers in one Get Log Page response). Pointing the
offset at unmapped kernel memory faults the in-kernel memcpy and
crashes (or panics, on panic_on_oops=1) the target host instead.
The attacker-controlled source-side offset pattern
"nvmet_copy_to_sgl(req, 0, buffer + ATTACKER_OFFSET, ...)" is unique
to nvmet_execute_disc_get_log_page in the entire nvmet codebase: every
other Get Log Page handler in admin-cmd.c either ignores lpo (and
silently starts every response at offset 0) or tracks a local
destination offset with a fixed source pointer.
Validate the host-supplied offset against the log page size, cap the
copy length to what is actually available, and zero-fill any remainder
of the host transfer buffer. The zero-fill matches the existing
short-response pattern in nvmet_execute_get_log_changed_ns()
(admin-cmd.c) and prevents leaking transport SGL contents when the
host asks for more bytes than the log page contains.
Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
Cc: stable@vger.kernel.org
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
2026-05-27 15:00:00 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-09 10:03:59 -06:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-10-23 10:35:42 -06:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-19 17:05:59 +03:00
|
|
|
|
2019-10-23 10:35:44 -06:00
|
|
|
|
|
|
|
|
|
2019-10-23 10:35:42 -06:00
|
|
|
|
|
|
|
|
|
2024-06-03 20:57:01 +08:00
|
|
|
|
2019-10-23 10:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-21 16:37:42 -08:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-07 12:23:21 +03:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2021-06-07 12:23:23 +03:00
|
|
|
|
|
|
|
|
|
2019-10-24 09:55:58 -07:00
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2021-09-22 08:35:22 +02:00
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-23 16:40:27 +02:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
2020-06-02 16:15:46 +03:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
nvmet-rdma: support max(16KB, PAGE_SIZE) inline data
The patch enables inline data sizes using up to 4 recv sges, and capping
the size at 16KB or at least 1 page size. So on a 4K page system, up to
16KB is supported, and for a 64K page system 1 page of 64KB is supported.
We avoid > 0 order page allocations for the inline buffers by using
multiple recv sges, one for each page. If the device cannot support
the configured inline data size due to lack of enough recv sges, then
log a warning and reduce the inline size.
Add a new configfs port attribute, called param_inline_data_size,
to allow configuring the size of inline data for a given nvmf port.
The maximum size allowed is still enforced by nvmet-rdma with
NVMET_RDMA_MAX_INLINE_DATA_SIZE, which is now max(16KB, PAGE_SIZE).
And the default size, if not specified via configfs, is still PAGE_SIZE.
This preserves the existing behavior, but allows larger inline sizes
for small page systems. If the configured inline data size exceeds
NVMET_RDMA_MAX_INLINE_DATA_SIZE, a warning is logged and the size is
reduced. If param_inline_data_size is set to 0, then inline data is
disabled for that nvmf port.
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-06-20 07:15:10 -07:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:40 -08:00
|
|
|
|
|
|
|
|
|
2022-08-18 23:00:52 +02:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:38 -08:00
|
|
|
|
|
|
|
|
|
2018-12-12 15:11:37 -08:00
|
|
|
|
2018-11-12 13:56:38 -08:00
|
|
|
|
|
|
|
|
|
2020-05-19 17:05:59 +03:00
|
|
|
|
2019-10-23 10:35:44 -06:00
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:38 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-12 15:11:44 -08:00
|
|
|
|
|
|
|
|
|
2024-06-03 20:57:01 +08:00
|
|
|
|
2018-11-12 13:56:38 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-12 15:11:37 -08:00
|
|
|
|
2018-11-12 13:56:38 -08:00
|
|
|
|
|
|
|
|
|
2020-05-19 17:05:59 +03:00
|
|
|
|
2019-10-23 10:35:44 -06:00
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:38 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-12 15:11:44 -08:00
|
|
|
|
|
|
|
|
|
2024-06-03 20:57:01 +08:00
|
|
|
|
2018-11-12 13:56:38 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-04 13:59:41 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-27 23:21:33 -06:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-27 23:21:02 -06:00
|
|
|
|
|
|
|
|
|
2018-12-12 15:11:44 -08:00
|
|
|
|
|
|
|
|
|
2024-06-03 20:57:01 +08:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:38 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 13:56:35 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2019-10-23 10:35:42 -06:00
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2019-10-23 10:35:42 -06:00
|
|
|
|
|
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
2021-05-10 12:15:36 -07:00
|
|
|
|
2018-12-12 15:11:44 -08:00
|
|
|
|
2024-06-03 20:57:01 +08:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-18 17:21:38 +02:00
|
|
|
|
2019-09-06 19:50:19 +02:00
|
|
|
|
2016-06-21 18:04:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|