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

Re: [PATCH] libelf: Handle PVH kernels lacking ENTRY elfnote

On 14.10.2020 17:31, Jason Andryuk wrote:
> Linux kernels only have an ENTRY elfnote when built with CONFIG_PV.  A
> kernel build CONFIG_PVH=y CONFIG_PV=n lacks the note.  In this case,
> virt_entry will be UNSET_ADDR, overwritten by the ELF header e_entry,
> and fail the check against the virt address range.
> Change the code to only check virt_entry against the virtual address
> range if it was set upon entry to the function.

Not checking at all seems wrong to me. The ELF spec anyway says
"virtual address", so an out of bounds value is at least suspicious.

> Maybe the overwriting of virt_entry could be removed, but I don't know
> if there would be unintended consequences where (old?) kernels don't
> have an elfnote, but do have an in-range e_entry?  The failing kernel I
> just looked at has an e_entry of 0x1000000.

And if you dropped the overwriting, what entry point would we use
in the absence of an ELF note?

I'd rather put up the option of adjusting the entry (or the check),
if it looks like a valid physical address.




Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.