mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
new helper: read_code()
switch binfmts that use ->read() to that (and to kernel_read() in several cases in binfmt_flat - sure, it's nommu, but still, doing ->read() into kmalloc'ed buffer...) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
3af0761307
commit
3dc20cb282
6 changed files with 42 additions and 67 deletions
|
@ -287,15 +287,12 @@ static int load_aout_binary(struct linux_binprm * bprm)
|
|||
return error;
|
||||
}
|
||||
|
||||
error = bprm->file->f_op->read(bprm->file,
|
||||
(char __user *)text_addr,
|
||||
ex.a_text+ex.a_data, &pos);
|
||||
error = read_code(bprm->file, text_addr, pos,
|
||||
ex.a_text+ex.a_data);
|
||||
if ((signed long)error < 0) {
|
||||
send_sig(SIGKILL, current, 0);
|
||||
return error;
|
||||
}
|
||||
|
||||
flush_icache_range(text_addr, text_addr+ex.a_text+ex.a_data);
|
||||
} else {
|
||||
if ((ex.a_text & 0xfff || ex.a_data & 0xfff) &&
|
||||
(N_MAGIC(ex) != NMAGIC) && printk_ratelimit())
|
||||
|
@ -311,14 +308,9 @@ static int load_aout_binary(struct linux_binprm * bprm)
|
|||
}
|
||||
|
||||
if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) {
|
||||
loff_t pos = fd_offset;
|
||||
vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
|
||||
bprm->file->f_op->read(bprm->file,
|
||||
(char __user *)N_TXTADDR(ex),
|
||||
ex.a_text+ex.a_data, &pos);
|
||||
flush_icache_range((unsigned long) N_TXTADDR(ex),
|
||||
(unsigned long) N_TXTADDR(ex) +
|
||||
ex.a_text+ex.a_data);
|
||||
read_code(bprm->file, N_TXTADDR(ex), fd_offset,
|
||||
ex.a_text + ex.a_data);
|
||||
goto beyond_if;
|
||||
}
|
||||
|
||||
|
@ -397,8 +389,6 @@ static int load_aout_library(struct file *file)
|
|||
start_addr = ex.a_entry & 0xfffff000;
|
||||
|
||||
if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) {
|
||||
loff_t pos = N_TXTOFF(ex);
|
||||
|
||||
if (printk_ratelimit())
|
||||
{
|
||||
printk(KERN_WARNING
|
||||
|
@ -407,11 +397,8 @@ static int load_aout_library(struct file *file)
|
|||
}
|
||||
vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
|
||||
|
||||
file->f_op->read(file, (char __user *)start_addr,
|
||||
ex.a_text + ex.a_data, &pos);
|
||||
flush_icache_range((unsigned long) start_addr,
|
||||
(unsigned long) start_addr + ex.a_text + ex.a_data);
|
||||
|
||||
read_code(file, start_addr, N_TXTOFF(ex),
|
||||
ex.a_text + ex.a_data);
|
||||
retval = 0;
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue