3

I literally don't understand the purpose of a "higher half kernel"

What does it matter where my kernel is mapped in virtual memory?
"It is traditional and generally good to have your kernel mapped in every user process" what the hell does that even mean??

Mapping my kernel into userspace is something is explicitely don't want to do. Like at all. Ever

And in physical memory it matters even less where it is.

I'm so confused right now

Comments
  • 2
    Wow what a pleb.
  • 6
    You don't have a choice here, as all major kernels do this.
    However, rather than being directly mapped into US, kernel is still protected by kernel mode but is part of the same context.
    This limits context switching on system calls, which raises performance quite a lot.
    Eg, the linux kernel implement's this in 2 modes.

    3:1 mode:
    This is the default mode.
    Here the kernel is part of every process context.
    No full context switch has to be performed on syscall.
    However this makes the system vulnerable to meltdown/specter/...

    4:4 mode:
    The kernel runs in it's own context.
    A full context switch has to be performed on syscalls.
    Lowers performance by around 1/3.
    Largely safe against speculative execution attacks.
  • 0
    Okay that makes sense. That's probably what the Superuser/User bit in the page table is for...

    Do you know if seperate PCIDs for kernel and userspace would also fix meltdown, etc. without requiring a full context switch? (i.e. only flushing kernel pages from the TLB on syscall return)
Add Comment