summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-07-03 19:35:03 +0000
committerRoland McGrath <roland@gnu.org>2002-07-03 19:35:03 +0000
commitb51239a09ffcf29c5edf4f81a310f83f2da40a37 (patch)
tree3e22dea8111e27f65743c64979b555a1b3291a6c
parentf32e97da0560f0af3995ed4d25b06fe43588c993 (diff)
2002-07-03 Roland McGrath <roland@frob.com>
* elf-load.c (exec_load): Fix e_machine checking.
-rw-r--r--serverboot/elf-load.c9
1 files changed, 7 insertions, 2 deletions
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; /* ? */