CVE-2025-21852: net: Add rx_skb of kfree_skb to raw_tp_null_args[].

Published Mar 12, 2025
·
Updated

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

net: Add rxskb of kfreeskb to rawtpnullargs[].

Yan Zhai reported a BPF prog could trigger a null-ptr-deref [0] in tracekfreeskb if the prog does not check if rxsk is NULL.

Commit c53795d48ee8 ("net: add rxsk to tracekfreeskb") added rxsk to tracekfreeskb, but rxsk is optional and could be NULL.

Let's add kfreeskb to rawtpnullargs[] to let the BPF verifier validate such a prog and prevent the issue.

Now we fail to load such a prog:

libbpf: prog 'drop': -- BEGIN PROG LOAD LOG -- 0: R1=ctx() R10=fp0 ; int BPFPROG(drop, struct skbuff skb, void location, @ kfreeskbsknull.bpf.c:21 0: (79) r3 = (u64 )(r1 +24) func 'kfreeskb' arg3 has btfid 5253 type STRUCT 'sock' 1: R1=ctx() R3w=trustedptrornullsock(id=1) ; bpfprintk("sk: %d, %d\n", sk, sk->skcommon.skcfamily); @ kfreeskbsknull.bpf.c:24 1: (69) r4 = (u16 )(r3 +16) R3 invalid mem access 'trustedptrornull' processed 2 insns (limit 1000000) maxstatesperinsn 0 totalstates 0 peakstates 0 markread 0 -- END PROG LOAD LOG --

Note this fix requires commit 838a10bd2ebf ("bpf: Augment rawtp arguments with PTRMAYBENULL").

[0]: BUG: kernel NULL pointer dereference, address: 0000000000000010 PF: supervisor read access in kernel mode PF: errorcode(0x0000) - not-present page PGD 0 P4D 0 PREEMPT SMP RIP: 0010:bpfprog5e21a6db8fcff1aadrop+0x10/0x2d Call Trace: <TASK> ? die+0x1f/0x60 ? pagefaultoops+0x148/0x420 ? searchbpfextables+0x5b/0x70 ? fixupexception+0x27/0x2c0 ? excpagefault+0x75/0x170 ? asmexcpagefault+0x22/0x30 ? bpfprog5e21a6db8fcff1aadrop+0x10/0x2d bpftracerun4+0x68/0xd0 ? unixstreamconnect+0x1f4/0x6f0 skskbreasondrop+0x90/0x120 unixstreamconnect+0x1f4/0x6f0 sysconnect+0x7f/0xb0 x64sysconnect+0x14/0x20 dosyscall64+0x47/0xc30 entrySYSCALL64afterhwframe+0x4b/0x53

Affected Software

6 affected components
Linux Linux kernel
Linux Linux kernel>=6.11<6.12.17
Linux Linux kernel>=6.13<6.13.5
Linux Linux kernel=6.14-rc1
Linux Linux kernel=6.14-rc2
Linux Linux kernel=6.14-rc3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch 838a10bd2ebf

Event History

Mar 12, 2025
CVE Published
via MITRE·09:42 AM
Data Sourced
via MITRE·09:42 AM
Description
Data Sourced
via NVD·10:15 AM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-21852?

CVE-2025-21852 has been classified as a medium severity vulnerability in the Linux kernel.

2

How do I fix CVE-2025-21852?

To address CVE-2025-21852, update your Linux kernel to the latest version where the vulnerability has been patched.

3

What systems are affected by CVE-2025-21852?

CVE-2025-21852 affects various versions of the Linux kernel where the null pointer dereference occurs in BPF programs.

4

What is the impact of CVE-2025-21852?

The impact of CVE-2025-21852 includes potential denial of service due to the null pointer dereference in the kernel.

5

Who reported CVE-2025-21852?

CVE-2025-21852 was reported by Yan Zhai regarding a possible null pointer dereference in trace_kfree_skb.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203