Skip to content

[LTS 9.4] net: pktgen: fix access outside of user given buffer in pktgen_thread… #380

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
merged 1 commit into from
Jun 30, 2025

Conversation

pvts-mat
Copy link
Contributor

[LTS 9.4]
CVE-2025-38061
VULN-70913

Problem

https://lore.kernel.org/linux-cve-announce/2025061835-CVE-2025-38061-caa2@gregkh/T/#u

In the Linux kernel, the following vulnerability has been resolved:

net: pktgen: fix access outside of user given buffer in pktgen_thread_write()

Honour the user given buffer size for the strn_len() calls (otherwise
strn_len() will access memory outside of the user given buffer).

The Linux kernel CVE team has assigned CVE-2025-38061 to this issue.

Applicability: yes (similar as in #376)

See

len = strn_len(&user_buffer[i], sizeof(name) - 1);
and
len = strn_len(&user_buffer[i], sizeof(f) - 1);

The count argument is ignored in the strn_len() calculation.

The CONFIG_NET_PKTGEN option enabling the affected file net/core/pktgen.c is m for most configuration variants:

$ grep CONFIG_NET_PKTGEN configs/kernel*.config

configs/kernel-aarch64-64k-debug-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-aarch64-64k-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-aarch64-debug-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-aarch64-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-aarch64-rt-debug-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-aarch64-rt-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-ppc64le-debug-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-ppc64le-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-s390x-debug-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-s390x-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-s390x-zfcpdump-rhel.config:# CONFIG_NET_PKTGEN is not set
configs/kernel-x86_64-debug-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-x86_64-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-x86_64-rt-debug-rhel.config:CONFIG_NET_PKTGEN=m
configs/kernel-x86_64-rt-rhel.config:CONFIG_NET_PKTGEN=m

The module itself is called pktgen and is used to generate network packets for testing:

https://www.kernelconfig.io/CONFIG_NET_PKTGEN?q=CONFIG_NET_PKTGEN&kernelversion=5.15.183&arch=x86

This module will inject preconfigured packets, at a configurable
rate, out of a given interface. It is used for network interface
stress testing and performance analysis.

Solution (same as in #376)

Mainline fix in 425e644. Applies to ciqlts9_4 without modifications.

kABI check: passed

DEBUG=1 CVE=CVE-2025-38061 ./ninja.sh _kabi_checked__x86_64--test--ciqlts9_4-CVE-2025-38061

[1/2] Check ABI of kernel [ciqlts9_4-CVE-2025-38061]
++ uname -m
+ python3 /data/src/ctrliq-github/kernel-dist-git-el-9.4/SOURCES/check-kabi -k /data/src/ctrliq-github/kernel-dist-git-el-9.4/SOURCES/Module.kabi_x86_64 -s vms/x86_64--build--ciqlts9_4/build_files/kernel-src-tree-ciqlts9_4-CVE-2025-38061/Module.symvers
kABI check passed
+ touch state/kernels/ciqlts9_4-CVE-2025-38061/x86_64/kabi_checked

Boot test: passed

boot-test.log

Kselftests: passed relative

Coverage

All the network-related tests except the unstable ones.

net/forwarding (except tc_actions.sh, vxlan_bridge_1d_ipv6.sh, ipip_hier_gre_keys.sh, router_bridge_1d_lag.sh, mirror_gre_vlan_bridge_1q.sh, sch_red.sh, dual_vxlan_bridge.sh, tc_police.sh, sch_tbf_ets.sh, sch_tbf_prio.sh, q_in_vni.sh, mirror_gre_bridge_1d_vlan.sh, sch_ets.sh, router_bridge_lag.sh, sch_tbf_root.sh, ip6gre_inner_v6_multipath.sh), net/hsr, net/mptcp (except userspace_pm.sh, simult_flows.sh), net (except srv6_end_flavors_test.sh, fib_nexthops.sh, xfrm_policy.sh, txtimestamp.sh, srv6_end_dt46_l3vpn_test.sh, reuseaddr_conflict, reuseport_addr_any.sh, gro.sh, ip_defrag.sh, srv6_end_dt4_l3vpn_test.sh, udpgro_fwd.sh, srv6_end_dt6_l3vpn_test.sh, udpgso_bench.sh), netfilter (except nft_trans_stress.sh)

Reference

kselftests–ciqlts9_4–run1.log

Patch

kselftests–ciqlts9_4-CVE-2025-38061–run1.log

Comparison

The reference and patch kernel results are the same.

/home/pvts/gtd/projects/conclusive/ciq/rocky-patching/./ktests.xsh diff -d kselftests*.log

Column    File
--------  ----------------------------------------------
Status0   kselftests--ciqlts9_4--run1.log
Status1   kselftests--ciqlts9_4-CVE-2025-38061--run1.log

Specific tests: skipped

…_write()

jira VULN-70913
cve CVE-2025-38061
commit-author Peter Seiderer <[email protected]>
commit 425e644

Honour the user given buffer size for the strn_len() calls (otherwise
strn_len() will access memory outside of the user given buffer).

	Signed-off-by: Peter Seiderer <[email protected]>
	Reviewed-by: Simon Horman <[email protected]>
Link: https://patch.msgid.link/[email protected]
	Signed-off-by: Jakub Kicinski <[email protected]>
(cherry picked from commit 425e644)
	Signed-off-by: Marcin Wcisło <[email protected]>
@pvts-mat pvts-mat changed the title net: pktgen: fix access outside of user given buffer in pktgen_thread… [LTS 9.4] net: pktgen: fix access outside of user given buffer in pktgen_thread… Jun 29, 2025
Copy link
Collaborator

@PlaidCat PlaidCat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Collaborator

@bmastbergen bmastbergen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥌

Copy link

@thefossguy-ciq thefossguy-ciq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚤

@PlaidCat PlaidCat merged commit a7db97d into ctrliq:ciqlts9_4 Jun 30, 2025
4 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants