Re: [PATCH v2 4/8] KVM: arm64: Generate hyp relocation data

From: Marc Zyngier
Date: Sat Jan 30 2021 - 13:11:32 EST


On Sat, 30 Jan 2021 16:11:04 +0000,
Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
>
> On Sat, Jan 30, 2021 at 01:44:15PM +0000, Marc Zyngier wrote:
> > From d80ca05b2ed90fc30d328041692fa80f525c8d12 Mon Sep 17 00:00:00 2001
> > From: Marc Zyngier <maz@xxxxxxxxxx>
> > Date: Sat, 30 Jan 2021 13:07:51 +0000
> > Subject: [PATCH] KVM: arm64: Make gen-hyprel endianness agnostic
> >
> > gen-hyprel is, for better or worse, a native-endian program:
> > it assumes that the ELF data structures are in the host's
> > endianness, and even assumes that the compiled kernel is
> > little-endian in one particular case.
> >
> > None of these assumptions hold true though: people actually build
> > (use?) BE arm64 kernels, and seem to avoid doing so on BE hosts.
> > Madness!
> >
> > In order to solve this, wrap each access to the ELF data structures
> > with the required byte-swapping magic. This requires to obtain
> > the kernel data structure, and provide per-endianess wrappers.
> >
> > This result in a kernel that links and even boots in a model.
> >
> > Fixes: 8c49b5d43d4c ("KVM: arm64: Generate hyp relocation data")
> > Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> > Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
>
> Tested-by: Guenter Roeck <linux@xxxxxxxxxxxx>
>
> Compiles and boots both big- and little-endian systems in qemu.

Great, thanks for confirming that it fixed this issue. Now applied to
kvm-arm64/hyp-reloc, and pushed out to kvmarm/next.

M.

--
Without deviation from the norm, progress is not possible.