Kernel 3: Virtual memory

Overview

In lecture, we discuss virtual memory.

Full lecture notes on kernelTextbook readings

Isolation can benefit from hardware assistance

How hardware privilege checks are implemented

Virtual memory, abstractly

Faults

Virtual memory for kernel isolation

Virtual memory for process isolation

Virtual memory and kernel execution

x86-64 virtual memory: Addresses

x86-64 virtual memory: Pages

Why pages?

x86-64 virtual memory: Permissions and modes

Eve attacks kernel memory

uint8_t* ip = (uint8_t*) 0x4103c;
   // address of `syscall` from `obj/kernel.sym`
ip[0] = 0xeb;
ip[1] = 0xfe;
(void) sys_getpid();

Kernel fights back!

  1. Changes memory mapping function
  2. Handles the fault

x86-64 page table details

Eve strikes again