summaryrefslogtreecommitdiff
path: root/serverboot
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
commite9b33def2522390a69c5c2c68a4fe8931043896a (patch)
tree2e7bf984d101cb2df3fa43e5168837ef504664b1 /serverboot
parent59bcec3846eb70175567175e85440140bc6e9a26 (diff)
2002-07-03 Roland McGrath <roland@frob.com>
* elf-load.c (exec_load): Fix e_machine checking.
Diffstat (limited to 'serverboot')
-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; /* ? */