Skip to content

arch/x86_64: fix page table levels in pgalloc - #19692

Merged
jerpelea merged 1 commit into
apache:masterfrom
raiden00pl:fix-x86-64-pages
Aug 5, 2026
Merged

arch/x86_64: fix page table levels in pgalloc#19692
jerpelea merged 1 commit into
apache:masterfrom
raiden00pl:fix-x86-64-pages

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

Two level errors corrupted kernel memory when a user process extended its heap with sbrk:

  • PGT_LAST was X86_MMU_PT_LEVELS (4), but valid levels are 0-3, so the final level entry was written with an out-of-range index.

  • x86_64_get_pgtable indexed the PD (level 2) with level 3, installing newly allocated page tables into the wrong PD slot.

Impact

fix for kernel build

Testing

qemu-intel64 kernel build with ostest

Two level errors corrupted kernel memory when a user process extended
its heap with sbrk:

- PGT_LAST was X86_MMU_PT_LEVELS (4), but valid levels are 0-3, so the
  final level entry was written with an out-of-range index.

- x86_64_get_pgtable indexed the PD (level 2) with level 3, installing
  newly allocated page tables into the wrong PD slot.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
@github-actions github-actions Bot added Arch: x86_64 Issues related to the x86_64 architecture Size: XS The size of the change in this PR is very small labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@jerpelea
jerpelea merged commit f43ce8a into apache:master Aug 5, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: x86_64 Issues related to the x86_64 architecture Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants