Skip to content
Snippets Groups Projects
Commit d0b1ac2d authored by iliya.saroukha's avatar iliya.saroukha :first_quarter_moon:
Browse files

fix: trying to allocate the size specified by the IA32_VMX_BASIC MSR

atm, the returned pointer isn't aligned to a 4KB boundary which is
problematic..
parent 766d8049
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define IA32_VMX_BASIC (0x480) #define IA32_VMX_BASIC (0x480)
#define VMCS_REVISION_ID (__rdmsr(IA32_VMX_BASIC) & 0x7fffffff) #define VMCS_REVISION_ID (__rdmsr(IA32_VMX_BASIC) & 0x7fffffff)
#define REGION_SIZE ((__rdmsr(IA32_VMX_BASIC) >> 32) & 0xfff) #define REGION_SIZE ((__rdmsr(IA32_VMX_BASIC) >> 32) & 0x1fff)
// Appendix 8 p. 4'592 of Intel SDM // Appendix 8 p. 4'592 of Intel SDM
#define IA32_VMX_CR0_FIXED0 (0x486) #define IA32_VMX_CR0_FIXED0 (0x486)
...@@ -118,7 +118,7 @@ static void restrictions_cr_msrs(void) { ...@@ -118,7 +118,7 @@ static void restrictions_cr_msrs(void) {
} }
static int vmxon_region_alloc(void) { static int vmxon_region_alloc(void) {
void *region = kzalloc(PAGE_SIZE, GFP_KERNEL); void *region = kzalloc(REGION_SIZE, GFP_KERNEL);
if (!region) { if (!region) {
return -1; return -1;
...@@ -178,7 +178,7 @@ static int my_init(void) { ...@@ -178,7 +178,7 @@ static int my_init(void) {
pr_debug("IA32_VMX_BASIC_MSR = 0x%llx\n", vmx_basic_msr); pr_debug("IA32_VMX_BASIC_MSR = 0x%llx\n", vmx_basic_msr);
unsigned long size_to_alloc = REGION_SIZE; unsigned long size_to_alloc = REGION_SIZE;
pr_debug("Region size to allocate = 0x%lx\n", size_to_alloc); pr_debug("Region size to allocate = %lu bytes\n", size_to_alloc);
unsigned long vmcs_revision_id = VMCS_REVISION_ID; unsigned long vmcs_revision_id = VMCS_REVISION_ID;
pr_debug("VMCS revision identifier = 0x%lx\n", vmcs_revision_id); pr_debug("VMCS revision identifier = 0x%lx\n", vmcs_revision_id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment