* [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-05 20:21 ` Sami Tolvanen
0 siblings, 0 replies; 15+ messages in thread
From: Sami Tolvanen @ 2021-03-05 20:21 UTC (permalink / raw)
To: Marc Zyngier, James Morse
Cc: Nathan Chancellor, Nick Desaulniers, Ard Biesheuvel, Kees Cook,
Julien Thierry, Suzuki K Poulose, Catalin Marinas, Will Deacon,
linux-arm-kernel, kvmarm, linux-kernel, Sami Tolvanen
allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
linker errors:
ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
[-1048576, 1048575]; references hyp_panic
>>> defined in vmlinux.o
ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
[-1048576, 1048575]; references hyp_panic
>>> defined in vmlinux.o
This is because with LTO, the compiler ends up placing hyp_panic()
more than 1MB away from __guest_enter(). Use an unconditional branch
and adr_l instead to fix the issue.
Link: https://github.com/ClangBuiltLinux/linux/issues/1317
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Marc Zyngier <maz@kernel.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
---
arch/arm64/kvm/hyp/entry.S | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
index b0afad7a99c6..c62265951467 100644
--- a/arch/arm64/kvm/hyp/entry.S
+++ b/arch/arm64/kvm/hyp/entry.S
@@ -85,8 +85,10 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
// If the hyp context is loaded, go straight to hyp_panic
get_loaded_vcpu x0, x1
- cbz x0, hyp_panic
+ cbnz x0, 1f
+ b hyp_panic
+1:
// The hyp context is saved so make sure it is restored to allow
// hyp_panic to run at hyp and, subsequently, panic to run in the host.
// This makes use of __guest_exit to avoid duplication but sets the
@@ -94,7 +96,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
// current state is saved to the guest context but it will only be
// accurate if the guest had been completely restored.
adr_this_cpu x0, kvm_hyp_ctxt, x1
- adr x1, hyp_panic
+ adr_l x1, hyp_panic
str x1, [x0, #CPU_XREG_OFFSET(30)]
get_vcpu_ptr x1, x0
base-commit: 280d542f6ffac0e6d65dc267f92191d509b13b64
--
2.30.1.766.gb4fecdf3b7-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-05 20:21 ` Sami Tolvanen
0 siblings, 0 replies; 15+ messages in thread
From: Sami Tolvanen @ 2021-03-05 20:21 UTC (permalink / raw)
To: Marc Zyngier, James Morse
Cc: Kees Cook, Catalin Marinas, Nick Desaulniers, linux-kernel,
kvmarm, Nathan Chancellor, linux-arm-kernel, Sami Tolvanen,
Will Deacon
allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
linker errors:
ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
[-1048576, 1048575]; references hyp_panic
>>> defined in vmlinux.o
ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
[-1048576, 1048575]; references hyp_panic
>>> defined in vmlinux.o
This is because with LTO, the compiler ends up placing hyp_panic()
more than 1MB away from __guest_enter(). Use an unconditional branch
and adr_l instead to fix the issue.
Link: https://github.com/ClangBuiltLinux/linux/issues/1317
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Marc Zyngier <maz@kernel.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
---
arch/arm64/kvm/hyp/entry.S | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
index b0afad7a99c6..c62265951467 100644
--- a/arch/arm64/kvm/hyp/entry.S
+++ b/arch/arm64/kvm/hyp/entry.S
@@ -85,8 +85,10 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
// If the hyp context is loaded, go straight to hyp_panic
get_loaded_vcpu x0, x1
- cbz x0, hyp_panic
+ cbnz x0, 1f
+ b hyp_panic
+1:
// The hyp context is saved so make sure it is restored to allow
// hyp_panic to run at hyp and, subsequently, panic to run in the host.
// This makes use of __guest_exit to avoid duplication but sets the
@@ -94,7 +96,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
// current state is saved to the guest context but it will only be
// accurate if the guest had been completely restored.
adr_this_cpu x0, kvm_hyp_ctxt, x1
- adr x1, hyp_panic
+ adr_l x1, hyp_panic
str x1, [x0, #CPU_XREG_OFFSET(30)]
get_vcpu_ptr x1, x0
base-commit: 280d542f6ffac0e6d65dc267f92191d509b13b64
--
2.30.1.766.gb4fecdf3b7-goog
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
2021-03-05 20:21 ` Sami Tolvanen
(?)
@ 2021-03-05 20:22 ` Kees Cook
-1 siblings, 0 replies; 15+ messages in thread
From: Kees Cook @ 2021-03-05 20:22 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Marc Zyngier, James Morse, Nathan Chancellor, Nick Desaulniers,
Ard Biesheuvel, Julien Thierry, Suzuki K Poulose,
Catalin Marinas, Will Deacon, linux-arm-kernel, kvmarm,
linux-kernel
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-05 20:22 ` Kees Cook
0 siblings, 0 replies; 15+ messages in thread
From: Kees Cook @ 2021-03-05 20:22 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Marc Zyngier, James Morse, Nathan Chancellor, Nick Desaulniers,
Ard Biesheuvel, Julien Thierry, Suzuki K Poulose,
Catalin Marinas, Will Deacon, linux-arm-kernel, kvmarm,
linux-kernel
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-05 20:22 ` Kees Cook
0 siblings, 0 replies; 15+ messages in thread
From: Kees Cook @ 2021-03-05 20:22 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Marc Zyngier, Nick Desaulniers, linux-kernel, kvmarm,
Nathan Chancellor, linux-arm-kernel, Catalin Marinas,
Will Deacon
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
2021-03-05 20:21 ` Sami Tolvanen
(?)
@ 2021-03-07 4:35 ` Nathan Chancellor
-1 siblings, 0 replies; 15+ messages in thread
From: Nathan Chancellor @ 2021-03-07 4:35 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Marc Zyngier, James Morse, Kees Cook, Catalin Marinas,
Nick Desaulniers, linux-kernel, kvmarm, linux-arm-kernel,
Will Deacon
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
I booted an kernel with this patch in it on my Raspberry Pi 4 and booted
a kernel under KVM without any issues.
Tested-by: Nathan Chancellor <nathan@kernel.org>
> ---
> arch/arm64/kvm/hyp/entry.S | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
> index b0afad7a99c6..c62265951467 100644
> --- a/arch/arm64/kvm/hyp/entry.S
> +++ b/arch/arm64/kvm/hyp/entry.S
> @@ -85,8 +85,10 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
>
> // If the hyp context is loaded, go straight to hyp_panic
> get_loaded_vcpu x0, x1
> - cbz x0, hyp_panic
> + cbnz x0, 1f
> + b hyp_panic
>
> +1:
> // The hyp context is saved so make sure it is restored to allow
> // hyp_panic to run at hyp and, subsequently, panic to run in the host.
> // This makes use of __guest_exit to avoid duplication but sets the
> @@ -94,7 +96,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
> // current state is saved to the guest context but it will only be
> // accurate if the guest had been completely restored.
> adr_this_cpu x0, kvm_hyp_ctxt, x1
> - adr x1, hyp_panic
> + adr_l x1, hyp_panic
> str x1, [x0, #CPU_XREG_OFFSET(30)]
>
> get_vcpu_ptr x1, x0
>
> base-commit: 280d542f6ffac0e6d65dc267f92191d509b13b64
> --
> 2.30.1.766.gb4fecdf3b7-goog
>
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-07 4:35 ` Nathan Chancellor
0 siblings, 0 replies; 15+ messages in thread
From: Nathan Chancellor @ 2021-03-07 4:35 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Marc Zyngier, James Morse, Kees Cook, Catalin Marinas,
Nick Desaulniers, linux-kernel, kvmarm, linux-arm-kernel,
Will Deacon
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
I booted an kernel with this patch in it on my Raspberry Pi 4 and booted
a kernel under KVM without any issues.
Tested-by: Nathan Chancellor <nathan@kernel.org>
> ---
> arch/arm64/kvm/hyp/entry.S | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
> index b0afad7a99c6..c62265951467 100644
> --- a/arch/arm64/kvm/hyp/entry.S
> +++ b/arch/arm64/kvm/hyp/entry.S
> @@ -85,8 +85,10 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
>
> // If the hyp context is loaded, go straight to hyp_panic
> get_loaded_vcpu x0, x1
> - cbz x0, hyp_panic
> + cbnz x0, 1f
> + b hyp_panic
>
> +1:
> // The hyp context is saved so make sure it is restored to allow
> // hyp_panic to run at hyp and, subsequently, panic to run in the host.
> // This makes use of __guest_exit to avoid duplication but sets the
> @@ -94,7 +96,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
> // current state is saved to the guest context but it will only be
> // accurate if the guest had been completely restored.
> adr_this_cpu x0, kvm_hyp_ctxt, x1
> - adr x1, hyp_panic
> + adr_l x1, hyp_panic
> str x1, [x0, #CPU_XREG_OFFSET(30)]
>
> get_vcpu_ptr x1, x0
>
> base-commit: 280d542f6ffac0e6d65dc267f92191d509b13b64
> --
> 2.30.1.766.gb4fecdf3b7-goog
>
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-07 4:35 ` Nathan Chancellor
0 siblings, 0 replies; 15+ messages in thread
From: Nathan Chancellor @ 2021-03-07 4:35 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Kees Cook, Marc Zyngier, Nick Desaulniers, linux-kernel,
Catalin Marinas, Will Deacon, kvmarm, linux-arm-kernel
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
I booted an kernel with this patch in it on my Raspberry Pi 4 and booted
a kernel under KVM without any issues.
Tested-by: Nathan Chancellor <nathan@kernel.org>
> ---
> arch/arm64/kvm/hyp/entry.S | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
> index b0afad7a99c6..c62265951467 100644
> --- a/arch/arm64/kvm/hyp/entry.S
> +++ b/arch/arm64/kvm/hyp/entry.S
> @@ -85,8 +85,10 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
>
> // If the hyp context is loaded, go straight to hyp_panic
> get_loaded_vcpu x0, x1
> - cbz x0, hyp_panic
> + cbnz x0, 1f
> + b hyp_panic
>
> +1:
> // The hyp context is saved so make sure it is restored to allow
> // hyp_panic to run at hyp and, subsequently, panic to run in the host.
> // This makes use of __guest_exit to avoid duplication but sets the
> @@ -94,7 +96,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
> // current state is saved to the guest context but it will only be
> // accurate if the guest had been completely restored.
> adr_this_cpu x0, kvm_hyp_ctxt, x1
> - adr x1, hyp_panic
> + adr_l x1, hyp_panic
> str x1, [x0, #CPU_XREG_OFFSET(30)]
>
> get_vcpu_ptr x1, x0
>
> base-commit: 280d542f6ffac0e6d65dc267f92191d509b13b64
> --
> 2.30.1.766.gb4fecdf3b7-goog
>
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
2021-03-05 20:21 ` Sami Tolvanen
(?)
@ 2021-03-08 14:38 ` Will Deacon
-1 siblings, 0 replies; 15+ messages in thread
From: Will Deacon @ 2021-03-08 14:38 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Marc Zyngier, James Morse, Nathan Chancellor, Nick Desaulniers,
Ard Biesheuvel, Kees Cook, Julien Thierry, Suzuki K Poulose,
Catalin Marinas, linux-arm-kernel, kvmarm, linux-kernel
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> ---
> arch/arm64/kvm/hyp/entry.S | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Acked-by: Will Deacon <will@kernel.org>
Will
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-08 14:38 ` Will Deacon
0 siblings, 0 replies; 15+ messages in thread
From: Will Deacon @ 2021-03-08 14:38 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Marc Zyngier, James Morse, Nathan Chancellor, Nick Desaulniers,
Ard Biesheuvel, Kees Cook, Julien Thierry, Suzuki K Poulose,
Catalin Marinas, linux-arm-kernel, kvmarm, linux-kernel
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> ---
> arch/arm64/kvm/hyp/entry.S | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Acked-by: Will Deacon <will@kernel.org>
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-08 14:38 ` Will Deacon
0 siblings, 0 replies; 15+ messages in thread
From: Will Deacon @ 2021-03-08 14:38 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Kees Cook, Marc Zyngier, Nick Desaulniers, linux-kernel, kvmarm,
Nathan Chancellor, linux-arm-kernel, Catalin Marinas
On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
> relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> This is because with LTO, the compiler ends up placing hyp_panic()
> more than 1MB away from __guest_enter(). Use an unconditional branch
> and adr_l instead to fix the issue.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1317
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> ---
> arch/arm64/kvm/hyp/entry.S | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Acked-by: Will Deacon <will@kernel.org>
Will
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
2021-03-05 20:21 ` Sami Tolvanen
(?)
@ 2021-03-09 8:49 ` Marc Zyngier
-1 siblings, 0 replies; 15+ messages in thread
From: Marc Zyngier @ 2021-03-09 8:49 UTC (permalink / raw)
To: Sami Tolvanen, James Morse
Cc: kvmarm, linux-arm-kernel, Will Deacon, Kees Cook,
Nathan Chancellor, Nick Desaulniers, linux-kernel,
Catalin Marinas
On Fri, 5 Mar 2021 12:21:24 -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> [...]
Applied to next, thanks!
[1/1] KVM: arm64: Don't use cbz/adr with external symbols
commit: dbaee836d60a8e1b03e7d53a37893235662ba124
Cheers,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-09 8:49 ` Marc Zyngier
0 siblings, 0 replies; 15+ messages in thread
From: Marc Zyngier @ 2021-03-09 8:49 UTC (permalink / raw)
To: Sami Tolvanen, James Morse
Cc: kvmarm, linux-arm-kernel, Will Deacon, Kees Cook,
Nathan Chancellor, Nick Desaulniers, linux-kernel,
Catalin Marinas
On Fri, 5 Mar 2021 12:21:24 -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> [...]
Applied to next, thanks!
[1/1] KVM: arm64: Don't use cbz/adr with external symbols
commit: dbaee836d60a8e1b03e7d53a37893235662ba124
Cheers,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols
@ 2021-03-09 8:49 ` Marc Zyngier
0 siblings, 0 replies; 15+ messages in thread
From: Marc Zyngier @ 2021-03-09 8:49 UTC (permalink / raw)
To: Sami Tolvanen, James Morse
Cc: Kees Cook, Catalin Marinas, Nick Desaulniers, linux-kernel,
Nathan Chancellor, Will Deacon, kvmarm, linux-arm-kernel
On Fri, 5 Mar 2021 12:21:24 -0800, Sami Tolvanen wrote:
> allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
> linker errors:
>
> ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
> relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
> [-1048576, 1048575]; references hyp_panic
> >>> defined in vmlinux.o
>
> [...]
Applied to next, thanks!
[1/1] KVM: arm64: Don't use cbz/adr with external symbols
commit: dbaee836d60a8e1b03e7d53a37893235662ba124
Cheers,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply [flat|nested] 15+ messages in thread