Look up another CVE · open CVE-2024-40918 in the interactive tracker
CVE-2024-40918
parisc: Try to fix random segmentation faults in package builds
Published 2024-07-12 (2 years ago) by the Linux kernel CNA. Subsystem arch/parisc. Debian urgency: unimportant.
What to do, per Debian release
Debian's own status for CVE-2024-40918 in every release this site tracks, and what each one means in practice. Every status below is the one the Debian Security Team publishes for this CVE. source
| Release | Status | Version | What this means |
|---|---|---|---|
| Debian 12bookworm | vulnerable | 6.1.190-1 | No fix published anywhere yet, neither in Debian nor upstream for the series bookworm tracks. Watch the Debian tracker page for this CVE. Advisories for bookworm have historically landed a median of 23 days after publication. |
| Debian 13trixie | fixed | 6.9.7-1 | Update the kernel and reboot. Fixed in 6.9.7-1. A running kernel keeps the old code until the machine restarts. |
| Debian 14forky | fixed | 6.9.7-1 | Update the kernel and reboot. Fixed in 6.9.7-1. A running kernel keeps the old code until the machine restarts. |
| Debian unstablesid | fixed | 6.9.7-1 | Update the kernel and reboot. Fixed in 6.9.7-1. A running kernel keeps the old code until the machine restarts. |
The vulnerability
What the bug is
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---
Where it lives
The fix touches these files. If the subsystem is one you do not use, the practical exposure is lower, though the package is still the vulnerable one.
arch/parisc/include/asm/cacheflush.h
arch/parisc/include/asm/pgtable.h
arch/parisc/kernel/cache.c
- What this is
- PARISC ARCHITECTUREMAINTAINERS section matched on arch/parisc/ · linux-parisc@vger.kernel.org · Maintained
Show whether Debian builds this, per release
Debian builds this code. Every release below compiles the affected file into the kernels it ships.
- bookworm, trixie, forky, sidy
- y
- built into the kernel image on every flavour - only a patch removes it
From the configuration Debian publishes for every kernel flavour it builds. It covers only the architectures Debian ships a linux-config package for, and nothing about a kernel you built yourself. Debian's own status above stays authoritative about the source package.MAINTAINERS Debian linux-config packages
Signals
- Published
- 2024-07-12 (2 years ago)source
- CVSS
- 7.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:Hsource recompute it - Attack vector
- local (AV:L)source
- EPSS
- 0.29%, higher than 20.7% of all CVEssource
- CISA KEV
- not listedthe KEV catalogue
- Debian urgency
- unimportantsource
- Subsystem
- arch/parisc
Upstream fixes
The versions the CNA records as introducing and fixing this, and the commit for each. source
| Introduced | Fixed in | Commit |
|---|---|---|
| 5.18 | 6.6.35 | 5bf196f1936b |
| 5.18 | 6.9.6 | d66f2607d89f |
| 5.18 | 6.10 | 72d95924ee35 |
Why the CNA scored it this way
Quoted from the kernel CNA's own scoring file, word for word. A highlighted metric carries the most severe value CVSS v3.1 defines for it, which is what pushes the score up. source
- AV:LAttack vector, local
- The faulty cache-flush primitives are driven by memory-management operations (COW faults, munmap, mremap, reclaim, ptrace) that require local execution on the affected parisc system. There is no remote protocol path that reaches the arch cache code directly.
- AC:LAttack complexity, low
- An unprivileged local process reliably triggers stale-cache-line corruption simply by running a heavy mmap/fork/COW workload — the commit reports ordinary package builds hitting it routinely — and a multi-threaded attacker controls both sides of the racy PTE check plus physical page-frame reuse via standard page-spray grooming.
- PR:LPrivileges required, low
- Only an ordinary unprivileged local account is needed; the vulnerable paths (wp_page_copy, try_to_unmap, mremap, userfaultfd, ptrace) are reachable with no capability whatsoever.
- UI:NUser interaction, none
- The attacker's own memory workload triggers the missed flushes; no action by any other user or victim process is required.
- S:UScope, unchanged
- The corruption occurs within the kernel's own memory management on the same host, which is the standard unchanged-scope case for kernel memory-corruption issues.
- C:HConfidentiality impact, high
- Stale cache lines survive across page-frame reuse, so data belonging to a previously-mapped page — another process's memory, page cache contents, or kernel data — can be read through the new owner's alias, giving cross-boundary disclosure of arbitrary physical memory contents.
- I:HIntegrity impact, high
- Unflushed dirty lines for a freed page are written back over whatever now occupies that frame, silently corrupting other processes' memory, the page cache, slab objects, and kernel structures including page tables — an arbitrary-write primitive suitable for privilege escalation.
- A:HAvailability impact, high
- The documented effect is random segmentation faults and memory corruption; when the corrupted frame holds kernel data the result is an oops or panic, and the commit describes cache incoherency severe enough to produce hardware lockups.