CVE-2025-40009

Source
https://cve.org/CVERecord?id=CVE-2025-40009
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40009.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-40009
Downstream
Published
2025-10-20T15:26:55.208Z
Modified
2026-03-10T21:47:04.357343Z
Summary
fs/proc/task_mmu: check p->vec_buf for NULL
Details

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

fs/proc/taskmmu: check p->vecbuf for NULL

When the PAGEMAPSCAN ioctl is invoked with veclen = 0 reaches pagemapscanbackout_range(), kernel panics with null-ptr-deref:

[ 44.936808] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP DEBUGPAGEALLOC KASAN NOPTI [ 44.937797] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 44.938391] CPU: 1 UID: 0 PID: 2480 Comm: reproducer Not tainted 6.17.0-rc6 #22 PREEMPT(none) [ 44.939062] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 [ 44.939935] RIP: 0010:pagemapscanthpentry.isra.0+0x741/0xa80

<snip registers, unreliable trace>

[ 44.946828] Call Trace: [ 44.947030] <TASK> [ 44.949219] pagemapscanpmdentry+0xec/0xfa0 [ 44.952593] walkpmdrange.isra.0+0x302/0x910 [ 44.954069] walkpudrange.isra.0+0x419/0x790 [ 44.954427] walkp4drange+0x41e/0x620 [ 44.954743] walkpgd_range+0x31e/0x630 [ 44.955057] __walkpagerange+0x160/0x670 [ 44.956883] walkpagerangemm+0x408/0x980 [ 44.958677] walkpagerange+0x66/0x90 [ 44.958984] dopagemapscan+0x28d/0x9c0 [ 44.961833] dopagemap_cmd+0x59/0x80 [ 44.962484] __x64sysioctl+0x18d/0x210 [ 44.962804] dosyscall64+0x5b/0x290 [ 44.963111] entrySYSCALL64afterhwframe+0x76/0x7e

veclen = 0 in pagemapscaninitbouncebuffer() means no buffers are allocated and p->vecbuf remains set to NULL.

This breaks an assumption made later in pagemapscanbackoutrange(), that pageregion is always allocated for p->vecbufindex.

Fix it by explicitly checking p->vec_buf for NULL before dereferencing.

Other sites that might run into same deref-issue are already (directly or transitively) protected by checking p->vec_buf.

Note: From PAGEMAPSCAN man page, it seems veclen = 0 is valid when no output is requested and it's only the side effects caller is interested in, hence it passes check in pagemapscanget_args().

This issue was found by syzkaller.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40009.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
52526ca7fdb905a768a93f8faa418e9b988fc34b
Fixed
ca988dcdc6683ecd9de5f525ce469588a9141c21
Fixed
a2cb8818a3d915cd33a1e8b2babc1bb0c34862c3
Fixed
28aa29986dde79e8466bc87569141291053833f5

Affected versions

v6.*
v6.10
v6.10-rc1
v6.10-rc2
v6.10-rc3
v6.10-rc4
v6.10-rc5
v6.10-rc6
v6.10-rc7
v6.11
v6.11-rc1
v6.11-rc2
v6.11-rc3
v6.11-rc4
v6.11-rc5
v6.11-rc6
v6.11-rc7
v6.12
v6.12-rc1
v6.12-rc2
v6.12-rc3
v6.12-rc4
v6.12-rc5
v6.12-rc6
v6.12-rc7
v6.12.1
v6.12.10
v6.12.11
v6.12.12
v6.12.13
v6.12.14
v6.12.15
v6.12.16
v6.12.17
v6.12.18
v6.12.19
v6.12.2
v6.12.20
v6.12.21
v6.12.22
v6.12.23
v6.12.24
v6.12.25
v6.12.26
v6.12.27
v6.12.28
v6.12.29
v6.12.3
v6.12.30
v6.12.31
v6.12.32
v6.12.33
v6.12.34
v6.12.35
v6.12.36
v6.12.37
v6.12.38
v6.12.39
v6.12.4
v6.12.40
v6.12.41
v6.12.42
v6.12.43
v6.12.44
v6.12.45
v6.12.46
v6.12.47
v6.12.48
v6.12.49
v6.12.5
v6.12.6
v6.12.7
v6.12.8
v6.12.9
v6.13
v6.13-rc1
v6.13-rc2
v6.13-rc3
v6.13-rc4
v6.13-rc5
v6.13-rc6
v6.13-rc7
v6.14
v6.14-rc1
v6.14-rc2
v6.14-rc3
v6.14-rc4
v6.14-rc5
v6.14-rc6
v6.14-rc7
v6.15
v6.15-rc1
v6.15-rc2
v6.15-rc3
v6.15-rc4
v6.15-rc5
v6.15-rc6
v6.15-rc7
v6.16
v6.16-rc1
v6.16-rc2
v6.16-rc3
v6.16-rc4
v6.16-rc5
v6.16-rc6
v6.16-rc7
v6.16.1
v6.16.2
v6.16.3
v6.16.4
v6.16.5
v6.16.6
v6.16.7
v6.16.8
v6.16.9
v6.17-rc1
v6.17-rc2
v6.17-rc3
v6.17-rc4
v6.6
v6.6-rc5
v6.6-rc6
v6.6-rc7
v6.7
v6.7-rc1
v6.7-rc2
v6.7-rc3
v6.7-rc4
v6.7-rc5
v6.7-rc6
v6.7-rc7
v6.7-rc8
v6.8
v6.8-rc1
v6.8-rc2
v6.8-rc3
v6.8-rc4
v6.8-rc5
v6.8-rc6
v6.8-rc7
v6.9
v6.9-rc1
v6.9-rc2
v6.9-rc3
v6.9-rc4
v6.9-rc5
v6.9-rc6
v6.9-rc7

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40009.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.12.50
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.16.10

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40009.json"