On 2024-04-02 10:34, Jan Beulich wrote:
On 27.03.2024 22:51, Jason Andryuk wrote:
v6:
Select alignment from, in order, Note, PHDRs, then default

The comment in the public header also needs to reflect this change.

Yes.  I'll update.

I'm going to tweak the code from elf->palign > PAGE_SIZE to >=, since PAGE_SIZE is a reasonable value to use.

+static bool __init check_and_adjust_load_address(
+    const struct domain *d, struct elf_binary *elf, struct elf_dom_parms 
*parms)
+{
+    paddr_t reloc_base;
+
+    if ( check_load_address(d, elf) )
+        return true;
+
+    if ( !parms->phys_reloc )
+    {
+        printk("%pd kernel: Address conflict and not relocatable\n", d);
+        return false;
+    }
+
+    reloc_base = find_kernel_memory(d, elf, parms);
+    if ( !reloc_base )
+    {
+        printk("%pd kernel: Failed find a load address\n", d);
+        return false;
+    }
+
+    if ( opt_dom0_verbose )
+        printk("%pd kernel: Moving [%p, %p] -> [%"PRIpaddr", %"PRIpaddr"]\n", 
d,
+               elf->dest_base, elf->dest_base + elf->dest_size - 1,
+               reloc_base, reloc_base + elf->dest_size - 1);
+
+    parms->phys_entry = reloc_base +
+                            (parms->phys_entry - (uintptr_t)elf->dest_base);

I think this would be easier to read as

     parms->phys_entry =
         reloc_base + (parms->phys_entry - (uintptr_t)elf->dest_base);

Everything else looks good to me now.

Sounds good to me.

Thanks,
Jason

Reply via email to