[PATCH] D64930: [ELF][AArch64] Allow PT_LOAD to have overlapping p_offset ranges
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 07:14:01 PDT 2019
peter.smith added a comment.
I think I know what is causing the kernel to fault the ELF file
The specific problem is the PT_LOAD before the PT_DYNAMIC, the p_vaddr is not congruent to the p_offset modulo p_align. It should be 0x19A0. If I hex edit the binary to make this the case I can get the ELF file to run. I think that this misalignment might be caused because p_filesz is 0, which might skip the alignment of the p_offset (not checked). When -znow is removed the ordering of some sections changes and there is no PT_LOAD with 0 p_filesz so everything gets aligned.
ProgramHeader {
Type: PT_LOAD (0x1)
Offset: 0x16B0
VirtualAddress: 0x36B0
PhysicalAddress: 0x36B0
FileSize: 744
MemSize: 744
Flags [ (0x6)
PF_R (0x4)
PF_W (0x2)
]
Alignment: 4096
}
ProgramHeader {
Type: PT_LOAD (0x1)
Offset: 0x1998
VirtualAddress: 0x49A0
PhysicalAddress: 0x49A0
FileSize: 0
MemSize: 65552
Flags [ (0x6)
PF_R (0x4)
PF_W (0x2)
]
Alignment: 4096
}
ProgramHeader {
Type: PT_DYNAMIC (0x2)
Offset: 0x16E8
VirtualAddress: 0x36E8
PhysicalAddress: 0x36E8
FileSize: 480
MemSize: 480
Flags [ (0x6)
PF_R (0x4)
PF_W (0x2)
]
Alignment: 8
}
@MaskRay are you ok to take it from here?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64930/new/
https://reviews.llvm.org/D64930
More information about the llvm-commits
mailing list