1. 25 Oct, 2016 8 commits
    • 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
      Fixed some bugs in blob build and run. · 9913e7bf
      Charles Jacobsen authored
      Per Anton's findings (see lcd commit), updated
      location and install for include/linux/lcd-domains.h.
      blob build appears correct. blob run won't be testable
      until I get (minimal) guest virtual paging setup (I
      forgot instruction fetches need paging properly set
    • Charles Jacobsen's avatar
    • Charlie Jacobsen's avatar
      Driver code and interface for loading a blob in an lcd (untested). · f0735fd0
      Charlie Jacobsen authored
      User code calls ioctl with LCD_RUN_BLOB ioctl number and
      lcd_blob_info (containing userspace address of blob and
      blob order) -- defined in public include/linux/lcd-domains.h.
      The blob must be N pages, and N must be a power of 2 (for
      easy driver code). blob_order = log2(N). The blob consists
      of machine instructions that are loaded in the lcd and
      executed. The machine instructions cannot access any memory,
      including the stack (for now, until gv paging is in place).
      -- Added lcd_arch_set_pc for setting the lcd's program counter.
      -- Added driver code in lcd-domains.c for handling the ioctl
         request, loading the blob from user space into a fresh lcd,
         and running the lcd (in a loop).
    • Charles Jacobsen's avatar
    • Anton Burtsev's avatar
      Clean up user-level includes, build inskern4lcd tool · 2d55c00d
      Anton Burtsev authored
      It took me a while to figure out a suggested layout for Linux
      user-visible headers. I ended up with this:
        ./include/lcd/lcd.h -- includes #include <uapi/linux/lcd.h>
        ./include/uapi/linux/lcd.h -- this file will be installed to
      Note on installing user-visible header files
       1) Add header-y += lcd.h line to include/uapi/linux/Kbuild
       2) Install sanitized header files into ./usr/include
          sudo make install_headers
       3) Copy ./usr/include to /usr/include
          sudo find usr/include \( -name .install -o -name ..install.cmd \) -delete
          sudo cp -rv usr/include/* /usr/include
    • Anton Burtsev's avatar
      ioctl interface to LCD · 552bd976
      Anton Burtsev authored
    • Anton Burtsev's avatar
      Working on ioctl interface for LCD · 3cbf87c0
      Anton Burtsev authored
        -- A skeleton for the IOCTL interface
        -- Public include file <linux/lcd-domains.h>
        -- Moved module load/unload from arch/x86/lcd into drivers/lcd
        -- Build crashes for modules (built-in works)