kvm - Cannot accessing the vm_list and mm_struct from a kernel module -


i trying access vm_list , mm_struct kernel module, reason, output null, though have 3 vms running.

  • in case matters, whole thing running inside vm because don't want mess real kernel.
#undef __kernel__ #define __kernel__  #undef module #define module   // linux kernel/lkm headers: module.h needed modules , kernel.h needed kern_info. #include <linux/module.h>    // included kernel modules #include <linux/kernel.h>   // included kern_info #include <linux/init.h>     // included __init , __exit macros #include <linux/kallsyms.h> #include <linux/string.h> #include <linux/kvm.h> #include <linux/kvm_host.h> #include <linux/mm_types.h> #include <linux/slab.h> #include <linux/async.h>  module_license("gpl");  struct list_head *vms_list; struct mm_struct *mms_struct; raw_spinlock_t *vm_lock;   int init_module(void) {     struct list_head *itr;     struct kvm* kvm;     int i;     printk(kern_info "hello world!\n");      vms_list = (struct list_head*)kallsyms_lookup_name("vm_list");     mms_struct = (struct list_head*)kallsyms_lookup_name("mm_struct");     vm_lock =(raw_spinlock_t*)kallsyms_lookup_name("kvm_lock");     if(!mms_struct && !vms_list){         printk(kern_info "vms_list , mms_struct %p, %p\n", vms_list, mms_struct);         return 0;    <--- line gets executed every time.     }     printk(kern_info "here 2\n");      raw_spin_lock(vm_lock);     list_for_each_entry(kvm, vms_list, vm_list)     {         printk(kern_info "%p\n", kvm);     }     raw_spin_unlock(vm_lock);      itr = 0;     // printk(kern_info "%p\n", itr);     return 0; };  void cleanup_module(void) {     printk(kern_info "goodbye world!\n"); }; 

references:

answering own question.

in short: virtualbox (which runs outer guest), not support nested virtualization (see feature request). have found out doing cat /proc/cpuinfo | grep vmx , getting empty output.

hope someday someone.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -