Re: [PATCH qemu] x86: don't let decompressed kernel image clobber setup_data

From: Philippe Mathieu-Daudé
Date: Thu Dec 29 2022 - 02:28:49 EST


On 29/12/22 03:31, Jason A. Donenfeld wrote:
Hi,

Read this message in a fixed width text editor with a lot of columns.

On Wed, Dec 28, 2022 at 03:58:12PM -0800, H. Peter Anvin wrote:
Glad you asked.

So the kernel load addresses are parameterized in the kernel image
setup header. One of the things that are so parameterized are the size
and possible realignment of the kernel image in memory.

I'm very confused where you are getting the 64 MB number from. There
should not be any such limitation.

[...]

Thanks for the diagrams. Feel free to include them in the commit
description ;)

In general, setup_data should be able to go anywhere the initrd can
go, and so is subject to the same address cap (896 MB for old kernels,
4 GB on newer ones; this address too is enumerated in the header.)

It would be theoretically possible to attach it to the initrd image
instead of to the kernel image. As a last resort, I guess I can look
into doing that. However, that's going to require some serious rework
and plumbing of a lot of different components. So if I can make it work
as is, that'd be ideal. However, I need to figure out this weird 62 meg
limitation.

Any ideas on that?

Could it be a limitation (internal buffer) of the decompressor?