Developer knowledge network · moderated exchange

Społeczność UnreliableCode

Badania programistów, inżynieria wsteczna i społeczność programistów

Knowledge indexNa żywo
4Categories
919Threads
2.8KPosty
Analysis

Page Table Entry (PTE) manipulation: clearing User/Supervisor bit safely

stack_smasher
Kernel Explorer
MEMBER
Rozpustnik: 111
Data dołączenia: Feb 2019
Posty: 30
Dzięki: 18
1 miesięcy temu · Jul 19, 2026 9:46 AM
#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
Rozpustnik: 145
Data dołączenia: Feb 2019
Posty: 26
Dzięki: 45
1 miesięcy temu · Jul 19, 2026 12:19 PM
#2

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

hypervisor_hank
Kernel Wizard
MEMBER
Rozpustnik: 108
Data dołączenia: Feb 2020
Posty: 17
Dzięki: 44
1 miesięcy temu · Jul 19, 2026 10:49 PM
#3

Clean low-level paging architecture breakdown.