[Letux-kernel] Bug with KVM: arm64: Avoid setting the upper 32 bits of TCR_EL2 and CPTR_EL2 to 1

Catalin Marinas catalin.marinas at arm.com
Thu Dec 16 18:25:49 CET 2021

On Thu, Dec 16, 2021 at 03:30:40PM +0100, H. Nikolaus Schaller wrote:
> > Am 16.12.2021 um 09:43 schrieb Marc Zyngier <maz at kernel.org>:
> > On 2021-12-16 06:58, H. Nikolaus Schaller wrote:
> >>> Am 15.12.2021 um 19:40 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> >>> this seems to break build of 5.10.y (and maybe earlier) for me:
> >>> CALL    scripts/checksyscalls.sh - due to target missing
> >>> CALL    scripts/atomic/check-atomics.sh - due to target missing
> >>> CHK     include/generated/compile.h
> >>> AS      arch/arm64/kvm/hyp/nvhe/hyp-init.nvhe.o - due to target missing
> >>> arch/arm64/kvm/hyp/nvhe/hyp-init.S: Assembler messages:
> >>> arch/arm64/kvm/hyp/nvhe/hyp-init.S:87: Error: missing ')'
> >>> arch/arm64/kvm/hyp/nvhe/hyp-init.S:87: Error: missing ')'
> >>> arch/arm64/kvm/hyp/nvhe/hyp-init.S:87: Error: missing ')'This should somehow be fixed so that arch/arm64/include/asm/kvm_arm.h
> >>> can be included by older assemblers.
> > 
> > GCC versions prior to 5.1 are known to miscompile the kernel,
> > and the minimal GCC version was bumped in dca5244d2f5b.
> > I am surprised this requirement wasn't backported to 5.10-stable,
> > as this results in all sorts of terrible bugs that are hard to
> > diagnose (see the horror story in the commit message).
> Indeed.
> My build system checks for existence of scripts/min-tool-version.sh
> and if it exists it chooses the right gcc version. If it does not exist
> it assumes that gcc 4.9 is still good enough...

I wonder whether the problem is binutils rather than gcc. We have a
minimum requirement of 2.23 but it looks like it failed to build for you
with 2.25. Unless the compiler got smarter and it drops the 'U' from 1U
when passing it to gas.

> Yes, it does! This can be compiled with gcc 4.9 (resp. binutils).
> So IMHO there are 3 different ways to solve it:
> a) your fix applied to 5.10.y
> b) someone backports scripts/min-tool-version.sh
> to allow for dependable automation...
> c) we leave 5.10.y unfixed and I just add a special
> rule for arm64 to choose a newer gcc (it is no problem to
> use 4.9 for other architectures) in my build setup.

Another option is to merge Marc's fix in 5.16 (there are two more 1U in
the same file) with a Fixes tag and cc stable so that it gets backported
to 5.10.y.


More information about the Letux-kernel mailing list