[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels
On 2024-03-19 04:15, Jan Beulich wrote: On 18.03.2024 22:21, Jason Andryuk wrote:On 2024-03-15 05:48, Jan Beulich wrote:On 14.03.2024 20:19, Jason Andryuk wrote:On 2024-03-14 09:31, Jan Beulich wrote:On 13.03.2024 20:30, Jason Andryuk wrote:--- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -537,6 +537,108 @@ static paddr_t __init find_memory( return INVALID_PADDR; }+static bool __init check_load_address(+ const struct domain *d, const struct elf_binary *elf) +{ + paddr_t kernel_start = (paddr_t)elf->dest_base & PAGE_MASK; + paddr_t kernel_end = PAGE_ALIGN((paddr_t)elf->dest_base + elf->dest_size);Both casts act on a pointer value. Such cannot legitimately be converted to paddr_t; it only so happens that paddr_t is effectively the same as uintptr_t right now. (Same issue again further down.) That said, I notice we have pre-existing examples of this ...Yes, I followed existing code. Do you want dest_base to be switched to a uintptr_t?I think it was deliberately switched to being a pointer at some point, maybe even in a security fix.commit 65808a8ed41cc7c044f588bd6cab5af0fdc0e029 "libelf: check all pointer accesses", part of XSA-55, switched from a single dest pointer to dest_base & dest_size. For libxenguest, it's a pointer to guest-mapped memory to copy in the kernel. For PV dom0 creation, it's a pointer - Xen switches to the dom0 page tables and performs the copy with it as-is. For PVH dom0, it's a guest physical address. Are you looking for this to be addressed in this series?I'm sorry to ask, but what is "this" here? I'd like your change to leave all types alone. I'd further like your change to preferably avoid cloning questionable code (i.e. casts using the wrong type in particular). Plus, where technically possible, adhere to the general principle of avoiding casts (for typically being at least somewhat risky towards hiding potential bugs). I intended "this" to refer to changing dest_base's type. I won't do that. With some of your other suggestions, most castings are gone. Thanks, Jason
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |