#include <linux/personality.h>
#include <linux/init.h>
#include <linux/flat.h>
+#include <linux/vs_memory.h>
#include <asm/byteorder.h>
#include <asm/system.h>
#include <asm/uaccess.h>
-#include <asm/pgalloc.h>
#include <asm/unaligned.h>
#include <asm/cacheflush.h>
* size limits imposed on them by creating programs with large
* arrays in the data or bss.
*/
- rlim = current->rlim[RLIMIT_DATA].rlim_cur;
+ rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
if (rlim >= RLIM_INFINITY)
rlim = ~0;
if (data_len + bss_len > rlim)
DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n");
down_write(¤t->mm->mmap_sem);
- textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, 0, 0);
+ textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, MAP_SHARED, 0);
up_write(¤t->mm->mmap_sem);
if (!textpos || textpos >= (unsigned long) -4096) {
if (!textpos)
down_write(¤t->mm->mmap_sem);
realdatastart = do_mmap(0, 0, data_len + extra +
MAX_SHARED_LIBS * sizeof(unsigned long),
- PROT_READ|PROT_WRITE|PROT_EXEC, 0, 0);
+ PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
up_write(¤t->mm->mmap_sem);
if (realdatastart == 0 || realdatastart >= (unsigned long)-4096) {
down_write(¤t->mm->mmap_sem);
textpos = do_mmap(0, 0, text_len + data_len + extra +
MAX_SHARED_LIBS * sizeof(unsigned long),
- PROT_READ | PROT_EXEC | PROT_WRITE, 0, 0);
+ PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
up_write(¤t->mm->mmap_sem);
if (!textpos || textpos >= (unsigned long) -4096) {
if (!textpos)
current->mm->start_brk = datapos + data_len + bss_len;
current->mm->brk = (current->mm->start_brk + 3) & ~3;
current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len;
- current->mm->rss = 0;
+ set_mm_counter(current->mm, rss, 0);
}
if (flags & FLAT_FLAG_KTRACE)
return -ENOEXEC;
/* Get the pointer's value. */
- addr = flat_get_addr_from_rp(rp, relval);
+ addr = flat_get_addr_from_rp(rp, relval, flags);
if (addr != 0) {
/*
* Do the relocation. PIC relocs in the data section are
/****************************************************************************/
-module_init(init_flat_binfmt);
+core_initcall(init_flat_binfmt);
module_exit(exit_flat_binfmt);
/****************************************************************************/