Skip to content

Commit

Permalink
KVM: x86/PVM: Use 'current->active_mm' to obtain the host pgd
Browse files Browse the repository at this point in the history
When building the PVM module as builtin, the 'current->mm' can be NULL
since the current thread may be the swapper task, which is a kernel
thread. Therefore, use 'current->active_mm' instead, as it should not be
NULL.

Signed-off-by: Hou Wenlong <[email protected]>
  • Loading branch information
bysui committed Apr 25, 2024
1 parent 858242d commit 312df69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kvm/pvm/host_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 101,9 @@ int __init host_mmu_init(void)
return -ENOMEM;

if (!boot_cpu_has(X86_FEATURE_PTI))
host_pgd = (void *)current->mm->pgd;
host_pgd = (void *)current->active_mm->pgd;
else
host_pgd = (void *)kernel_to_user_pgdp(current->mm->pgd);
host_pgd = (void *)kernel_to_user_pgdp(current->active_mm->pgd);

host_mmu_root_pgd = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);

Expand Down

0 comments on commit 312df69

Please sign in to comment.