-
Notifications
You must be signed in to change notification settings - Fork 12
[LTS 9.2] nvme-tcp: fix potential memory corruption in nvme_tcp_recv_pdu() #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jira VULN-56028 cve CVE-2025-21927 commit-author Maurizio Lombardi <[email protected]> commit ad95bab upstream-diff Removed `nvme_tcp_c2h_term' case from `nvme_tcp_recv_pdu_supported' for the sake of consistency of `nvme_tcp_recv_pdu''s behavior relative to the upstream version, between the cases of proper and improper header. (What could be considered as "`c2h_term' type support" started with 84e0090 commit, not included in `ciqlts9_2''s history, so `nvme_tcp_recv_pdu_supported' in `ciqlts9_2' shouldn't report the `nvme_tcp_c2h_term' type as supported.) nvme_tcp_recv_pdu() doesn't check the validity of the header length. When header digests are enabled, a target might send a packet with an invalid header length (e.g. 255), causing nvme_tcp_verify_hdgst() to access memory outside the allocated area and cause memory corruptions by overwriting it with the calculated digest. Fix this by rejecting packets with an unexpected header length. Fixes: 3f2304f ("nvme-tcp: add NVMe over TCP host driver") Signed-off-by: Maurizio Lombardi <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Keith Busch <[email protected]> (cherry picked from commit ad95bab) Signed-off-by: Marcin Wcisło <[email protected]>
PlaidCat
approved these changes
May 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bmastbergen
approved these changes
May 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥌
This was referenced May 12, 2025
bmastbergen
pushed a commit
to bmastbergen/kernel-src-tree
that referenced
this pull request
Aug 29, 2025
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-427.18.1.el9_4 commit-author Daniel Borkmann <[email protected]> commit cd13c91 Add a big batch of test coverage to assert all aspects of the tcx opts attach, detach and query API: # ./vmtest.sh -- ./test_progs -t tc_opts [...] ctrliq#238 tc_opts_after:OK ctrliq#239 tc_opts_append:OK ctrliq#240 tc_opts_basic:OK ctrliq#241 tc_opts_before:OK ctrliq#242 tc_opts_chain_classic:OK ctrliq#243 tc_opts_demixed:OK ctrliq#244 tc_opts_detach:OK ctrliq#245 tc_opts_detach_after:OK ctrliq#246 tc_opts_detach_before:OK ctrliq#247 tc_opts_dev_cleanup:OK ctrliq#248 tc_opts_invalid:OK ctrliq#249 tc_opts_mixed:OK ctrliq#250 tc_opts_prepend:OK ctrliq#251 tc_opts_replace:OK ctrliq#252 tc_opts_revision:OK Summary: 15/0 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]> (cherry picked from commit cd13c91) Signed-off-by: Jonathan Maple <[email protected]>
bmastbergen
pushed a commit
to bmastbergen/kernel-src-tree
that referenced
this pull request
Aug 29, 2025
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-427.18.1.el9_4 commit-author Daniel Borkmann <[email protected]> commit ccd9a8b Add several new tcx test cases to improve test coverage. This also includes a few new tests with ingress instead of clsact qdisc, to cover the fix from commit dc644b5 ("tcx: Fix splat in ingress_destroy upon tcx_entry_free"). # ./test_progs -t tc [...] ctrliq#234 tc_links_after:OK ctrliq#235 tc_links_append:OK ctrliq#236 tc_links_basic:OK ctrliq#237 tc_links_before:OK ctrliq#238 tc_links_chain_classic:OK ctrliq#239 tc_links_chain_mixed:OK ctrliq#240 tc_links_dev_cleanup:OK ctrliq#241 tc_links_dev_mixed:OK ctrliq#242 tc_links_ingress:OK ctrliq#243 tc_links_invalid:OK ctrliq#244 tc_links_prepend:OK ctrliq#245 tc_links_replace:OK ctrliq#246 tc_links_revision:OK ctrliq#247 tc_opts_after:OK ctrliq#248 tc_opts_append:OK ctrliq#249 tc_opts_basic:OK ctrliq#250 tc_opts_before:OK ctrliq#251 tc_opts_chain_classic:OK ctrliq#252 tc_opts_chain_mixed:OK ctrliq#253 tc_opts_delete_empty:OK ctrliq#254 tc_opts_demixed:OK ctrliq#255 tc_opts_detach:OK ctrliq#256 tc_opts_detach_after:OK ctrliq#257 tc_opts_detach_before:OK ctrliq#258 tc_opts_dev_cleanup:OK ctrliq#259 tc_opts_invalid:OK ctrliq#260 tc_opts_mixed:OK ctrliq#261 tc_opts_prepend:OK ctrliq#262 tc_opts_replace:OK ctrliq#263 tc_opts_revision:OK [...] Summary: 44/38 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/r/8699efc284b75ccdc51ddf7062fa2370330dc6c0.1692029283.git.daniel@iogearbox.net Signed-off-by: Martin KaFai Lau <[email protected]> (cherry picked from commit ccd9a8b) Signed-off-by: Jonathan Maple <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.