Browse Source

Disallow execution of RVC binaries on non-RVC pk

pull/32/head
Andrew Waterman 10 years ago
parent
commit
7520a47419
  1. 4
      pk/elf.c
  2. 2
      pk/elf.h

4
pk/elf.c

@ -29,6 +29,10 @@ void load_elf(const char* fn, elf_info* info)
assert(IS_ELF32(eh));
#endif
#ifndef __riscv_compressed
assert(!(eh.e_flags & EF_RISCV_RVC));
#endif
uintptr_t min_vaddr = -1;
size_t phdr_size = eh.e_phnum * sizeof(Elf_Phdr);
if (phdr_size > info->phdr_size)

2
pk/elf.h

@ -23,6 +23,8 @@
#define ET_EXEC 2
#define ET_DYN 3
#define EF_RISCV_RVC 1
#define PT_LOAD 1
#define AT_NULL 0

Loading…
Cancel
Save