jail: elf: Use 64 bit variables for elf offsets
The members p_offset, p_filesz and p_vaddr of the structure Elf64_Phdr
are all uint64_t. This structure is used for 64 bit applications.
Without this change we would convert the 64 bit values into 32 bit
values and an overflow could happen in this conversion.
On MIPS 64 BE the variable load_vaddr has the value 0x120000000 which
sets the 32th bit which will overflow when converted to a 32 bit value.
On 32 bit systems Elf32_Phdr is used with uint32_t, converting this to
64 bit values too should not cause problems as this is not in the hot
path.
Without this fix I am getting error messages like this at bootup on MIPS 64 BE:
[ 16.622602] do_page_fault(): sending SIGSEGV to ujail for invalid read access from
00000100f37251e3
[ 16.622907] epc =
000000aaab4ed0e0 in ujail[
aaab4e0000+18000]
[ 16.623237] ra =
000000aaab4ed694 in ujail[
aaab4e0000+18000]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>