浏览代码

[efi] Disallow R_X86_64_32 relocations

UEFI binaries may be relocated to any location within the 64-bit
address space.  We compile as position-independent code with hidden
visibility, which should force all relocation records to be either
PC-relative (in which case no PE relocations are required) or full
64-bit relocations.  There should be no R_X86_64_32 relocation
records, since that would imply an invalid assumption that code could
not be relocated above 4GB.

Remove support for R_X86_64_32 relocation records from util/elf2efi.c,
so that any such records result in a build failure rather than a
potential runtime failure.

Reported-by: Jan Kundrát <jkt@kde.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 年前
父节点
当前提交
907cffb7c5
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1
    2
      src/util/elf2efi.c

+ 1
- 2
src/util/elf2efi.c 查看文件

@@ -481,8 +481,7 @@ static void process_reloc ( bfd *bfd __attribute__ (( unused )),
481 481
 	} else if ( strcmp ( howto->name, "R_X86_64_64" ) == 0 ) {
482 482
 		/* Generate an 8-byte PE relocation */
483 483
 		generate_pe_reloc ( pe_reltab, offset, 8 );
484
-	} else if ( ( strcmp ( howto->name, "R_386_32" ) == 0 ) ||
485
-		    ( strcmp ( howto->name, "R_X86_64_32" ) == 0 ) ) {
484
+	} else if ( strcmp ( howto->name, "R_386_32" ) == 0 ) {
486 485
 		/* Generate a 4-byte PE relocation */
487 486
 		generate_pe_reloc ( pe_reltab, offset, 4 );
488 487
 	} else if ( strcmp ( howto->name, "R_386_16" ) == 0 ) {

正在加载...
取消
保存