elfload.c (b17780d52186c8bd94c722f6fc00d6d6b9fdcc5f) elfload.c (9de5e440b9f6a6c6305c0b81d1df4ddcc5a4b966)
1/* This is the Linux kernel elf-loading code, ported into user space */
2
3#include <stdio.h>
4#include <sys/types.h>
5#include <fcntl.h>
6#include <sys/stat.h>
7#include <errno.h>
8#include <unistd.h>

--- 247 unchanged lines hidden (view full) ---

256 if (bprm->loader) {
257 bprm->loader += stack_base;
258 }
259 bprm->exec += stack_base;
260
261 /* Create enough stack to hold everything. If we don't use
262 * it for args, we'll use it for something else...
263 */
1/* This is the Linux kernel elf-loading code, ported into user space */
2
3#include <stdio.h>
4#include <sys/types.h>
5#include <fcntl.h>
6#include <sys/stat.h>
7#include <errno.h>
8#include <unistd.h>

--- 247 unchanged lines hidden (view full) ---

256 if (bprm->loader) {
257 bprm->loader += stack_base;
258 }
259 bprm->exec += stack_base;
260
261 /* Create enough stack to hold everything. If we don't use
262 * it for args, we'll use it for something else...
263 */
264 /* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
265 we allocate a bigger stack. Need a better solution, for example
266 by remapping the process stack directly at the right place */
264 if(x86_stack_size > MAX_ARG_PAGES*X86_PAGE_SIZE) {
265 if((long)mmap4k((void *)(X86_STACK_TOP-x86_stack_size), x86_stack_size + X86_PAGE_SIZE,
266 PROT_READ | PROT_WRITE,
267 MAP_GROWSDOWN | MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) == -1) {
268 perror("stk mmap");
269 exit(-1);
270 }
271 }

--- 702 unchanged lines hidden ---
267 if(x86_stack_size > MAX_ARG_PAGES*X86_PAGE_SIZE) {
268 if((long)mmap4k((void *)(X86_STACK_TOP-x86_stack_size), x86_stack_size + X86_PAGE_SIZE,
269 PROT_READ | PROT_WRITE,
270 MAP_GROWSDOWN | MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) == -1) {
271 perror("stk mmap");
272 exit(-1);
273 }
274 }

--- 702 unchanged lines hidden ---