KVM: arm64: Hypervisor stack enhancements
v5 cover KVM: arm64: Hypervisor stack enhancements
Hi all,
This is v5 of the nVHE hypervisor stack enhancements. The main changes in this version are:
- Align private allocations on based the order of their size
- Allocate single private VA range for both stack and guard page (Don't rely on allocator providing separate allocations that are contiguous)
- Rebase series on 5.17-rc7
Previous versions can be found at:
v4: https://lore.kernel.org/r/[email protected]/
v3: https://lore.kernel.org/r/[email protected]/
v2: https://lore.kernel.org/r/[email protected]/
v1: https://lore.kernel.org/r/[email protected]/
The previous cover letter has been copied below for convenience.
Thanks,
Kalesh
-----
This series is based on 5.17-rc7 and adds the following stack features to the KVM nVHE hypervisor:
== Hyp Stack Guard Pages ==
Based on the technique used by arm64 VMAP_STACK to detect overflow. i.e. the stack is aligned such that the 'stack shift' bit of any valid SP is 1. The 'stack shift' bit can be tested in the exception entry to detect overflow without corrupting GPRs.
== Hyp Stack Unwinder ==
Based on the arm64 kernel stack unwinder
(See: arch/arm64/kernel/stacktrace.c)
The unwinding and dumping of the hyp stack is not enabled by default and depends on CONFIG_NVHE_EL2_DEBUG to avoid potential information leaks.
When CONFIG_NVHE_EL2_DEBUG is enabled the host stage 2 protection is disabled, allowing the host to read the hypervisor stack pages and unwind the stack from EL1. This allows us to print the hypervisor stacktrace before panicking the host; as shown below.
Example call trace:
[ 98.916444][ T426] kvm [426]: nVHE hyp panic at: [<ffffffc0096156fc>] __kvm_nvhe_overflow_stack+0x8/0x34! [ 98.918360][ T426] nVHE HYP call trace: [ 98.918692][ T426] kvm [426]: [<ffffffc009615aac>] __kvm_nvhe_cpu_prepare_nvhe_panic_info+0x4c/0x68 [ 98.919545][ T426] kvm [426]: [<ffffffc0096159a4>] __kvm_nvhe_hyp_panic+0x2c/0xe8 [ 98.920107][ T426] kvm [426]: [<ffffffc009615ad8>] __kvm_nvhe_hyp_panic_bad_stack+0x10/0x10 [ 98.920665][ T426] kvm [426]: [<ffffffc009610a4c>] __kvm_nvhe___kvm_hyp_host_vector+0x24c/0x794 [ 98.921292][ T426] kvm [426]: [<ffffffc009615718>] __kvm_nvhe_overflow_stack+0x24/0x34
. . .
[ 98.973382][ T426] kvm [426]: [<ffffffc009615718>] __kvm_nvhe_overflow_stack+0x24/0x34 [ 98.973816][ T426] kvm [426]: [<ffffffc0096152f4>] __kvm_nvhe___kvm_vcpu_run+0x38/0x438 [ 98.974255][ T426] kvm [426]: [<ffffffc009616f80>] __kvm_nvhe_handle___kvm_vcpu_run+0x1c4/0x364 [ 98.974719][ T426] kvm [426]: [<ffffffc009616928>] __kvm_nvhe_handle_trap+0xa8/0x130 [ 98.975152][ T426] kvm [426]: [<ffffffc009610064>] __kvm_nvhe___host_exit+0x64/0x64 [ 98.975588][ T426] ---- end of nVHE HYP call trace ----
Kalesh Singh (8):
KVM: arm64: Introduce hyp_alloc_private_va_range()
KVM: arm64: Introduce pkvm_alloc_private_va_range()
KVM: arm64: Add guard pages for KVM nVHE hypervisor stack
KVM: arm64: Add guard pages for pKVM (protected nVHE) hypervisor stack
KVM: arm64: Detect and handle hypervisor stack overflows
KVM: arm64: Add hypervisor overflow stack
KVM: arm64: Unwind and dump nVHE HYP stacktrace
KVM: arm64: Symbolize the nVHE HYP backtrace
arch/arm64/include/asm/kvm_asm.h | 21 +++ arch/arm64/include/asm/kvm_mmu.h | 4 + arch/arm64/include/asm/stacktrace.h | 12 ++ arch/arm64/kernel/stacktrace.c | 210 ++++++++++++++++++++++++--- arch/arm64/kvm/Kconfig | 5 +- arch/arm64/kvm/arm.c | 42 +++++- arch/arm64/kvm/handle_exit.c | 16 +- arch/arm64/kvm/hyp/include/nvhe/mm.h | 1 + arch/arm64/kvm/hyp/nvhe/host.S | 29 ++++ arch/arm64/kvm/hyp/nvhe/mm.c | 56 ++++--- arch/arm64/kvm/hyp/nvhe/setup.c | 31 +++- arch/arm64/kvm/hyp/nvhe/switch.c | 30 +++- arch/arm64/kvm/mmu.c | 67 ++++++--- scripts/kallsyms.c | 2 +- 14 files changed, 440 insertions(+), 86 deletions(-)
base-commit: ffb217a13a2eaf6d5bd974fc83036a53ca69f1e2
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v5 1/8 KVM: arm64: Introduce hyp_alloc_private_va_range()
hyp_alloc_private_va_range() can be used to reserve private VA ranges in the nVHE hypervisor. Allocations are aligned based on the order of the requested size.
This will be used to implement stack guard pages for KVM nVHE hypervisor (nVHE Hyp mode / not pKVM), in a subsequent patch in the series.
---
Changes in v5:
- Align private allocations based on the order of their size, per Marc
Changes in v4:
- Handle null ptr in hyp_alloc_private_va_range() and replace IS_ERR_OR_NULL checks in callers with IS_ERR checks, per Fuad
- Fix kernel-doc comments format, per Fuad
Changes in v3:
- Handle null ptr in IS_ERR_OR_NULL checks, per Mark
arch/arm64/include/asm/kvm_mmu.h | 1 + arch/arm64/kvm/mmu.c | 63 +++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 22 deletions(-)
arch/arm64/include/asm/kvm_mmu.h +1 -0
@@ -153,6 +153,7 @@ static __always_inline unsigned long __kern_hyp_va(unsigned long v)int kvm_share_hyp (void *from,void *to);void kvm_unshare_hyp (void *from,void *to);int create_hyp_mappings (void *from,void *to,enum kvm_pgtable_prot prot); +unsigned long hyp_alloc_private_va_range (size_t size);int create_hyp_io_mappings (phys_addr_t phys_addr,size_t size,void __iomem **kaddr,void __iomem **haddr);
arch/arm64/kvm/mmu.c +41 -22
92 lines not on this page · raw message
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v5 1/8] KVM: arm64: Introduce hyp_alloc_private_va_range()
Quoting Kalesh Singh (2022-03-07 10:48:59)
Quoted 8 lines
arch/arm64/kvm/mmu.c +0
-0@@ -457,22 +457,17 @@ int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)return 0 ; }
arch/arm64/kvm/mmu.c int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot) · line 466
Quoted 10 lines
arch/arm64/kvm/mmu.c +7
-3-static int __create_hyp_private_mapping (phys_addr_t phys_addr,size_t size, -unsigned long *haddr, -enum kvm_pgtable_prot prot) + +/** +* hyp_alloc_private_va_range - Allocates a private VA range. +* @size: The size of the VA range to reserve. +* +* The private VA range is allocated below io_map_base and +* aligned based on the order of @size.
Add what it returns?
Return: Start address of allocated VA range or some error value... (I don't understand this part).
It may also be a good idea to write out what VA is in the description:
The private virtual address (VA) range is allocated below io_map_base
Quoted 28 lines
arch/arm64/kvm/mmu.c +6
-13+*/ +unsigned long hyp_alloc_private_va_range (size_t size) {unsigned long base; -int ret =0 ; - -if (!kvm_host_owns_hyp_mappings ()) { - base =kvm_call_hyp_nvhe (__pkvm_create_private_mapping, - phys_addr, size, prot); -if (IS_ERR_OR_NULL ((void *)base)) -return PTR_ERR ((void *)base); - *haddr = base; - -return 0 ; - }mutex_lock (&kvm_hyp_pgd_mutex);@@ -484,29 +479,53 @@ static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size,* * The allocated size is always a multiple of PAGE_SIZE. */ - size =PAGE_ALIGN (size +offset_in_page (phys_addr)); - base = io_map_base - size; + base = io_map_base -PAGE_ALIGN (size); + +/* Align the allocation based on the order of its size */ + base =ALIGN_DOWN (base,PAGE_SIZE <<get_order (size));
arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 493
Quoted 10 lines
arch/arm64/kvm/mmu.c +2
-2/* * Verify that BIT(VA_BITS - 1) hasn't been flipped by * allocating the new area, as it would indicate we've * overflowed the idmap/IO address range. */ -if ((base ^ io_map_base) &BIT (VA_BITS -1 )) - ret = -ENOMEM ; +if (!base || (base ^ io_map_base) &BIT (VA_BITS -1 )) + base = (unsigned long )ERR_PTR (-ENOMEM );
It looks odd to use an error pointer casted to unsigned long to return from an address allocation function. Why not pass a pointer for base like the function was written before and return an int from this function with 0 for success and negative error value? Otherwise some sort of define should made like DMA_MAPPING_ERROR and that can be used to indicate to the caller that the allocation failed, or a simple zero may work?
Quoted 11 lines
arch/arm64/kvm/mmu.c +4
-2else io_map_base = base;mutex_unlock (&kvm_hyp_pgd_mutex); -if (ret) - goto out; +return base; +} + +static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size,
arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 512
Quoted 10 lines
arch/arm64/kvm/mmu.c +10
-0+ unsigned long *haddr, + enum kvm_pgtable_prot prot) +{ +unsigned long addr; +int ret =0 ; + +if (!kvm_host_owns_hyp_mappings ()) { + addr =kvm_call_hyp_nvhe (__pkvm_create_private_mapping, + phys_addr, size, prot); +if (IS_ERR ((void *)addr))
IS_ERR_VALUE()?
arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 521
Quoted 9 lines
arch/arm64/kvm/mmu.c +9
-0+return PTR_ERR ((void *)addr); + *haddr = addr; + +return 0 ; + } + + size +=offset_in_page (phys_addr); + addr =hyp_alloc_private_va_range (size); +if (IS_ERR ((void *)addr))
IS_ERR_VALUE()?
arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 530
Quoted 11 lines
arch/arm64/kvm/mmu.c +3
-2+return PTR_ERR ((void *)addr); - ret =__create_hyp_mappings (base, size, phys_addr, prot); + ret =__create_hyp_mappings (addr, size, phys_addr, prot);if (ret) goto out; - *haddr = base +offset_in_page (phys_addr); + *haddr = addr +offset_in_page (phys_addr); out:return ret;
Would be simpler to remove the goto, or return early.
if (!ret) *haddr = addr + offset_in_page(phys_addr); return ret;
Quoted 1 line
arch/arm64/kvm/mmu.c +0
-0}
Re: [PATCH v5 1/8] KVM: arm64: Introduce hyp_alloc_private_va_range()
Quoted 1 line · Stephen Boyd
HI Stephen. Thanks for the review.
Quoted 22 lines
Quoting Kalesh Singh (2022-03-07 10:48:59)
Quoted 8 lines
arch/arm64/kvm/mmu.c +0
-0@@ -457,22 +457,17 @@ int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)return 0 ; }arch/arm64/kvm/mmu.c int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot) · line 466
Quoted 10 lines
arch/arm64/kvm/mmu.c +7
-3-static int __create_hyp_private_mapping (phys_addr_t phys_addr,size_t size, -unsigned long *haddr, -enum kvm_pgtable_prot prot) + +/** +* hyp_alloc_private_va_range - Allocates a private VA range. +* @size: The size of the VA range to reserve. +* +* The private VA range is allocated below io_map_base and +* aligned based on the order of @size. Add what it returns?
Quoted 7 lines
Return: Start address of allocated VA range or some error value... (I don't understand this part).
It may also be a good idea to write out what VA is in the description:
The private virtual address (VA) range is allocated below
io_map_base
Ack
Quoted 39 lines
Quoted 28 lines
arch/arm64/kvm/mmu.c +6
-13+*/ +unsigned long hyp_alloc_private_va_range (size_t size) {unsigned long base; -int ret =0 ; - -if (!kvm_host_owns_hyp_mappings ()) { - base =kvm_call_hyp_nvhe (__pkvm_create_private_mapping, - phys_addr, size, prot); -if (IS_ERR_OR_NULL ((void *)base)) -return PTR_ERR ((void *)base); - *haddr = base; - -return 0 ; - }mutex_lock (&kvm_hyp_pgd_mutex);@@ -484,29 +479,53 @@ static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size,* * The allocated size is always a multiple of PAGE_SIZE. */ - size =PAGE_ALIGN (size +offset_in_page (phys_addr)); - base = io_map_base - size; + base = io_map_base -PAGE_ALIGN (size); + +/* Align the allocation based on the order of its size */ + base =ALIGN_DOWN (base,PAGE_SIZE <<get_order (size));arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 493
Quoted 10 lines
arch/arm64/kvm/mmu.c +2
-2/* * Verify that BIT(VA_BITS - 1) hasn't been flipped by * allocating the new area, as it would indicate we've * overflowed the idmap/IO address range. */ -if ((base ^ io_map_base) &BIT (VA_BITS -1 )) - ret = -ENOMEM ; +if (!base || (base ^ io_map_base) &BIT (VA_BITS -1 )) + base = (unsigned long )ERR_PTR (-ENOMEM );
Quoted 7 lines
It looks odd to use an error pointer casted to unsigned long to return from an address allocation function. Why not pass a pointer for base like the function was written before and return an int from this function with 0 for success and negative error value?Otherwise some sort of define should made like
DMA_MAPPING_ERRORand that can be used to indicate to the caller that the allocation failed, or a simple zero may work?
I wanted to keep consistent between the pkvm and traditional nvhe code. I will refactor both *alloc_private_va_range() functions to take a pointer and return an int error if that's preferred. There would still be a case of this kind of cast in __pkvm_create_private_mapping() which does return an unsigned long address or ERR_PTR(...). It looks like it was made to return the address to facilitate use as a hypercall (@Quentin CMIW).
Quoted 16 lines
Quoted 16 lines
arch/arm64/kvm/mmu.c +8
-2else io_map_base = base;mutex_unlock (&kvm_hyp_pgd_mutex); -if (ret) - goto out; +return base; +} + +static int __create_hyp_private_mapping (phys_addr_t phys_addr,size_t size, +unsigned long *haddr, +enum kvm_pgtable_prot prot) +{ +unsigned long addr;
Quoted 8 lines
arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 512
Quoted 6 lines
arch/arm64/kvm/mmu.c +6
-0+int ret =0 ; + +if (!kvm_host_owns_hyp_mappings ()) { + addr =kvm_call_hyp_nvhe (__pkvm_create_private_mapping, + phys_addr, size, prot); +if (IS_ERR ((void *)addr))
IS_ERR_VALUE()?
Good idea, will remove the extra cast.
Quoted 12 lines
arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 521
Quoted 10 lines
arch/arm64/kvm/mmu.c +9
-0+return PTR_ERR ((void *)addr); + *haddr = addr; + +return 0 ; + } + + size +=offset_in_page (phys_addr); + addr =hyp_alloc_private_va_range (size); +if (IS_ERR ((void *)addr))
IS_ERR_VALUE()?
Ack
Quoted 13 lines
arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 530
Quoted 12 lines
arch/arm64/kvm/mmu.c +3
-2+return PTR_ERR ((void *)addr); - ret =__create_hyp_mappings (base, size, phys_addr, prot); + ret =__create_hyp_mappings (addr, size, phys_addr, prot);if (ret) goto out; - *haddr = base +offset_in_page (phys_addr); + *haddr = addr +offset_in_page (phys_addr); out:return ret;
Quoted 6 lines
Would be simpler to remove the goto, or return early.
if (!ret) *haddr = addr + offset_in_page(phys_addr); return ret;
Agreed, I'll remove the goto in the next version.
Thanks,
Kalesh
Quoted 2 lines
arch/arm64/kvm/mmu.c static int __create_hyp_private_mapping(phys_addr_t phys_addr, size_t size, · line 531
Quoted 2 lines
arch/arm64/kvm/mmu.c +0
-0}
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v5 1/8] KVM: arm64: Introduce hyp_alloc_private_va_range()
Quoted 9 lines · Kalesh Singh
Quoted 7 lines · Stephen Boyd
It looks odd to use an error pointer casted to unsigned long to return from an address allocation function. Why not pass a pointer for base like the function was written before and return an int from this function with 0 for success and negative error value?Otherwise some sort of define should made like
DMA_MAPPING_ERRORand that can be used to indicate to the caller that the allocation failed, or a simple zero may work?
Quoted 7 lines
I wanted to keep consistent between the pkvm and traditional nvhe code. I will refactor both
*alloc_private_va_range()functions to take a pointer and return an int error if that's preferred. There would still be a case of this kind of cast in__pkvm_create_private_mapping()which does return an unsigned long address orERR_PTR(...). It looks like it was made to return the address to facilitate use as a hypercall (@Quentin CMIW).
Yep, passing everything by value was much easier to cross the EL1/EL2 boundary as that avoids having the hypervisor map kernel memory and all that fun. But Stephen's point is fair, so no objection from to keep this little dance confined to the hypercall wrapper and make the function signature nicer and easier to use for the rest of the code.
Cheers,
Quentin
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v5 1/8] KVM: arm64: Introduce hyp_alloc_private_va_range()
Quoted 19 lines · Quentin Perret
Quoted 9 lines · Kalesh Singh
Quoted 7 lines · Stephen Boyd
It looks odd to use an error pointer casted to unsigned long to return from an address allocation function. Why not pass a pointer for base like the function was written before and return an int from this function with 0 for success and negative error value?Otherwise some sort of define should made like
DMA_MAPPING_ERRORand that can be used to indicate to the caller that the allocation failed, or a simple zero may work?Quoted 7 lines
I wanted to keep consistent between the pkvm and traditional nvhe code. I will refactor both
*alloc_private_va_range()functions to take a pointer and return an int error if that's preferred. There would still be a case of this kind of cast in__pkvm_create_private_mapping()which does return an unsigned long address orERR_PTR(...). It looks like it was made to return the address to facilitate use as a hypercall (@Quentin CMIW).
Quoted 5 lines
Yep, passing everything by value was much easier to cross the EL1/EL2 boundary as that avoids having the hypervisor map kernel memory and all that fun. But Stephen's point is fair, so no objection from to keep this little dance confined to the hypercall wrapper and make the function signature nicer and easier to use for the rest of the code.
Thanks for clarifying Quentin. That sounds good to me.
- Kalesh
Quoted 3 lines
Cheers,
Quentin
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v5 2/8 KVM: arm64: Introduce pkvm_alloc_private_va_range()
In reply to Kalesh Singhpkvm_hyp_alloc_private_va_range() can be used to reserve private VA ranges in the pKVM nVHE hypervisor. Allocations are aligned based on the order of the requested size.
This will be used to implement stack guard pages for pKVM nVHE hypervisor (in a subsequent patch in the series).
Credits to Quentin Perret <[email protected]> for the idea of moving private VA allocation out of __pkvm_create_private_mapping()
---
Changes in v5:
- Align private allocations based on the order of their size, per Marc
Changes in v4:
- Handle null ptr in pkvm_alloc_private_va_range() and replace IS_ERR_OR_NULL checks in callers with IS_ERR checks, per Fuad
- Fix kernel-doc comments format, per Fuad
- Format __pkvm_create_private_mapping() prototype args (< 80 col), per Fuad
Changes in v3:
- Handle null ptr in IS_ERR_OR_NULL checks, per Mark
Changes in v2:
- Allow specifying an alignment for the private VA allocations, per Marc
arch/arm64/kvm/hyp/include/nvhe/mm.h | 1 + arch/arm64/kvm/hyp/nvhe/mm.c | 56 ++++++++++++++++++---------- 2 files changed, 37 insertions(+), 20 deletions(-)
arch/arm64/kvm/hyp/include/nvhe/mm.h +1 -0
@@ -21,6 +21,7 @@ int pkvm_create_mappings(void *from, void *to, enum kvm_pgtable_prot prot);int pkvm_create_mappings_locked (void *from,void *to,enum kvm_pgtable_prot prot);unsigned long __pkvm_create_private_mapping (phys_addr_t phys,size_t size,enum kvm_pgtable_prot prot); +unsigned long pkvm_alloc_private_va_range (size_t size);static inline void hyp_vmemmap_range (phys_addr_t phys,unsigned long size,unsigned long *start,unsigned long *end)
arch/arm64/kvm/hyp/nvhe/mm.c +36 -20
81 lines not on this page · raw message
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v5 3/8 KVM: arm64: Add guard pages for KVM nVHE hypervisor stack
In reply to Kalesh SinghMap the stack pages in the flexible private VA range and allocate guard pages below the stack as unbacked VA space. The stack is aligned so that any valid stack address has PAGE_SHIFT bit as 1 - this is used for overflow detection (implemented in a subsequent patch in the series).
---
Changes in v5:
- Use a single allocation for stack and guard pages to ensure they are contiguous, per Marc
Changes in v4:
- Replace IS_ERR_OR_NULL check with IS_ERR check now that hyp_alloc_private_va_range() returns an error for null pointer, per Fuad
- Format comments to < 80 cols, per Fuad
Changes in v3:
- Handle null ptr in IS_ERR_OR_NULL checks, per Mark
arch/arm64/include/asm/kvm_asm.h | 1 + arch/arm64/include/asm/kvm_mmu.h | 3 +++ arch/arm64/kvm/arm.c | 40 +++++++++++++++++++++++++++++--- arch/arm64/kvm/mmu.c | 4 ++-- 4 files changed, 43 insertions(+), 5 deletions(-)
arch/arm64/include/asm/kvm_asm.h +1 -0
@@ -169,6 +169,7 @@ struct kvm_nvhe_init_params {unsigned long tcr_el2;unsigned long tpidr_el2;unsigned long stack_hyp_va; +unsigned long stack_pa;phys_addr_t pgd_pa;unsigned long hcr_el2;unsigned long vttbr;
arch/arm64/include/asm/kvm_mmu.h +3 -0
@@ -116,6 +116,9 @@ alternative_cb_end#include <asm/cacheflush.h> #include <asm/mmu_context.h> +extern struct kvm_pgtable *hyp_pgtable; +extern struct mutex kvm_hyp_pgd_mutex; +void kvm_update_va_mask (struct alt_instr *alt,__le32 *origptr,__le32 *updptr,int nr_inst);void kvm_compute_layout (void );
arch/arm64/kvm/arm.c +37 -3
@@ -1541,7 +1541,6 @@ static void cpu_prepare_hyp_mode(int cpu) tcr |= (idmap_t0sz &GENMASK (TCR_TxSZ_WIDTH -1 ,0 )) <<TCR_T0SZ_OFFSET ; params->tcr_el2 = tcr; - params->stack_hyp_va =kern_hyp_va (per_cpu (kvm_arm_hyp_stack_page, cpu) +PAGE_SIZE ); params->pgd_pa =kvm_mmu_get_httbr ();if (is_protected_kvm_enabled ()) params->hcr_el2 =HCR_HOST_NVHE_PROTECTED_FLAGS ;
@@ -1990,14 +1989,49 @@ static int init_hyp_mode(void)* Map the Hyp stack pages */ for_each_possible_cpu (cpu) { +struct kvm_nvhe_init_params *params =per_cpu_ptr_nvhe_sym (kvm_init_params, cpu);char *stack_page = (char *)per_cpu (kvm_arm_hyp_stack_page, cpu); - err =create_hyp_mappings (stack_page, stack_page +PAGE_SIZE , -PAGE_HYP ); +unsigned long hyp_addr; +/* +* Allocate a contiguous HYP private VA range for the stack +* and guard page. The allocation is also aligned based on +* the order of its size. +*/ + hyp_addr =hyp_alloc_private_va_range (PAGE_SIZE *2 ); +if (IS_ERR ((void *)hyp_addr)) { + err =PTR_ERR ((void *)hyp_addr); +kvm_err ("Cannot allocate hyp stack guard page\n" ); + goto out_err; + } + +/* +* Since the stack grows downwards, map the stack to the page +* at the higher address and leave the lower guard page +* unbacked. +* +* Any valid stack address now has the PAGE_SHIFT bit as 1 +* and addresses corresponding to the guard page have the +* PAGE_SHIFT bit as 0 - this is used for overflow detection. +*/ +mutex_lock (&kvm_hyp_pgd_mutex); + err =kvm_pgtable_hyp_map (hyp_pgtable, hyp_addr +PAGE_SIZE , +PAGE_SIZE ,__pa (stack_page),PAGE_HYP ); +mutex_unlock (&kvm_hyp_pgd_mutex);if (err) {kvm_err ("Cannot map hyp stack\n" ); goto out_err; } + +/* +* Save the stack PA in nvhe_init_params. This will be needed +* to recreate the stack mapping in protected nVHE mode. +* __hyp_pa() won't do the right thing there, since the stack +* has been mapped in the flexible private VA space. +*/ + params->stack_pa =__pa (stack_page); + + params->stack_hyp_va = hyp_addr + (2 *PAGE_SIZE ); }for_each_possible_cpu (cpu) {
arch/arm64/kvm/mmu.c +2 -2
@@ -22,8 +22,8 @@#include "trace.h" -static struct kvm_pgtable *hyp_pgtable; -static DEFINE_MUTEX (kvm_hyp_pgd_mutex); +struct kvm_pgtable *hyp_pgtable; +DEFINE_MUTEX (kvm_hyp_pgd_mutex);static unsigned long hyp_idmap_start;static unsigned long hyp_idmap_end;
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v5 4/8 KVM: arm64: Add guard pages for pKVM (protected nVHE) hypervisor stack
In reply to Kalesh SinghMap the stack pages in the flexible private VA range and allocate guard pages below the stack as unbacked VA space. The stack is aligned so that any valid stack address has PAGE_SHIFT bit as 1 - this is used for overflow detection (implemented in a subsequent patch in the series)
---
Changes in v5:
- Use a single allocation for stack and guard pages to ensure they are contiguous, per Marc
Changes in v4:
- Replace IS_ERR_OR_NULL check with IS_ERR check now that pkvm_alloc_private_va_range() returns an error for null pointer, per Fuad
Changes in v3:
- Handle null ptr in IS_ERR_OR_NULL checks, per Mark
arch/arm64/kvm/hyp/nvhe/setup.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
arch/arm64/kvm/hyp/nvhe/setup.c +28 -3
@@ -99,17 +99,42 @@ static int recreate_hyp_mappings(phys_addr_t phys, unsigned long size,return ret;for (i =0 ; i < hyp_nr_cpus; i++) { +struct kvm_nvhe_init_params *params =per_cpu_ptr (&kvm_init_params, i); +unsigned long hyp_addr; + start = (void *)kern_hyp_va (per_cpu_base[i]); end = start +PAGE_ALIGN (hyp_percpu_size); ret =pkvm_create_mappings (start, end,PAGE_HYP );if (ret)return ret; - end = (void *)per_cpu_ptr (&kvm_init_params, i)->stack_hyp_va; - start = end -PAGE_SIZE ; - ret =pkvm_create_mappings (start, end,PAGE_HYP ); +/* +* Allocate a contiguous HYP private VA range for the stack +* and guard page. The allocation is also aligned based on +* the order of its size. +*/ + hyp_addr =pkvm_alloc_private_va_range (PAGE_SIZE *2 ); +if (IS_ERR ((void *)hyp_addr)) +return PTR_ERR ((void *)hyp_addr); + +/* +* Since the stack grows downwards, map the stack to the page +* at the higher address and leave the lower guard page +* unbacked. +* +* Any valid stack address now has the PAGE_SHIFT bit as 1 +* and addresses corresponding to the guard page have the +* PAGE_SHIFT bit as 0 - this is used for overflow detection. +*/ +hyp_spin_lock (&pkvm_pgd_lock); + ret =kvm_pgtable_hyp_map (&pkvm_pgtable, hyp_addr +PAGE_SIZE , +PAGE_SIZE , params->stack_pa,PAGE_HYP ); +hyp_spin_unlock (&pkvm_pgd_lock);if (ret)return ret; + +/* Update stack_hyp_va to end of the stack's private VA range */ + params->stack_hyp_va = hyp_addr + (2 *PAGE_SIZE ); }/*
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v5 5/8 KVM: arm64: Detect and handle hypervisor stack overflows
In reply to Kalesh SinghThe hypervisor stacks (for both nVHE Hyp mode and nVHE protected mode) are aligned such that any valid stack address has PAGE_SHIFT bit as 1. This allows us to conveniently check for overflow in the exception entry without corrupting any GPRs. We won't recover from a stack overflow so panic the hypervisor.
---
Changes in v5:
- Valid stack addresses now have PAGE_SHIFT bit as 1 instead of 0
Changes in v3:
- Remove test_sp_overflow macro, per Mark
- Add asmlinkage attribute for hyp_panic, hyp_panic_bad_stack, per Ard
arch/arm64/kvm/hyp/nvhe/host.S | 24 ++++++++++++++++++++++++ arch/arm64/kvm/hyp/nvhe/switch.c | 7 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
arch/arm64/kvm/hyp/nvhe/host.S +24 -0
@@ -153,6 +153,18 @@ SYM_FUNC_END(__host_hvc) .macro invalid_host_el2_vect .align 7 + + /* + * Test whether the SP has overflowed, without corrupting a GPR. + * nVHE hypervisor stacks are aligned so that the PAGE_SHIFT bit + * of SP should always be 1. + */ + add sp, sp, x0 // sp' = sp + x0 + sub x0, sp, x0 // x0' = sp' - x0 = (sp + x0) - x0 = sp + tbz x0, #PAGE_SHIFT, .L__hyp_sp_overflow\@ + sub x0, sp, x0 // x0'' = sp' - x0' = (sp + x0) - sp = x0 + sub sp, sp, x0 // sp'' = sp' - x0 = (sp + x0) - x0 = sp + /* If a guest is loaded, panic out of it. */ stp x0, x1, [sp, #-16]! get_loaded_vcpu x0, x1
@@ -165,6 +177,18 @@ SYM_FUNC_END(__host_hvc) * been partially clobbered by __host_enter. */ b hyp_panic + +.L__hyp_sp_overflow\@: + /* + * Reset SP to the top of the stack, to allow handling the hyp_panic. + * This corrupts the stack but is ok, since we won't be attempting + * any unwinding here. + */ + ldr_this_cpu x0, kvm_init_params + NVHE_INIT_STACK_HYP_VA, x1 + mov sp, x0 + + bl hyp_panic_bad_stack + ASM_BUG() .endm .macro invalid_host_el1_vect
arch/arm64/kvm/hyp/nvhe/switch.c +6 -1
@@ -347,7 +347,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu)return exit_code; } -void __noreturn hyp_panic (void ) +asmlinkage void __noreturn hyp_panic(void) {u64 spsr =read_sysreg_el2 (SYS_SPSR );u64 elr =read_sysreg_el2 (SYS_ELR );
@@ -369,6 +369,11 @@ void __noreturn hyp_panic(void)unreachable (); } +asmlinkage void __noreturn hyp_panic_bad_stack(void) +{ +hyp_panic (); +} + asmlinkage void kvm_unexpected_el2_exception(void) {return __kvm_unexpected_el2_exception ();
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v5 6/8 KVM: arm64: Add hypervisor overflow stack
In reply to Kalesh SinghAllocate and switch to 16-byte aligned secondary stack on overflow. This provides us stack space to better handle overflows; and is used in a subsequent patch to dump the hypervisor stacktrace. The overflow stack is only allocated if CONFIG_NVHE_EL2_DEBUG is enabled, as hypervisor stacktraces is a debug feature dependent on CONFIG_NVHE_EL2_DEBUG.
---
Changes in v4:
- Update comment to clarify resetting the SP to the top of the stack only happens if CONFIG_NVHE_EL2_DEBUG is disabled, per Fuad
arch/arm64/kvm/hyp/nvhe/host.S | 11 ++++++++--- arch/arm64/kvm/hyp/nvhe/switch.c | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-)
arch/arm64/kvm/hyp/nvhe/host.S +8 -3
@@ -179,13 +179,18 @@ SYM_FUNC_END(__host_hvc) b hyp_panic .L__hyp_sp_overflow\@: +#ifdef CONFIG_NVHE_EL2_DEBUG + /* Switch to the overflow stack */ + adr_this_cpu sp, hyp_overflow_stack + PAGE_SIZE, x0 +#else /* - * Reset SP to the top of the stack, to allow handling the hyp_panic. - * This corrupts the stack but is ok, since we won't be attempting - * any unwinding here. + * If !CONFIG_NVHE_EL2_DEBUG, reset SP to the top of the stack, to + * allow handling the hyp_panic. This corrupts the stack but is ok, + * since we won't be attempting any unwinding here. */ ldr_this_cpu x0, kvm_init_params + NVHE_INIT_STACK_HYP_VA, x1 mov sp, x0 +#endif bl hyp_panic_bad_stack ASM_BUG()
arch/arm64/kvm/hyp/nvhe/switch.c +5 -0
@@ -34,6 +34,11 @@ DEFINE_PER_CPU(struct kvm_host_data, kvm_host_data); DEFINE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt); DEFINE_PER_CPU(unsigned long, kvm_hyp_vector); +#ifdef CONFIG_NVHE_EL2_DEBUG +DEFINE_PER_CPU(unsigned long [PAGE_SIZE/sizeof(long)], hyp_overflow_stack) +__aligned(16) ; +#endif +static void __activate_traps (struct kvm_vcpu *vcpu) {u64 val;
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v5 7/8 KVM: arm64: Unwind and dump nVHE HYP stacktrace
In reply to Kalesh SinghUnwind the stack in EL1, when CONFIG_NVHE_EL2_DEBUG is enabled. This is possible because CONFIG_NVHE_EL2_DEBUG disables the host stage-2 protection on hyp_panic(), allowing the host to access the hypervisor stack pages in EL1.
A simple stack overflow test produces the following output:
[ 580.376051][ T412] kvm: nVHE hyp panic at: ffffffc0116145c4! [ 580.378034][ T412] kvm [412]: nVHE HYP call trace: [ 580.378591][ T412] kvm [412]: [<ffffffc011614934>] [ 580.378993][ T412] kvm [412]: [<ffffffc01160fa48>] [ 580.379386][ T412] kvm [412]: [<ffffffc0116145dc>] // Non-terminating recursive call [ 580.379772][ T412] kvm [412]: [<ffffffc0116145dc>] [ 580.380158][ T412] kvm [412]: [<ffffffc0116145dc>] [ 580.380544][ T412] kvm [412]: [<ffffffc0116145dc>] [ 580.380928][ T412] kvm [412]: [<ffffffc0116145dc>]
. . .
Since nVHE hyp symbols are not included by kallsyms to avoid issues with aliasing, we fallback to the vmlinux addresses. Symbolizing the addresses is handled in the next patch in this series.
---
Changes in v4:
- Update commit text and struct kvm_nvhe_panic_info kernel-doc comment to clarify that CONFIG_NVHE_EL2_DEBUG only disables the host stage-2 protection on hyp_panic(), per Fuad
- Update NVHE_EL2_DEBUG Kconfig description to clarify that the hypervisor stack trace is printed when hyp_panic() is called, per Fuad
Changes in v3:
- The nvhe hyp stack unwinder now makes use of the core logic from the regular kernel unwinder to avoid duplication, per Mark
Changes in v2:
- Add cpu_prepare_nvhe_panic_info()
- Move updating the panic info to hyp_panic(), so that unwinding also works for conventional nVHE Hyp-mode.
arch/arm64/include/asm/kvm_asm.h | 20 +++ arch/arm64/include/asm/stacktrace.h | 12 ++ arch/arm64/kernel/stacktrace.c | 210 +++++++++++++++++++++++++--- arch/arm64/kvm/Kconfig | 5 +- arch/arm64/kvm/arm.c | 2 +- arch/arm64/kvm/handle_exit.c | 3 + arch/arm64/kvm/hyp/nvhe/switch.c | 18 +++ 7 files changed, 244 insertions(+), 26 deletions(-)
arch/arm64/include/asm/kvm_asm.h +20 -0
@@ -176,6 +176,26 @@ struct kvm_nvhe_init_params {unsigned long vtcr; }; +#ifdef CONFIG_NVHE_EL2_DEBUG +/** +* struct kvm_nvhe_panic_info - nVHE hypervisor panic info. +* @hyp_stack_base: hyp VA of the hyp_stack base. +* @hyp_overflow_stack_base: hyp VA of the hyp_overflow_stack base. +* @fp: hyp FP where the backtrace begins. +* @pc: hyp PC where the backtrace begins. +* +* Used by the host in EL1 to dump the nVHE hypervisor backtrace on +* hyp_panic. This is possible because CONFIG_NVHE_EL2_DEBUG disables +* the host stage 2 protection on hyp_panic(). See: __hyp_do_panic() +*/ +struct kvm_nvhe_panic_info { +unsigned long hyp_stack_base; +unsigned long hyp_overflow_stack_base; +unsigned long fp; +unsigned long pc; +}; +#endif /* CONFIG_NVHE_EL2_DEBUG */ +/* Translate a kernel address @ptr into its equivalent linear mapping */ #define kvm_ksym_ref (ptr) \ ({ \
arch/arm64/include/asm/stacktrace.h +12 -0
@@ -22,6 +22,10 @@ enum stack_type {STACK_TYPE_OVERFLOW ,STACK_TYPE_SDEI_NORMAL ,STACK_TYPE_SDEI_CRITICAL , +#ifdef CONFIG_NVHE_EL2_DEBUG +STACK_TYPE_KVM_NVHE_HYP , +STACK_TYPE_KVM_NVHE_OVERFLOW , +#endif /* CONFIG_NVHE_EL2_DEBUG */ __NR_STACK_TYPES };
@@ -147,4 +151,12 @@ static inline bool on_accessible_stack(const struct task_struct *tsk, return false; } +#ifdef CONFIG_NVHE_EL2_DEBUG +void kvm_nvhe_dump_backtrace (unsigned long hyp_offset); +#else +static inline void kvm_nvhe_dump_backtrace (unsigned long hyp_offset) +{ +} +#endif /* CONFIG_NVHE_EL2_DEBUG */ +#endif /* __ASM_STACKTRACE_H */
arch/arm64/kernel/stacktrace.c +187 -23
270 lines not on this page · raw message
arch/arm64/kvm/Kconfig +3 -2
@@ -51,8 +51,9 @@ config NVHE_EL2_DEBUG depends on KVM help Say Y here to enable the debug mode for the non-VHE KVM EL2 object. - Failure reports will BUG() in the hypervisor. This is intended for - local EL2 hypervisor development. + Failure reports will BUG() in the hypervisor; and calls to hyp_panic() + will result in printing the hypervisor call stack. + This is intended for local EL2 hypervisor development. If unsure, say N.
arch/arm64/kvm/arm.c +1 -1
@@ -49,7 +49,7 @@ DEFINE_STATIC_KEY_FALSE(kvm_protected_mode_initialized); DECLARE_KVM_HYP_PER_CPU(unsigned long, kvm_hyp_vector); -static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page); +DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);unsigned long kvm_arm_hyp_percpu_base[NR_CPUS ]; DECLARE_KVM_NVHE_PER_CPU(struct kvm_nvhe_init_params, kvm_init_params);
arch/arm64/kvm/handle_exit.c +3 -0
@@ -17,6 +17,7 @@#include <asm/kvm_emulate.h> #include <asm/kvm_mmu.h> #include <asm/debug-monitors.h> +#include <asm/stacktrace.h> #include <asm/traps.h> #include <kvm/arm_hypercalls.h>
@@ -326,6 +327,8 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,kvm_err ("nVHE hyp panic at: %016llx!\n" , elr_virt + hyp_offset); } +kvm_nvhe_dump_backtrace (hyp_offset); +/* * Hyp has panicked and we're going to handle that by panicking the * kernel. The kernel offset will be revealed in the panic so we're
arch/arm64/kvm/hyp/nvhe/switch.c +18 -0
@@ -37,6 +37,22 @@ DEFINE_PER_CPU(unsigned long, kvm_hyp_vector);#ifdef CONFIG_NVHE_EL2_DEBUG DEFINE_PER_CPU(unsigned long [PAGE_SIZE/sizeof(long)], hyp_overflow_stack)__aligned(16) ; +DEFINE_PER_CPU(struct kvm_nvhe_panic_info, kvm_panic_info); + +static inline void cpu_prepare_nvhe_panic_info (void ) +{ +struct kvm_nvhe_panic_info *panic_info =this_cpu_ptr (&kvm_panic_info); +struct kvm_nvhe_init_params *params =this_cpu_ptr (&kvm_init_params); + + panic_info->hyp_stack_base = (unsigned long )(params->stack_hyp_va -PAGE_SIZE ); + panic_info->hyp_overflow_stack_base = (unsigned long )this_cpu_ptr (hyp_overflow_stack); + panic_info->fp = (unsigned long )__builtin_frame_address (0 ); + panic_info->pc = _THIS_IP_; +} +#else +static inline void cpu_prepare_nvhe_panic_info (void ) +{ +}#endif static void __activate_traps (struct kvm_vcpu *vcpu)
@@ -360,6 +376,8 @@ asmlinkage void __noreturn hyp_panic(void)struct kvm_cpu_context *host_ctxt;struct kvm_vcpu *vcpu; +cpu_prepare_nvhe_panic_info (); + host_ctxt = &this_cpu_ptr (&kvm_host_data)->host_ctxt; vcpu = host_ctxt->__hyp_running_vcpu;
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH v5 8/8 KVM: arm64: Symbolize the nVHE HYP backtrace
In reply to Kalesh SinghReintroduce the __kvm_nvhe_ symbols in kallsyms, ignoring the local symbols in this namespace. The local symbols are not informative and can cause aliasing issues when symbolizing the addresses.
With the necessary symbols now in kallsyms we can symbolize nVHE stacktrace addresses using the %pB print format specifier.
Example call trace:
[ 98.916444][ T426] kvm [426]: nVHE hyp panic at: [<ffffffc0096156fc>] __kvm_nvhe_overflow_stack+0x8/0x34! [ 98.918360][ T426] nVHE HYP call trace: [ 98.918692][ T426] kvm [426]: [<ffffffc009615aac>] __kvm_nvhe_cpu_prepare_nvhe_panic_info+0x4c/0x68 [ 98.919545][ T426] kvm [426]: [<ffffffc0096159a4>] __kvm_nvhe_hyp_panic+0x2c/0xe8 [ 98.920107][ T426] kvm [426]: [<ffffffc009615ad8>] __kvm_nvhe_hyp_panic_bad_stack+0x10/0x10 [ 98.920665][ T426] kvm [426]: [<ffffffc009610a4c>] __kvm_nvhe___kvm_hyp_host_vector+0x24c/0x794 [ 98.921292][ T426] kvm [426]: [<ffffffc009615718>] __kvm_nvhe_overflow_stack+0x24/0x34
. . .
[ 98.973382][ T426] kvm [426]: [<ffffffc009615718>] __kvm_nvhe_overflow_stack+0x24/0x34 [ 98.973816][ T426] kvm [426]: [<ffffffc0096152f4>] __kvm_nvhe___kvm_vcpu_run+0x38/0x438 [ 98.974255][ T426] kvm [426]: [<ffffffc009616f80>] __kvm_nvhe_handle___kvm_vcpu_run+0x1c4/0x364 [ 98.974719][ T426] kvm [426]: [<ffffffc009616928>] __kvm_nvhe_handle_trap+0xa8/0x130 [ 98.975152][ T426] kvm [426]: [<ffffffc009610064>] __kvm_nvhe___host_exit+0x64/0x64 [ 98.975588][ T426] ---- end of nVHE HYP call trace ----
---
Changes in v2:
- Fix printk warnings - %p expects (void *)
arch/arm64/kvm/handle_exit.c | 13 +++++-------- scripts/kallsyms.c | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-)
arch/arm64/kvm/handle_exit.c +5 -8
@@ -296,13 +296,8 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,u64 elr_in_kimg =__phys_to_kimg (elr_phys);u64 hyp_offset = elr_in_kimg -kaslr_offset () - elr_virt;u64 mode = spsr &PSR_MODE_MASK ; +u64 panic_addr = elr_virt + hyp_offset; -/* -* The nVHE hyp symbols are not included by kallsyms to avoid issues -* with aliasing. That means that the symbols cannot be printed with the -* "%pS" format specifier, so fall back to the vmlinux address if -* there's no better option. -*/ if (mode != PSR_MODE_EL2t && mode != PSR_MODE_EL2h) {kvm_err ("Invalid host exception to nVHE hyp!\n" ); } else if (ESR_ELx_EC(esr) == ESR_ELx_EC_BRK64 &&
@@ -322,9 +317,11 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,if (file)kvm_err ("nVHE hyp BUG at: %s:%u!\n" , file, line);else -kvm_err ("nVHE hyp BUG at: %016llx!\n" , elr_virt + hyp_offset); +kvm_err ("nVHE hyp BUG at: [<%016llx>] %pB!\n" , panic_addr, + (void *)panic_addr); }else { -kvm_err ("nVHE hyp panic at: %016llx!\n" , elr_virt + hyp_offset); +kvm_err ("nVHE hyp panic at: [<%016llx>] %pB!\n" , panic_addr, + (void *)panic_addr); }kvm_nvhe_dump_backtrace (hyp_offset);
scripts/kallsyms.c +1 -1
@@ -111,7 +111,7 @@ static bool is_ignored_symbol(const char *name, char type)".LASANPC" ,/* s390 kasan local symbols */ "__crc_" ,/* modversions */ "__efistub_" ,/* arm64 EFI stub namespace */ -"__kvm_nvhe_" ,/* arm64 non-VHE KVM namespace */ +"__kvm_nvhe_$" ,/* arm64 local symbols in non-VHE KVM namespace */ "__AArch64ADRPThunk_" ,/* arm64 lld */ "__ARMV5PILongThunk_" ,/* arm lld */ "__ARMV7PILongThunk_",
Signature · 6 lines
2.35.1.616.g0bdcbb4464-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm