elf: Fix issue where KASLR was applied to non reloc executables

This commit is contained in:
mintsuki 2022-09-11 23:07:13 +02:00
parent 831af39ed4
commit fe647a067f
1 changed files with 1 additions and 1 deletions

View File

@ -486,7 +486,7 @@ bool elf64_load(uint8_t *elf, uint64_t *entry_point, uint64_t *_slide, uint32_t
} }
again: again:
if (kaslr) { if (*is_reloc && kaslr) {
slide = rand32() & ~(max_align - 1); slide = rand32() & ~(max_align - 1);
if ((*virtual_base - FIXED_HIGHER_HALF_OFFSET_64) + slide + image_size >= 0x80000000) { if ((*virtual_base - FIXED_HIGHER_HALF_OFFSET_64) + slide + image_size >= 0x80000000) {