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

Re: [Xen-devel] [PATCH] x86/efi: Do not write relocations in efi_arch_relocate_image() first pass

On Wed, 2017-08-02 at 09:16 -0600, Jan Beulich wrote:
> Well, I've seen breakage in all sorts of places I wouldn't have expected
> anyone to fine a need to fiddle with.

This is the nature of 'value subtract', I suppose. 

How about something like this? Somewhat complicated by the fact that
COFF section names get truncated, so maybe there's a nicer place to put
it (or maybe we explicitly include .init.da into the .init.data output
section, in the efi.lds linker script, or something?)....

--- a/xen/arch/x86/efi/mkreloc.c
+++ b/xen/arch/x86/efi/mkreloc.c
@@ -346,6 +346,15 @@ int main(int argc, char *argv[])
              memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) == 0 )
+       /* For sections with relocations, force them to be writeable */
+       if (memcmp(sec1[i].name, ".init.da", sizeof(sec1[i].name)) == 0)
+               printf(".pushsection .init.data, \"awx\"\n");
+       else if (memcmp(sec1[i].name, ".init.te", sizeof(sec1[i].name) ) == 0)
+               printf(".pushsection .init.text, \"awx\"\n");
+       else
+               printf(".pushsection %.*s, \"awx\"\n", 
(int)sizeof(sec1[i].name), sec1[i].name);
+       printf(".popsection\n");
         if ( !sec1[i].rva )
             fprintf(stderr, "Can't handle section %u with zero RVA\n", i);

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Xen-devel mailing list



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