• 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.
    
    Overview:
    -- 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
       module)
    -- 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:
    
    arch/x86/include/asm/lcd-domains-arch.h
    arch/x86/lcd-domains/lcd-domains-arch-tests.c
    arch/x86/lcd-domains/lcd-domains-arch.c
    -- 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
    
    include/linux/sched.h
    -- added struct lcd to task_struct
    
    include/linux/init_task.h
    -- lcd pointer set to null when task_struct is
       initialized
    
    include/linux/module.h
    kernel/module.c
    -- made init_module and delete_module system calls
       callable from kernel code
    -- available in module.h via do_sys_init_module and
       do_sys_delete_module
    -- simply moved the majority of the guts of the
       system calls into a non-system call, exported
       routine
    -- 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
    
    include/linux/kmod.h
    kernel/kmod.c
    kernel/sysctl.c
    -- 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
    
    include/lcd-domains/lcd-domains.h
    -- added lcd status enum; see source code doc
    -- three routines for creating/running/destroying
       lcd's that use modules; see source code doc
    
    include/uapi/linux/lcd-domains.h
    -- 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
    
    virt/lcd-domains/lcd-domains.c
    -- implementation of routines for modules inside lcd's
    -- implementation of module init / delete for lcd's
       (uses patched module.c code)
    
    virt/lcd-domains/Kconfig
    virt/lcd-domains/Makefile
    virt/lcd-domains/lcd-module-load-test.c
    virt/lcd-domains/lcd-tests.c
    -- added test module for lcd module code
    -- test runs automatically when lcd module is inserted
    e0193fa4
Name
Last commit
Last update
..
bpf Loading commit data...
configs Loading commit data...
debug Loading commit data...
events Loading commit data...
gcov Loading commit data...
irq Loading commit data...
livepatch Loading commit data...
locking Loading commit data...
power Loading commit data...
printk Loading commit data...
rcu Loading commit data...
sched Loading commit data...
time Loading commit data...
trace Loading commit data...
.gitignore Loading commit data...
Kconfig.freezer Loading commit data...
Kconfig.hz Loading commit data...
Kconfig.locks Loading commit data...
Kconfig.preempt Loading commit data...
Makefile Loading commit data...
acct.c Loading commit data...
async.c Loading commit data...
audit.c Loading commit data...
audit.h Loading commit data...
audit_fsnotify.c Loading commit data...
audit_tree.c Loading commit data...
audit_watch.c Loading commit data...
auditfilter.c Loading commit data...
auditsc.c Loading commit data...
backtracetest.c Loading commit data...
bounds.c Loading commit data...
capability.c Loading commit data...
cgroup.c Loading commit data...
cgroup_freezer.c Loading commit data...
cgroup_pids.c Loading commit data...
compat.c Loading commit data...
configs.c Loading commit data...
context_tracking.c Loading commit data...
cpu.c Loading commit data...
cpu_pm.c Loading commit data...
cpuset.c Loading commit data...
crash_dump.c Loading commit data...
cred.c Loading commit data...
delayacct.c Loading commit data...
dma.c Loading commit data...
elfcore.c Loading commit data...
exec_domain.c Loading commit data...
exit.c Loading commit data...
extable.c Loading commit data...
fork.c Loading commit data...
freezer.c Loading commit data...
futex.c Loading commit data...
futex_compat.c Loading commit data...
groups.c Loading commit data...
hung_task.c Loading commit data...
irq_work.c Loading commit data...
jump_label.c Loading commit data...
kallsyms.c Loading commit data...
kcmp.c Loading commit data...
kcov.c Loading commit data...
kexec.c Loading commit data...
kexec_core.c Loading commit data...
kexec_file.c Loading commit data...
kexec_internal.h Loading commit data...
kmod.c Loading commit data...
kprobes.c Loading commit data...
ksysfs.c Loading commit data...
kthread.c Loading commit data...
latencytop.c Loading commit data...
membarrier.c Loading commit data...
memremap.c Loading commit data...
module-internal.h Loading commit data...
module.c Loading commit data...
module_signing.c Loading commit data...
notifier.c Loading commit data...
nsproxy.c Loading commit data...
padata.c Loading commit data...
panic.c Loading commit data...
params.c Loading commit data...
pid.c Loading commit data...
pid_namespace.c Loading commit data...
profile.c Loading commit data...
ptrace.c Loading commit data...
range.c Loading commit data...
reboot.c Loading commit data...
relay.c Loading commit data...
resource.c Loading commit data...
seccomp.c Loading commit data...
signal.c Loading commit data...
smp.c Loading commit data...
smpboot.c Loading commit data...
smpboot.h Loading commit data...
softirq.c Loading commit data...
stacktrace.c Loading commit data...
stop_machine.c Loading commit data...
sys.c Loading commit data...
sys_ni.c Loading commit data...
sysctl.c Loading commit data...
sysctl_binary.c Loading commit data...
task_work.c Loading commit data...
taskstats.c Loading commit data...
test_kprobes.c Loading commit data...
torture.c Loading commit data...
tracepoint.c Loading commit data...
tsacct.c Loading commit data...
uid16.c Loading commit data...
up.c Loading commit data...
user-return-notifier.c Loading commit data...
user.c Loading commit data...
user_namespace.c Loading commit data...
utsname.c Loading commit data...
utsname_sysctl.c Loading commit data...
watchdog.c Loading commit data...
workqueue.c Loading commit data...
workqueue_internal.h Loading commit data...