Developer knowledge network · moderated exchange

UnreliableCode コミュニティ

開発者リサーチ、リバース エンジニアリング、コーディング コミュニティ

Analysis

Page Table Entry (PTE) manipulation: clearing User/Supervisor bit safely [v2.4 Technical Discussion]

stack_smasher
Kernel Explorer
MEMBER
担当者: 111
参加日: Feb 2019
投稿: 30
ありがとう: 18
1 か月前 · Jul 16, 2026 10:06 PM
#1

How Page Table Entries (PTEs) govern CPU access permissions:

  • Bit 0 (Present): Page is in physical RAM.
  • Bit 1 (Read/Write): 0 = Read-Only, 1 = Read/Write.
  • Bit 2 (User/Supervisor): 0 = Ring 0 only, 1 = Accessible from Ring 3 (Userland).
  • Bit 63 (NX / XD): No-Execute bit.

Modifying the User/Supervisor bit in a kernel page PTE allows userland code to access kernel buffers directly without syscall overhead. Always invalidate the TLB entry with __invlpg() after modifying PTE bits!

kernel_komrade
Driver Dev
MEMBER
担当者: 145
参加日: Feb 2019
投稿: 26
ありがとう: 45
1 か月前 · Jul 17, 2026 12:49 AM
#2

Forgetting __invlpg() causes the CPU to use stale cached TLB translation entries and crash. Essential rule.

hypervisor_hank
Kernel Wizard
MEMBER
担当者: 108
参加日: Feb 2020
投稿: 17
ありがとう: 44
1 か月前 · Jul 17, 2026 9:13 AM
#3

Clean low-level paging architecture breakdown.