summaryrefslogtreecommitdiffstats
path: root/fs/binfmt_aout.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-09 02:54:55 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-09 02:54:55 +0000
commit493c987f7a352ca64fdb4dc03a21e24cbaf46f55 (patch)
tree184cddc0925e082c0500afd042f92e9f340fe890 /fs/binfmt_aout.c
parent2d25612a92c62b5708d6d43f38d28c6141173328 (diff)
Merge with Linux 2.4.0-pre3-test6.
Diffstat (limited to 'fs/binfmt_aout.c')
-rw-r--r--fs/binfmt_aout.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index ade9091a5..b16b0db6a 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -321,21 +321,33 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
#endif
if (N_MAGIC(ex) == OMAGIC) {
+ unsigned long text_addr, map_size;
loff_t pos;
+
+ text_addr = N_TXTADDR(ex);
+
#if defined(__alpha__) || defined(__sparc__)
pos = fd_offset;
- do_brk(N_TXTADDR(ex) & PAGE_MASK,
- ex.a_text+ex.a_data + PAGE_SIZE - 1);
- bprm->file->f_op->read(bprm->file, (char *) N_TXTADDR(ex),
- ex.a_text+ex.a_data, &pos);
+ map_size = ex.a_text+ex.a_data + PAGE_SIZE - 1;
#else
pos = 32;
- do_brk(0, ex.a_text+ex.a_data);
- bprm->file->f_op->read(bprm->file, (char *) 0,
- ex.a_text+ex.a_data, &pos);
+ map_size = ex.a_text+ex.a_data;
#endif
- flush_icache_range((unsigned long) 0,
- (unsigned long) ex.a_text+ex.a_data);
+
+ error = do_brk(text_addr & PAGE_MASK, map_size);
+ if (error != (text_addr & PAGE_MASK)) {
+ send_sig(SIGKILL, current, 0);
+ return error;
+ }
+
+ error = bprm->file->f_op->read(bprm->file, (char *)text_addr,
+ ex.a_text+ex.a_data, &pos);
+ if (error < 0) {
+ send_sig(SIGKILL, current, 0);
+ return error;
+ }
+
+ flush_icache_range(text_addr, text_addr+ex.a_text+ex.a_data);
} else {
static unsigned long error_time, error_time2;
if ((ex.a_text & 0xfff || ex.a_data & 0xfff) &&