aboutsummaryrefslogtreecommitdiff
path: root/pk
diff options
context:
space:
mode:
Diffstat (limited to 'pk')
-rw-r--r--pk/elf.c3
-rw-r--r--pk/elf.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/pk/elf.c b/pk/elf.c
index 43810ec..3a47e7e 100644
--- a/pk/elf.c
+++ b/pk/elf.c
@@ -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;
diff --git a/pk/elf.h b/pk/elf.h
index 99b2aee..3d1fae1 100644
--- a/pk/elf.h
+++ b/pk/elf.h
@@ -26,6 +26,7 @@
#define EF_RISCV_RVC 1
#define PT_LOAD 1
+#define PT_INTERP 3
#define AT_NULL 0
#define AT_PHDR 3