# CVE-2023-52489: mm/sparsemem: fix race in accessing memory\_section-\>usage

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 4.7
- **CVSS:** 4.7 (v3.1, NVD) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** Yes (see exploit references)
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.23% (percentile 8, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2024-02-29T15:52:08.718Z
- **Modified:** 2026-06-17T06:42:50.697Z

## Who should check

- Anyone running Linux \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 90ad17575d26874287271127d43ef3c2af876cea; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< b448de2459b6d62a53892487ab18b7d823ff0529; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 68ed9e33324021e9d6b798e9db00ca3093d2012a; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 70064241f2229f7ba7b9599a98f68d9142e81a97; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 3a01daace71b521563c38bbbf874e14c3e58adb7; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 5ec8e8ea8b7783fab150cf86404fc38cb4db8800
- Anyone running Linux 5.3

## Description

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

mm/sparsemem: fix race in accessing memory\_section-\>usage

The below race is observed on a PFN which falls into the device memory
region with the system memory configuration where PFN's are such that
\[ZONE\_NORMAL ZONE\_DEVICE ZONE\_NORMAL\].  Since normal zone start and end
pfn contains the device memory PFN's as well, the compaction triggered
will try on the device memory PFN's too though they end up in NOP(because
pfn\_to\_online\_page() returns NULL for ZONE\_DEVICE memory sections).  When
from other core, the section mappings are being removed for the
ZONE\_DEVICE region, that the PFN in question belongs to, on which
compaction is currently being operated is resulting into the kernel crash
with CONFIG\_SPASEMEM\_VMEMAP enabled.  The crash logs can be seen at \[1\].

compact\_zone()			memunmap\_pages
-------------			---------------
\_\_pageblock\_pfn\_to\_page
   ......
 (a)pfn\_valid():
     valid\_section()//return true
			      (b)\_\_remove\_pages()-\>
				  sparse\_remove\_section()-\>
				    section\_deactivate():
				    \[Free the array ms-\>usage and set
				     ms-\>usage = NULL\]
     pfn\_section\_valid()
     \[Access ms-\>usage which
     is NULL\]

NOTE: From the above it can be said that the race is reduced to between
the pfn\_valid()/pfn\_section\_valid() and the section deactivate with
SPASEMEM\_VMEMAP enabled.

The commit b943f045a9af("mm/sparse: fix kernel crash with
pfn\_section\_valid check") tried to address the same problem by clearing
the SECTION\_HAS\_MEM\_MAP with the expectation of valid\_section() returns
false thus ms-\>usage is not accessed.

Fix this issue by the below steps:

a) Clear SECTION\_HAS\_MEM\_MAP before freeing the -\>usage.

b) RCU protected read side critical section will either return NULL
   when SECTION\_HAS\_MEM\_MAP is cleared or can successfully access -\>usage.

c) Free the -\>usage with kfree\_rcu() and set ms-\>usage = NULL.  No
   attempt will be made to access -\>usage after this as the
   SECTION\_HAS\_MEM\_MAP is cleared thus valid\_section() return false.

Thanks to David/Pavan for their inputs on this patch.

\[1\] https://lore.kernel.org/linux-mm/994410bb-89aa-d987-1f50-f514903c55aa@quicinc.com/

On Snapdragon SoC, with the mentioned memory configuration of PFN's as
\[ZONE\_NORMAL ZONE\_DEVICE ZONE\_NORMAL\], we are able to see bunch of
issues daily while testing on a device farm.

For this particular issue below is the log.  Though the below log is
not directly pointing to the pfn\_section\_valid(){ ms-\>usage;}, when we
loaded this dump on T32 lauterbach tool, it is pointing.

\[  540.578056\] Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000000
\[  540.578068\] Mem abort info:
\[  540.578070\]   ESR = 0x0000000096000005
\[  540.578073\]   EC = 0x25: DABT (current EL), IL = 32 bits
\[  540.578077\]   SET = 0, FnV = 0
\[  540.578080\]   EA = 0, S1PTW = 0
\[  540.578082\]   FSC = 0x05: level 1 translation fault
\[  540.578085\] Data abort info:
\[  540.578086\]   ISV = 0, ISS = 0x00000005
\[  540.578088\]   CM = 0, WnR = 0
\[  540.579431\] pstate: 82400005 (Nzcv daif +PAN -UAO +TCO -DIT -SSBSBTYPE=--)
\[  540.579436\] pc : \_\_pageblock\_pfn\_to\_page+0x6c/0x14c
\[  540.579454\] lr : compact\_zone+0x994/0x1058
\[  540.579460\] sp : ffffffc03579b510
\[  540.579463\] x29: ffffffc03579b510 x28: 0000000000235800 x27:000000000000000c
\[  540.579470\] x26: 0000000000235c00 x25: 0000000000000068 x24:ffffffc03579b640
\[  540.579477\] x23: 0000000000000001 x22: ffffffc03579b660 x21:0000000000000000
\[  540.579483\] x20: 0000000000235bff x19: ffffffdebf7e3940 x18:ffffffdebf66d140
\[  540.579489\] x17: 00000000739ba063 x16: 00000000739ba063 x15:00000000009f4bff
\[  540.579495\] x14: 0000008000000000 x13: 0000000000000000 x12:0000000000000001
\[  540.579501\] x11: 0000000000000000 x10: 0000000000000000 x9 :ffffff897d2cd440
\[  540.579507\] x8 : 0000000000000000 x7 : 0000000000000000 x6 :ffffffc03579b5b4
\[  540.579512\] x5 : 0000000000027f25 x4 : ffffffc03579b5b8 x3 :0000000000000
---truncated---

## Affected and fixed versions

- Linux: \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 90ad17575d26874287271127d43ef3c2af876cea; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< b448de2459b6d62a53892487ab18b7d823ff0529; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 68ed9e33324021e9d6b798e9db00ca3093d2012a; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 70064241f2229f7ba7b9599a98f68d9142e81a97; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 3a01daace71b521563c38bbbf874e14c3e58adb7; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 5ec8e8ea8b7783fab150cf86404fc38cb4db8800 (cvelist)
- Linux: 5.3 (cvelist)

## Mitigation

- Upgrade Linux to 5ec8e8ea8b7783fab150cf86404fc38cb4db8800 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-52489. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-52489.md
Affected: Linux >= f46edbd1b1516da1fb34c917775168d5df576f78, < 90ad17575d26874287271127d43ef3c2af876cea; >= f46edbd1b1516da1fb34c917775168d5df576f78, < b448de2459b6d62a53892487ab18b7d823ff0529; >= f46edbd1b1516da1fb34c917775168d5df576f78, < 68ed9e33324021e9d6b798e9db00ca3093d2012a; >= f46edbd1b1516da1fb34c91…
Fixed in: Linux 90ad17575d26874287271127d43ef3c2af876cea, Linux 68ed9e33324021e9d6b798e9db00ca3093d2012a, Linux 70064241f2229f7ba7b9599a98f68d9142e81a97, Linux 3a01daace71b521563c38bbbf874e14c3e58adb7, Linux 5ec8e8ea8b7783fab150cf86404fc38cb4db8800

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-52489 being exploited?

There is no confirmed exploitation: CVE-2023-52489 is not in the CISA Known Exploited Vulnerabilities catalog. Public exploit code or a proof of concept is available. EPSS estimates a 0.23% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-52489?

Medium: CVSS 4.7 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2023-52489?

Linux \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 90ad17575d26874287271127d43ef3c2af876cea; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< b448de2459b6d62a53892487ab18b7d823ff0529; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 68ed9e33324021e9d6b798e9db00ca3093d2012a; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 70064241f2229f7ba7b9599a98f68d9142e81a97; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 3a01daace71b521563c38bbbf874e14c3e58adb7; \>= f46edbd1b1516da1fb34c917775168d5df576f78, \< 5ec8e8ea8b7783fab150cf86404fc38cb4db8800; Linux 5.3.

### Is there a fix for CVE-2023-52489?

Yes. Fixed in Linux 90ad17575d26874287271127d43ef3c2af876cea, Linux 68ed9e33324021e9d6b798e9db00ca3093d2012a, Linux 70064241f2229f7ba7b9599a98f68d9142e81a97, Linux 3a01daace71b521563c38bbbf874e14c3e58adb7, Linux 5ec8e8ea8b7783fab150cf86404fc38cb4db8800. Upgrade Linux to 5ec8e8ea8b7783fab150cf86404fc38cb4db8800 or later.

### How do I check if I'm affected by CVE-2023-52489?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- exploit: <https://git.kernel.org/stable/c/90ad17575d26874287271127d43ef3c2af876cea>
- exploit: <https://git.kernel.org/stable/c/b448de2459b6d62a53892487ab18b7d823ff0529>
- exploit: <https://git.kernel.org/stable/c/68ed9e33324021e9d6b798e9db00ca3093d2012a>
- exploit: <https://git.kernel.org/stable/c/70064241f2229f7ba7b9599a98f68d9142e81a97>
- exploit: <https://git.kernel.org/stable/c/3a01daace71b521563c38bbbf874e14c3e58adb7>
- exploit: <https://git.kernel.org/stable/c/5ec8e8ea8b7783fab150cf86404fc38cb4db8800>
- other: <https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-52489>

HTML: <https://flawdb.com/CVE-2023-52489> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-52489>
