Skip to content

Instantly share code, notes, and snippets.

@sorear
Created March 28, 2024 00:47
Show Gist options
  • Save sorear/2309df7d44b97e27685924e24b4c1e13 to your computer and use it in GitHub Desktop.
Save sorear/2309df7d44b97e27685924e24b4c1e13 to your computer and use it in GitHub Desktop.
arm (V7M), um
user_mode(pt_regs) does not distinguish between user and kernel execution.
alpha, arc, parisc, powerpc (non-PF_KTHREAD), x86 (PF_KTHREAD)
pt_regs is zeroed using a memset call, which is interpreted as kernel mode
by the user_mode macro.
arm (non-V7M), arm64, hexagon, m68k, microblaze, nios2, riscv, s390, sh
The status register in pt_regs is explicitly set to a kernel mode value.
csky, loongarch, mips, mips, sparc (32-bit)
The status register in pt_regs is initialized from the current _hardware_
status register, similar to an interrupt in kernel mode.
openrisc, sparc (64-bit)
pt_regs is zeroed using a memset call, which is interpreted as user mode
by the user_mode macro.
powerpc (PF_KTHREAD)
task_pt_regs returns a NULL pointer for the new thread; user_mode will
fault if called.
x86 (non-PF_KTHREAD)
pt_regs are copied from the current thread, so user mode helpers started
from kthreadd will appear as kernel mode.
xtensa
The status register of the child pt_regs is not initialized; behavior
depends on memory contents returned from the stack allocator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment