[LTS 9.2] nvme-tcp: fix potential memory corruption in nvme_tcp_recv_pdu() #238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[LTS 9.2]
CVE-2025-21927
VULN-56028
Problem
https://www.cve.org/CVERecord?id=CVE-2025-21927
Analysis and Solution (same as for ciqlts8_8)
Context
NVME (Non-Volatile Memory Express) is a communication protocol designed for accessing high-speed storage media, particularly solid-state drives (SSDs). NVMe over Fabrics (NVMe-oF) is an extension of the NVMe protocol that allows NVMe commands to be sent over a network fabric, enabling remote access to NVMe storage devices.
The "target" mentioned in CVE description is the host providing access to the local NVME device (the server). The host importing the remote NVME device is called simply a "host", or "initiator" (the client). The module implementing NVMe-oF on target's side is
nvmet-tcp
, on the initiator's side it'snvme-tcp
- the subject of this patch.Applicability
All the key options related to NVMe-oF, specifically
CONFIG_NVME_TCP
enabling thenvme-tcp
module, are enabled inciqlts9_2
. Per.config
file created fromconfigs/kernel-x86_64-rhel.config
:Solution
The solution in the mainline kernel is provided in the ad95bab commit. It was not backported to any stable kernel older than 6.12.
Naive cherry-picking results in conflicts with git's attempt to introduce additional functions (
nvme_tcp_tls_configured
,nvme_tcp_queue_tls
) and code branches (nvme_tcp_c2h_term
packet type check in thenvme_tcp_recv_pdu
function) introduced in more recent versions of the module but not related to the bug fix.A small change was made to the
nvme_tcp_recv_pdu_supported
function introduced in the official fix ad95bab for the sake ofnvme_tcp_recv_pdu
's behavior consistency between the scenarios of receiving a packet with a proper and an improper header - the removal of thenvme_tcp_c2h_term
case.Consider the behavior cases in case a packet with a proper header was received:
Then in case a packet with an improper header was received:
Solution
a
is tox
not asb
is toy
, but asc
is toz
, thus thec
,z
pair was chosen.kABI check: passed
Boot test: passed
boot-test.log
Kselftests: passed relative
Methodology
The selftests were source-compiled from the recent
ciqlts9_2
branch (commit f10433c). Thebpf
suite was run from thekernel-selftests-internal
package.The tests were run using an explicit list which omitted certain tests known to give inconsistent results. Details in the src/run-kselftests.sh script of the
rocky-patching
project.Coverage
bpf
(excepttest_kmod.sh
,test_progs
,test_progs-no_alu32
,test_sockmap
),breakpoints
,capabilities
,cgroup
(excepttest_memcontrol
),clone3
,core
,cpu-hotplug
,cpufreq
,drivers/dma-buf
,drivers/net/bonding
,drivers/net/team
,efivarfs
,filesystems/binderfs
,filesystems/epoll
,firmware
,fpu
,ftrace
,futex
,gpio
,intel_pstate
,ipc
,ir
,kcmp
,kexec
,kvm
,landlock
,lib
,livepatch
,membarrier
,memfd
,memory-hotplug
,mincore
,mount
,mqueue
,nci
,net
(exceptreuseaddr_conflict
,udpgso_bench.sh
),net/forwarding
(exceptsch_ets.sh
,sch_red.sh
,sch_tbf_ets.sh
,sch_tbf_prio.sh
,sch_tbf_root.sh
,tc_police.sh
),net/mptcp
,netfilter
(exceptnft_trans_stress.sh
),nsfs
,openat2
,pid_namespace
,pidfd
,proc
(exceptproc-pid-vm
),pstore
,ptrace
,rlimits
,rseq
,rtc
,seccomp
,sgx
,sigaltstack
,size
,splice
,static_keys
,sync
,syscall_user_dispatch
,sysctl
,tc-testing
,tdx
,timens
,timers
(exceptraw_skew
),tmpfs
,tpm2
,user
,vDSO
,vm
,x86
,zram
The coverage for the patch test was a bit narrowed to get rid of inconsequntial results.
Reference
kselftests–ciqlts9_2–run1.log
kselftests–ciqlts9_2–run2.log
kselftests–ciqlts9_2–run3.log
kselftests–ciqlts9_2–run4.log
Patch
kselftests–ciqlts9_2-CVE-2025-21927–run1.log
Comparison
All differences are contained within the reference kernel. The test run for the patched kernel was done in a different batch, with the tests observed to be nondeterministic removed, including those which showed different results for the
ciqlts9_2
reference batch, thus the blank fields in theStatus4
column.Specific tests: suspended
See the situation for #234.