From e9b33def2522390a69c5c2c68a4fe8931043896a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 3 Jul 2002 19:35:03 +0000 Subject: 2002-07-03 Roland McGrath * elf-load.c (exec_load): Fix e_machine checking. --- serverboot/elf-load.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'serverboot/elf-load.c') diff --git a/serverboot/elf-load.c b/serverboot/elf-load.c index 5de838c3..603eadf0 100644 --- a/serverboot/elf-load.c +++ b/serverboot/elf-load.c @@ -61,8 +61,7 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t *read_exec, #endif if ((x.h.e_ident[EI_CLASS] != MY_CLASS) || - (x.h.e_ident[EI_DATA] != MY_DATA) || - (x.h.e_machine != MY_MACHINE)) + (x.h.e_ident[EI_DATA] != MY_DATA)) return EX_WRONG_ARCH; if (MY_CLASS == ELFCLASS64) @@ -70,6 +69,9 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t *read_exec, Elf64_Phdr *phdr, *ph; vm_size_t phsize; + if (x.h64.e_machine != MY_MACHINE) + return EX_WRONG_ARCH; + /* XXX others */ out_info->entry = (vm_offset_t) x.h64.e_entry; out_info->init_dp = 0; /* ? */ @@ -104,6 +106,9 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t *read_exec, Elf32_Phdr *phdr, *ph; vm_size_t phsize; + if (x.h.e_machine != MY_MACHINE) + return EX_WRONG_ARCH; + /* XXX others */ out_info->entry = (vm_offset_t) x.h.e_entry; out_info->init_dp = 0; /* ? */ -- cgit v1.2.3