# CVE-2024-40918: parisc: Try to fix random segmentation faults in package builds

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

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.33% (percentile 19, 2026-11-26)
- **Published:** 2024-07-12T12:25:00.846Z
- **Modified:** 2026-08-05T11:33:59.904Z

## Who should check

- Anyone running Linux \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< 5bf196f1936bf93df31112fbdfb78c03537c07b0; \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< d66f2607d89f760cdffed88b22f309c895a2af20; \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< 72d95924ee35c8cd16ef52f912483ee938a34d49
- Anyone running Linux 5.18

## Description

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

parisc: Try to fix random segmentation faults in package builds

PA-RISC systems with PA8800 and PA8900 processors have had problems
with random segmentation faults for many years.  Systems with earlier
processors are much more stable.

Systems with PA8800 and PA8900 processors have a large L2 cache which
needs per page flushing for decent performance when a large range is
flushed. The combined cache in these systems is also more sensitive to
non-equivalent aliases than the caches in earlier systems.

The majority of random segmentation faults that I have looked at
appear to be memory corruption in memory allocated using mmap and
malloc.

My first attempt at fixing the random faults didn't work. On
reviewing the cache code, I realized that there were two issues
which the existing code didn't handle correctly. Both relate
to cache move-in. Another issue is that the present bit in PTEs
is racy.

1) PA-RISC caches have a mind of their own and they can speculatively
load data and instructions for a page as long as there is a entry in
the TLB for the page which allows move-in. TLBs are local to each
CPU. Thus, the TLB entry for a page must be purged before flushing
the page. This is particularly important on SMP systems.

In some of the flush routines, the flush routine would be called
and then the TLB entry would be purged. This was because the flush
routine needed the TLB entry to do the flush.

2) My initial approach to trying the fix the random faults was to
try and use flush\_cache\_page\_if\_present for all flush operations.
This actually made things worse and led to a couple of hardware
lockups. It finally dawned on me that some lines weren't being
flushed because the pte check code was racy. This resulted in
random inequivalent mappings to physical pages.

The \_\_flush\_cache\_page tmpalias flush sets up its own TLB entry
and it doesn't need the existing TLB entry. As long as we can find
the pte pointer for the vm page, we can get the pfn and physical
address of the page. We can also purge the TLB entry for the page
before doing the flush. Further, \_\_flush\_cache\_page uses a special
TLB entry that inhibits cache move-in.

When switching page mappings, we need to ensure that lines are
removed from the cache.  It is not sufficient to just flush the
lines to memory as they may come back.

This made it clear that we needed to implement all the required
flush operations using tmpalias routines. This includes flushes
for user and kernel pages.

After modifying the code to use tmpalias flushes, it became clear
that the random segmentation faults were not fully resolved. The
frequency of faults was worse on systems with a 64 MB L2 (PA8900)
and systems with more CPUs (rp4440).

The warning that I added to flush\_cache\_page\_if\_present to detect
pages that couldn't be flushed triggered frequently on some systems.

Helge and I looked at the pages that couldn't be flushed and found
that the PTE was either cleared or for a swap page. Ignoring pages
that were swapped out seemed okay but pages with cleared PTEs seemed
problematic.

I looked at routines related to pte\_clear and noticed ptep\_clear\_flush.
The default implementation just flushes the TLB entry. However, it was
obvious that on parisc we need to flush the cache page as well. If
we don't flush the cache page, stale lines will be left in the cache
and cause random corruption. Once a PTE is cleared, there is no way
to find the physical address associated with the PTE and flush the
associated page at a later time.

I implemented an updated change with a parisc specific version of
ptep\_clear\_flush. It fixed the random data corruption on Helge's rp4440
and rp3440, as well as on my c8000.

At this point, I realized that I could restore the code where we only
flush in flush\_cache\_page\_if\_present if the page has been accessed.
However, for this, we also need to flush the cache when the accessed
bit is cleared in
---truncated---

## Affected and fixed versions

- Linux: \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< 5bf196f1936bf93df31112fbdfb78c03537c07b0; \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< d66f2607d89f760cdffed88b22f309c895a2af20; \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< 72d95924ee35c8cd16ef52f912483ee938a34d49 (cvelist)
- Linux: 5.18 (cvelist)

## Mitigation

- Upgrade Linux to 72d95924ee35c8cd16ef52f912483ee938a34d49 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2024-40918.md
Affected: Linux >= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, < 5bf196f1936bf93df31112fbdfb78c03537c07b0; >= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, < d66f2607d89f760cdffed88b22f309c895a2af20; >= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, < 72d95924ee35c8cd16ef52f912483ee938a34d49; Linux 5.18
Fixed in: Linux 5bf196f1936bf93df31112fbdfb78c03537c07b0, Linux 72d95924ee35c8cd16ef52f912483ee938a34d49

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-2024-40918 being exploited?

There is no confirmed exploitation: CVE-2024-40918 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.33% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-40918?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-40918?

Linux \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< 5bf196f1936bf93df31112fbdfb78c03537c07b0; \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< d66f2607d89f760cdffed88b22f309c895a2af20; \>= 2de8b4cc2051ee1d40eedbcf94de0e7d04507c37, \< 72d95924ee35c8cd16ef52f912483ee938a34d49; Linux 5.18.

### Is there a fix for CVE-2024-40918?

Yes. Fixed in Linux 5bf196f1936bf93df31112fbdfb78c03537c07b0, Linux 72d95924ee35c8cd16ef52f912483ee938a34d49. Upgrade Linux to 72d95924ee35c8cd16ef52f912483ee938a34d49 or later.

### How do I check if I'm affected by CVE-2024-40918?

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

- patch: <https://git.kernel.org/stable/c/5bf196f1936bf93df31112fbdfb78c03537c07b0>
- patch: <https://git.kernel.org/stable/c/d66f2607d89f760cdffed88b22f309c895a2af20>
- patch: <https://git.kernel.org/stable/c/72d95924ee35c8cd16ef52f912483ee938a34d49>

## 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-2024-40918>

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