* [PATCH] KVM: arm64: Fix hypervisor address symbolization
@ 2022-07-15 23:58 Kalesh Singh
2022-07-17 10:43 ` Marc Zyngier
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kalesh Singh @ 2022-07-15 23:58 UTC (permalink / raw)
To: maz, mark.rutland, broonie, madvenka, tabba
Cc: will, qperret, android-mm, kernel-team, Kalesh Singh,
James Morse, Alexandru Elisei, Suzuki K Poulose, Catalin Marinas,
linux-arm-kernel, kvmarm, linux-kernel
With CONFIG_RANDOMIZE_BASE=y vmlinux addresses will resolve correctly
from kallsyms. Fix this by adding the KASLR offset before printing the
symbols.
Based on arm64 for-next/stacktrace.
Fixes: 6ccf9cb557bd ("KVM: arm64: Symbolize the nVHE HYP addresses")
Reported-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
---
arch/arm64/kvm/handle_exit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
index f66c0142b335..e43926ef2bc2 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -347,10 +347,10 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,
kvm_err("nVHE hyp BUG at: %s:%u!\n", file, line);
else
kvm_err("nVHE hyp BUG at: [<%016llx>] %pB!\n", panic_addr,
- (void *)panic_addr);
+ (void *)(panic_addr + kaslr_offset()));
} else {
kvm_err("nVHE hyp panic at: [<%016llx>] %pB!\n", panic_addr,
- (void *)panic_addr);
+ (void *)(panic_addr + kaslr_offset()));
}
/*
base-commit: 82a592c13b0aeff94d84d54183dae0b26384c95f
--
2.37.0.170.g444d1eabd0-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: arm64: Fix hypervisor address symbolization
2022-07-15 23:58 [PATCH] KVM: arm64: Fix hypervisor address symbolization Kalesh Singh
@ 2022-07-17 10:43 ` Marc Zyngier
2022-07-17 19:02 ` Kalesh Singh
2022-07-17 10:46 ` Marc Zyngier
2022-07-18 9:08 ` Fuad Tabba
2 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2022-07-17 10:43 UTC (permalink / raw)
To: Kalesh Singh
Cc: mark.rutland, broonie, madvenka, tabba, will, qperret,
android-mm, kernel-team, James Morse, Alexandru Elisei,
Suzuki K Poulose, Catalin Marinas, linux-arm-kernel, kvmarm,
linux-kernel
On Sat, 16 Jul 2022 00:58:24 +0100,
Kalesh Singh <kaleshsingh@google.com> wrote:
>
> With CONFIG_RANDOMIZE_BASE=y vmlinux addresses will resolve correctly
I guess you mean *incorrectly* here, right?
> from kallsyms. Fix this by adding the KASLR offset before printing the
> symbols.
>
> Based on arm64 for-next/stacktrace.
In general, place these remarks after the '---' line, as they don't
really make sense in the commit itself (which is likely to be merged
on a different base anyway).
>
> Fixes: 6ccf9cb557bd ("KVM: arm64: Symbolize the nVHE HYP addresses")
> Reported-by: Fuad Tabba <tabba@google.com>
> Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
> ---
> arch/arm64/kvm/handle_exit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> index f66c0142b335..e43926ef2bc2 100644
> --- a/arch/arm64/kvm/handle_exit.c
> +++ b/arch/arm64/kvm/handle_exit.c
> @@ -347,10 +347,10 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,
> kvm_err("nVHE hyp BUG at: %s:%u!\n", file, line);
> else
> kvm_err("nVHE hyp BUG at: [<%016llx>] %pB!\n", panic_addr,
> - (void *)panic_addr);
> + (void *)(panic_addr + kaslr_offset()));
> } else {
> kvm_err("nVHE hyp panic at: [<%016llx>] %pB!\n", panic_addr,
> - (void *)panic_addr);
> + (void *)(panic_addr + kaslr_offset()));
> }
>
> /*
>
I'll fix the above as I apply the patch, no need to respin.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: arm64: Fix hypervisor address symbolization
2022-07-15 23:58 [PATCH] KVM: arm64: Fix hypervisor address symbolization Kalesh Singh
2022-07-17 10:43 ` Marc Zyngier
@ 2022-07-17 10:46 ` Marc Zyngier
2022-07-18 9:08 ` Fuad Tabba
2 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2022-07-17 10:46 UTC (permalink / raw)
To: mark.rutland, broonie, Kalesh Singh, tabba, madvenka
Cc: linux-arm-kernel, Suzuki K Poulose, James Morse, will,
Alexandru Elisei, kernel-team, kvmarm, qperret, linux-kernel,
Catalin Marinas
On Fri, 15 Jul 2022 16:58:24 -0700, Kalesh Singh wrote:
> With CONFIG_RANDOMIZE_BASE=y vmlinux addresses will resolve correctly
> from kallsyms. Fix this by adding the KASLR offset before printing the
> symbols.
>
> Based on arm64 for-next/stacktrace.
Applied to next, thanks!
[1/1] KVM: arm64: Fix hypervisor address symbolization
commit: ed6313a93fd11d2015ad17046f3c418bf6a8dab1
Cheers,
M.
--
Marc Zyngier <maz@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: arm64: Fix hypervisor address symbolization
2022-07-17 10:43 ` Marc Zyngier
@ 2022-07-17 19:02 ` Kalesh Singh
0 siblings, 0 replies; 6+ messages in thread
From: Kalesh Singh @ 2022-07-17 19:02 UTC (permalink / raw)
To: Marc Zyngier
Cc: Mark Rutland, Mark Brown, Madhavan T. Venkataraman, Fuad Tabba,
Will Deacon, Quentin Perret, android-mm, Cc: Android Kernel,
James Morse, Alexandru Elisei, Suzuki K Poulose, Catalin Marinas,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
kvmarm, LKML
On Sun, Jul 17, 2022 at 3:43 AM Marc Zyngier <maz@kernel.org> wrote:
>
> On Sat, 16 Jul 2022 00:58:24 +0100,
> Kalesh Singh <kaleshsingh@google.com> wrote:
> >
> > With CONFIG_RANDOMIZE_BASE=y vmlinux addresses will resolve correctly
>
> I guess you mean *incorrectly* here, right?
Yes, sorry. "INcorrectly" I meant to say.
>
> > from kallsyms. Fix this by adding the KASLR offset before printing the
> > symbols.
> >
> > Based on arm64 for-next/stacktrace.
>
> In general, place these remarks after the '---' line, as they don't
> really make sense in the commit itself (which is likely to be merged
> on a different base anyway).
>
> >
> > Fixes: 6ccf9cb557bd ("KVM: arm64: Symbolize the nVHE HYP addresses")
> > Reported-by: Fuad Tabba <tabba@google.com>
> > Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
> > ---
> > arch/arm64/kvm/handle_exit.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> > index f66c0142b335..e43926ef2bc2 100644
> > --- a/arch/arm64/kvm/handle_exit.c
> > +++ b/arch/arm64/kvm/handle_exit.c
> > @@ -347,10 +347,10 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,
> > kvm_err("nVHE hyp BUG at: %s:%u!\n", file, line);
> > else
> > kvm_err("nVHE hyp BUG at: [<%016llx>] %pB!\n", panic_addr,
> > - (void *)panic_addr);
> > + (void *)(panic_addr + kaslr_offset()));
> > } else {
> > kvm_err("nVHE hyp panic at: [<%016llx>] %pB!\n", panic_addr,
> > - (void *)panic_addr);
> > + (void *)(panic_addr + kaslr_offset()));
> > }
> >
> > /*
> >
>
> I'll fix the above as I apply the patch, no need to respin.
Thanks Marc.
-- Kalesh
>
> Thanks,
>
> M.
>
> --
> Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: arm64: Fix hypervisor address symbolization
2022-07-15 23:58 [PATCH] KVM: arm64: Fix hypervisor address symbolization Kalesh Singh
2022-07-17 10:43 ` Marc Zyngier
2022-07-17 10:46 ` Marc Zyngier
@ 2022-07-18 9:08 ` Fuad Tabba
2022-07-18 17:09 ` Kalesh Singh
2 siblings, 1 reply; 6+ messages in thread
From: Fuad Tabba @ 2022-07-18 9:08 UTC (permalink / raw)
To: Kalesh Singh
Cc: maz, mark.rutland, broonie, madvenka, will, qperret, android-mm,
kernel-team, James Morse, Alexandru Elisei, Suzuki K Poulose,
Catalin Marinas, linux-arm-kernel, kvmarm, linux-kernel
Hi Kalesh,
On Sat, Jul 16, 2022 at 12:58 AM Kalesh Singh <kaleshsingh@google.com> wrote:
>
> With CONFIG_RANDOMIZE_BASE=y vmlinux addresses will resolve correctly
> from kallsyms. Fix this by adding the KASLR offset before printing the
> symbols.
>
> Based on arm64 for-next/stacktrace.
>
> Fixes: 6ccf9cb557bd ("KVM: arm64: Symbolize the nVHE HYP addresses")
> Reported-by: Fuad Tabba <tabba@google.com>
> Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
> ---
Even with this patch applied I still don't get symbolization unless I
disable randomization, either by setting CONFIG_RANDOMIZE_BASE=n or
pass nokaslr as a kernel parameter. I tried both and in either case it
works.
Thanks,
/fuad
> arch/arm64/kvm/handle_exit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> index f66c0142b335..e43926ef2bc2 100644
> --- a/arch/arm64/kvm/handle_exit.c
> +++ b/arch/arm64/kvm/handle_exit.c
> @@ -347,10 +347,10 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,
> kvm_err("nVHE hyp BUG at: %s:%u!\n", file, line);
> else
> kvm_err("nVHE hyp BUG at: [<%016llx>] %pB!\n", panic_addr,
> - (void *)panic_addr);
> + (void *)(panic_addr + kaslr_offset()));
> } else {
> kvm_err("nVHE hyp panic at: [<%016llx>] %pB!\n", panic_addr,
> - (void *)panic_addr);
> + (void *)(panic_addr + kaslr_offset()));
> }
>
> /*
>
> base-commit: 82a592c13b0aeff94d84d54183dae0b26384c95f
> --
> 2.37.0.170.g444d1eabd0-goog
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: arm64: Fix hypervisor address symbolization
2022-07-18 9:08 ` Fuad Tabba
@ 2022-07-18 17:09 ` Kalesh Singh
0 siblings, 0 replies; 6+ messages in thread
From: Kalesh Singh @ 2022-07-18 17:09 UTC (permalink / raw)
To: Fuad Tabba
Cc: Marc Zyngier, Mark Rutland, Mark Brown, Madhavan T. Venkataraman,
Will Deacon, Quentin Perret, android-mm, Cc: Android Kernel,
James Morse, Alexandru Elisei, Suzuki K Poulose, Catalin Marinas,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
kvmarm, LKML
On Mon, Jul 18, 2022 at 2:08 AM Fuad Tabba <tabba@google.com> wrote:
>
> Hi Kalesh,
>
> On Sat, Jul 16, 2022 at 12:58 AM Kalesh Singh <kaleshsingh@google.com> wrote:
> >
> > With CONFIG_RANDOMIZE_BASE=y vmlinux addresses will resolve correctly
> > from kallsyms. Fix this by adding the KASLR offset before printing the
> > symbols.
> >
> > Based on arm64 for-next/stacktrace.
> >
> > Fixes: 6ccf9cb557bd ("KVM: arm64: Symbolize the nVHE HYP addresses")
> > Reported-by: Fuad Tabba <tabba@google.com>
> > Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
> > ---
>
> Even with this patch applied I still don't get symbolization unless I
> disable randomization, either by setting CONFIG_RANDOMIZE_BASE=n or
> pass nokaslr as a kernel parameter. I tried both and in either case it
> works.
Hi Fuad,
Thanks for testing it. The fix only addressed the symbolization for
the hyp panic address. I plan to fix the symbolization of stacktrace
in the next version of this series.
--Kalesh
>
> Thanks,
> /fuad
>
>
> > arch/arm64/kvm/handle_exit.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> > index f66c0142b335..e43926ef2bc2 100644
> > --- a/arch/arm64/kvm/handle_exit.c
> > +++ b/arch/arm64/kvm/handle_exit.c
> > @@ -347,10 +347,10 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,
> > kvm_err("nVHE hyp BUG at: %s:%u!\n", file, line);
> > else
> > kvm_err("nVHE hyp BUG at: [<%016llx>] %pB!\n", panic_addr,
> > - (void *)panic_addr);
> > + (void *)(panic_addr + kaslr_offset()));
> > } else {
> > kvm_err("nVHE hyp panic at: [<%016llx>] %pB!\n", panic_addr,
> > - (void *)panic_addr);
> > + (void *)(panic_addr + kaslr_offset()));
> > }
> >
> > /*
> >
> > base-commit: 82a592c13b0aeff94d84d54183dae0b26384c95f
> > --
> > 2.37.0.170.g444d1eabd0-goog
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-18 17:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15 23:58 [PATCH] KVM: arm64: Fix hypervisor address symbolization Kalesh Singh
2022-07-17 10:43 ` Marc Zyngier
2022-07-17 19:02 ` Kalesh Singh
2022-07-17 10:46 ` Marc Zyngier
2022-07-18 9:08 ` Fuad Tabba
2022-07-18 17:09 ` Kalesh Singh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).