I'm trying to call two exported (maybe) kernel functions from the KVM - kvm_write_guest and kvm_get_segment but when I compile a kernel driver that will call these two functions I get a warning saying they are undefined.
WARNING: "kvm_write_guest" [/home/driver.ko] undefined!
WARNING: "kvm_get_segment" [/home/driver.ko] undefined!
When I executed the commands:
cat /proc/kallsyms | grep kvm_get_segment
cat /proc/kallsyms | grep kvm_write_guest
to check to see if they are exported I get the following:
0000000000000000 t kvm_write_guest [kvm]
0000000000000000 t kvm_get_segment [kvm]
Below are the protocols and includes that I have in the header file that is included in the .c file that calls these functions. I pulled the prototypes from the kvm_main.c code.
#include <linux/kvm.h>
#include <linux/kvm_types.h>
#include <linux/kvm_host.h>
int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, unsigned long len);
void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
When I dig into the kvm_main.c source code for kvm_write_guest they don't seem to be exported using the following code:
EXPORT_SYMBOL_GPL(kvm_write_guest);
When I dig into the x86.c code for kvm_get_segment it isn't exported using that method either. It doesn't seem that they are in fact exported but I want to make sure I'm not doing something wrong. I'd like to avoid patching the code and recompiling if I can. Thank in advance for any help it is greatly appreciated!