Re: [kvmtool][PATCH v2] arm64: Obtain text offset from kernel image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 6/8/20 4:28 PM, Marc Zyngier wrote:
> Recent changes made to Linux 5.8 have outlined that kvmtool
> hardcodes the text offset instead of reading it from the arm64
> image itself.
>
> To address this, import the image header structure into kvmtool
> and do the right thing. 32bit guests are still loaded to their
> usual locations.
>
> While we're at it, check the image magic and default to the text
> offset to be 0x80000 when image_size is 0, as described in the
> kernel's booting.rst document.
>
> Cc: Alexandru Elisei <alexandru.elisei@xxxxxxx>
> Reported-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
> Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
> ---
>
> Notes:
>     v2: Check magic, assume offset to be 0x8000 if image_size is 0.
>
> [..]

I wanted to review the patch, but then I noticed that Will merged it. So I settled
for testing it, to make sure nothing breaks. I was able to reproduce the issue
reported on the mailing list - without this patch, when the kernel is compiled
with CONFIG_RANDOMIZE_BASE not set, the kernel doesn't boot; with this patch
applied, the same kernel boots successfully.

I also tested it with an aarch32 kernel, this is what I got:

$ taskset -c 4,5 ./lkvm run -c2 -m1024 -k ../kvmtool-vms/zImage -d
../kvmtool-vms/debian-10.3.0.img  -p 'earlycon root=/dev/vda2'
  # lkvm run -k ../kvmtool-vms/zImage -m 1024 -c 2 --name guest-1834
  Warning: Kernel image magic not matching
  Warning: unable to translate host address 0x13115a4c82d05a4d to guest
  Fatal: kernel image too big to contain in guest memory.

IMO, works as expected.

Thanks,
Alex
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux