载荷段未对准

时间:2018-06-22 14:58:56

标签: linux linux-kernel

在Linux内核版本4.14.41中,只要对齐的LOAD段不是2MB的倍数,就会发生错误。但是,为什么不对Linux内核版本3.16.0执行相同的检查呢?另外,为什么不对任何Veriosn的32位已配置内核执行此检查?

1 个答案:

答案 0 :(得分:0)

在linux-4.9.91发行版中发布了针对64位的2 MB倍数的LOAD段对齐的检查。以下是arch/x86/Makefile的代码片段:

 #The 64-bit kernel must be aligned to 2MB.  Pass -z max-page-size=0x200000 to
 #the linker to force 2MB page size regardless of the default page size used
 #by the linker.
 ifdef CONFIG_X86_64
 LDFLAGS += $(call ld-option, -z max-page-size=0x200000) 
 endif

在以前的版本中没有这种类型的传递,但是64位LOAD节的对齐方式为2MB的倍数。如果不遵循这种对齐方式,则4.9.91及更高版本将产生错误Alignment of LOAD Segments is not a multiple of 2MB,而其他版本将产生错误Kernel is not a valid ELF file