linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: arm64: Disable compiler instrumentation for hypervisor code
@ 2016-03-21 11:00 Catalin Marinas
  2016-03-21 13:01 ` Christoffer Dall
  0 siblings, 1 reply; 2+ messages in thread
From: Catalin Marinas @ 2016-03-21 11:00 UTC (permalink / raw)
  To: linux-arm-kernel

With the recent rewrite of the arm64 KVM hypervisor code in C, enabling
certain options like KASAN would allow the compiler to generate memory
accesses or function calls to addresses not mapped at EL2. This patch
disables the compiler instrumentation on the arm64 hypervisor code for
gcov-based profiling (GCOV_KERNEL), undefined behaviour sanity checker
(UBSAN) and kernel address sanitizer (KASAN).

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: <stable@vger.kernel.org> # 4.5+
---

A better fix, at least for KASAN, would be nice but that's a lot more
intrusive as we need to map the KASAN shadow into the EL2 space. In the
meantime, especially since it needs backporting to 4.5, this patch would
solve KASAN getting stuck with KVM (similar to what we do for EFI_STUB).

 arch/arm64/kvm/hyp/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile
index 826032bc3945..acde4782621a 100644
--- a/arch/arm64/kvm/hyp/Makefile
+++ b/arch/arm64/kvm/hyp/Makefile
@@ -12,3 +12,7 @@ obj-$(CONFIG_KVM_ARM_HOST) += switch.o
 obj-$(CONFIG_KVM_ARM_HOST) += fpsimd.o
 obj-$(CONFIG_KVM_ARM_HOST) += tlb.o
 obj-$(CONFIG_KVM_ARM_HOST) += hyp-entry.o
+
+GCOV_PROFILE	:= n
+KASAN_SANITIZE	:= n
+UBSAN_SANITIZE	:= n

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] kvm: arm64: Disable compiler instrumentation for hypervisor code
  2016-03-21 11:00 [PATCH] kvm: arm64: Disable compiler instrumentation for hypervisor code Catalin Marinas
@ 2016-03-21 13:01 ` Christoffer Dall
  0 siblings, 0 replies; 2+ messages in thread
From: Christoffer Dall @ 2016-03-21 13:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 21, 2016 at 11:00:17AM +0000, Catalin Marinas wrote:
> With the recent rewrite of the arm64 KVM hypervisor code in C, enabling
> certain options like KASAN would allow the compiler to generate memory
> accesses or function calls to addresses not mapped at EL2. This patch
> disables the compiler instrumentation on the arm64 hypervisor code for
> gcov-based profiling (GCOV_KERNEL), undefined behaviour sanity checker
> (UBSAN) and kernel address sanitizer (KASAN).
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Christoffer Dall <christoffer.dall@linaro.org>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: <stable@vger.kernel.org> # 4.5+

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>

Applied, thanks.
-Christoffer

> ---
> 
> A better fix, at least for KASAN, would be nice but that's a lot more
> intrusive as we need to map the KASAN shadow into the EL2 space. In the
> meantime, especially since it needs backporting to 4.5, this patch would
> solve KASAN getting stuck with KVM (similar to what we do for EFI_STUB).
> 
>  arch/arm64/kvm/hyp/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile
> index 826032bc3945..acde4782621a 100644
> --- a/arch/arm64/kvm/hyp/Makefile
> +++ b/arch/arm64/kvm/hyp/Makefile
> @@ -12,3 +12,7 @@ obj-$(CONFIG_KVM_ARM_HOST) += switch.o
>  obj-$(CONFIG_KVM_ARM_HOST) += fpsimd.o
>  obj-$(CONFIG_KVM_ARM_HOST) += tlb.o
>  obj-$(CONFIG_KVM_ARM_HOST) += hyp-entry.o
> +
> +GCOV_PROFILE	:= n
> +KASAN_SANITIZE	:= n
> +UBSAN_SANITIZE	:= n

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-21 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-21 11:00 [PATCH] kvm: arm64: Disable compiler instrumentation for hypervisor code Catalin Marinas
2016-03-21 13:01 ` Christoffer Dall

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).