diff options
author | Luís Marques <luismarques@lowrisc.org> | 2019-10-01 12:13:28 +0100 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2019-10-01 13:13:28 +0200 |
commit | 099c99482f7ac032bf04caad13a9ca1da7ce58ed (patch) | |
tree | 2e9efe7aa5ea35bf411fc4df16b41f7a34738404 /pk/elf.c | |
parent | a3e4ac61d2b1ff37a22b9193b85d3b94273e80cb (diff) | |
download | pk-099c99482f7ac032bf04caad13a9ca1da7ce58ed.zip pk-099c99482f7ac032bf04caad13a9ca1da7ce58ed.tar.gz pk-099c99482f7ac032bf04caad13a9ca1da7ce58ed.tar.bz2 |
Only accept statically linked binaries (#176)
Diffstat (limited to 'pk/elf.c')
-rw-r--r-- | pk/elf.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -71,6 +71,9 @@ void load_elf(const char* fn, elf_info* info) info->entry = eh.e_entry + bias; int flags = MAP_FIXED | MAP_PRIVATE; for (int i = eh.e_phnum - 1; i >= 0; i--) { + if(ph[i].p_type == PT_INTERP) { + panic("not a statically linked ELF program"); + } if(ph[i].p_type == PT_LOAD && ph[i].p_memsz) { uintptr_t prepad = ph[i].p_vaddr % RISCV_PGSIZE; uintptr_t vaddr = ph[i].p_vaddr + bias; |