1. 25 Oct, 2016 20 commits
    • Charles Jacobsen's avatar
    • Charlie Jacobsen's avatar
      Separated lcd into container and thread objects. · dbc4e40c
      Charlie Jacobsen authored
      Updated code. Removed gdt/tss/idt for now. Added doc directory
      and some initial doc.
    • Charlie Jacobsen's avatar
      Basic lcd module create, run, and destroy. · e0193fa4
      Charlie Jacobsen authored
      This code is ugly, but it's working.
      Tested with basic module, and appears to be working
      properly. I will soon incorporate the patched
      modprobe into the kernel tree, and then this code
      will be usable by everyone.
      The ipc code is still unimplemented. The only
      hypercall handled is yield. Also note that other
      exit conditions (e.g. external interrupt) have not
      been fully tested.
      -- kernel code calls lcd_create_as_module with
         the module's name
      -- lcd_create_as_module loads the module using
         request_lcd_module (request_lcd_module calls
         the patched modprobe to load the module, and
         the patched modprobe calls back into the lcd
         driver via the ioctrl interface to load the
      -- lcd_create_as_module then finds the loaded
         module, spawns a kernel thread and passes off
         the module to it
      -- the kernel thread initializes the lcd and
         maps the module inside it, then suspends itself
      -- lcd_run_as_module wakes up the kernel thread
         and tells it to run
      -- lcd_delete_as_module stops the kernel thread
         and deletes the module from the host kernel
      File-by-file details:
      -- lcd was not running in 64-bit mode, and my
         checks had one subtle bug
      -- fixed %cr3 load to properly load vmcs first
      -- fixed set program counter to use guest virtual
         rather than guest physical address
      -- added struct lcd to task_struct
      -- lcd pointer set to null when task_struct is
      -- made init_module and delete_module system calls
         callable from kernel code
      -- available in module.h via do_sys_init_module and
      -- simply moved the majority of the guts of the
         system calls into a non-system call, exported
      -- take an extra flag, for_lcd; when set, the init
         code skips over running (and deallocating) the
         module's init code, and the delete code skips
         over running the module exit
      -- system calls from user code set for_lcd = 0; this
         ensures existing code still works
      -- changed __request_module to __do_request_module; takes
         one extra argument, for_lcd
      -- __request_module   ==>  __do_request_module with for_lcd = 0
      -- request_lcd_module ==>  __do_request_module with for_lcd = 1
      -- call_modprobe conditionally uses lcd_modprobe_path, the path
         to a patched modprobe accessible via sysfs
      -- added lcd status enum; see source code doc
      -- three routines for creating/running/destroying
         lcd's that use modules; see source code doc
      -- added interface defns for patched modprobe to call into
         lcd driver for module init; lcd driver loads
         module (via slightly refactored module.c code) on behalf
         of modprobe
      -- implementation of routines for modules inside lcd's
      -- implementation of module init / delete for lcd's
         (uses patched module.c code)
      -- added test module for lcd module code
      -- test runs automatically when lcd module is inserted
    • Charles Jacobsen's avatar
      Simple blob successfully runs and returns in vmx. · c4fc774c
      Charles Jacobsen authored
      In the process of debugging, major corrections and
      debug checks implemented (this is a big squash):
      -- coded up entry checks documented in Intel SDM
         V3 chp 26 (this should help later if settings
         are changed, make it less risky to experiment
         and give more confidence)
      -- fixed host tr base addr bug (the worst bug! caused
         system to hang and then crash, since the tss
         was erroneous...)
      -- fixed vmx_entry to properly set host rsp before
      -- setting host sysenter and idt info
      -- fixed cs ar bytes bug
      -- fixed gdt limit bug
      -- fixed tr type bug
      -- extra settings added to cr0 and cr4, but may
         not be needed ... (debug fix attempt)
      -- lstar mstar autoload, may not be needed ...
         (debug fix attempt)
    • Charles Jacobsen's avatar
      Most build errors fixed. · e6442a9d
      Charles Jacobsen authored
    • Charlie Jacobsen's avatar
    • Charlie Jacobsen's avatar
    • Charles Jacobsen's avatar
    • Charles Jacobsen's avatar
    • Charlie Jacobsen's avatar
      Shifted gpa map / unmap range to arch-dep code. · f9b52a46
      Charlie Jacobsen authored
      Updated tests.
    • Charles Jacobsen's avatar
      Fixing up ept destroy to not free mapped mem. · 8a977687
      Charles Jacobsen authored
      Originally, destroying the ept structures also
      freed the mapped host physical memory. This is
      leading to bad double free errors. Instead, I
      will report a potential memory leak if an ept
      pte is present.
      Users of the ept should unmap any host phys
      memory before destroying the ept (will shift
      over ept unmap range from arch-indep to
      arch-dep next).
      Updated arch test04 to use vmx_free_ept, now
      that it doesn't try to free mapped host phys
    • Charles Jacobsen's avatar
      Fixed tss/stack remap bug, and double free in create. · e0ca0ea1
      Charles Jacobsen authored
      Some data structures in struct lcd_arch are mapped in
      the ept (so that the lcd has access to them). When the
      ept is freed, these data structures are freed.
      All tests passing now for lcd_arch_create.
    • Charles Jacobsen's avatar
      Fixed bad EPT bug (in free ept). No apparent bugs now. · 3360de4b
      Charles Jacobsen authored
      Switch from macros to inline functions for type safety
      and sanity.
    • Charlie Jacobsen's avatar
      Fixing test04 free ept. · 1a670ba8
      Charlie Jacobsen authored
    • Charles Jacobsen's avatar
      Fixed EPT indexing bug. · c4af45ef
      Charles Jacobsen authored
      EPT stress test04 now passes (aside from free ept).
    • Charles Jacobsen's avatar
      Fixed some bugs in test04. · 131e8ca7
      Charles Jacobsen authored
    • Charlie Jacobsen's avatar
      More EPT stress testing. · 22d545d3
      Charlie Jacobsen authored
    • Charlie Jacobsen's avatar
      Tests for rest of lcd creation. · c36cfcff
      Charlie Jacobsen authored
    • Charles Jacobsen's avatar
    • Charlie Jacobsen's avatar
      Starting simple regression test code, to save debugging time. · a64b8301
      Charlie Jacobsen authored
      Successful build and insmod on emulab, but errors when trying
      to create lcd (perhaps errors mapping in ept). Regression tests
      should help and save debugging time in future.