diff options
Diffstat (limited to 'arch/x86_64/ia32/ia32_binfmt.c')
-rw-r--r-- | arch/x86_64/ia32/ia32_binfmt.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c index 185399baaf6d..ed56a8806eab 100644 --- a/arch/x86_64/ia32/ia32_binfmt.c +++ b/arch/x86_64/ia32/ia32_binfmt.c | |||
@@ -232,9 +232,6 @@ do { \ | |||
232 | #define load_elf_binary load_elf32_binary | 232 | #define load_elf_binary load_elf32_binary |
233 | 233 | ||
234 | #define ELF_PLAT_INIT(r, load_addr) elf32_init(r) | 234 | #define ELF_PLAT_INIT(r, load_addr) elf32_init(r) |
235 | #define setup_arg_pages(bprm, stack_top, exec_stack) \ | ||
236 | ia32_setup_arg_pages(bprm, stack_top, exec_stack) | ||
237 | int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, int executable_stack); | ||
238 | 235 | ||
239 | #undef start_thread | 236 | #undef start_thread |
240 | #define start_thread(regs,new_rip,new_rsp) do { \ | 237 | #define start_thread(regs,new_rip,new_rsp) do { \ |
@@ -286,61 +283,6 @@ static void elf32_init(struct pt_regs *regs) | |||
286 | me->thread.es = __USER_DS; | 283 | me->thread.es = __USER_DS; |
287 | } | 284 | } |
288 | 285 | ||
289 | int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, | ||
290 | int executable_stack) | ||
291 | { | ||
292 | unsigned long stack_base; | ||
293 | struct vm_area_struct *mpnt; | ||
294 | struct mm_struct *mm = current->mm; | ||
295 | int i, ret; | ||
296 | |||
297 | stack_base = stack_top - MAX_ARG_PAGES * PAGE_SIZE; | ||
298 | mm->arg_start = bprm->p + stack_base; | ||
299 | |||
300 | bprm->p += stack_base; | ||
301 | if (bprm->loader) | ||
302 | bprm->loader += stack_base; | ||
303 | bprm->exec += stack_base; | ||
304 | |||
305 | mpnt = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); | ||
306 | if (!mpnt) | ||
307 | return -ENOMEM; | ||
308 | |||
309 | down_write(&mm->mmap_sem); | ||
310 | { | ||
311 | mpnt->vm_mm = mm; | ||
312 | mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p; | ||
313 | mpnt->vm_end = stack_top; | ||
314 | if (executable_stack == EXSTACK_ENABLE_X) | ||
315 | mpnt->vm_flags = VM_STACK_FLAGS | VM_EXEC; | ||
316 | else if (executable_stack == EXSTACK_DISABLE_X) | ||
317 | mpnt->vm_flags = VM_STACK_FLAGS & ~VM_EXEC; | ||
318 | else | ||
319 | mpnt->vm_flags = VM_STACK_FLAGS; | ||
320 | mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC) ? | ||
321 | PAGE_COPY_EXEC : PAGE_COPY; | ||
322 | if ((ret = insert_vm_struct(mm, mpnt))) { | ||
323 | up_write(&mm->mmap_sem); | ||
324 | kmem_cache_free(vm_area_cachep, mpnt); | ||
325 | return ret; | ||
326 | } | ||
327 | mm->stack_vm = mm->total_vm = vma_pages(mpnt); | ||
328 | } | ||
329 | |||
330 | for (i = 0 ; i < MAX_ARG_PAGES ; i++) { | ||
331 | struct page *page = bprm->page[i]; | ||
332 | if (page) { | ||
333 | bprm->page[i] = NULL; | ||
334 | install_arg_page(mpnt, page, stack_base); | ||
335 | } | ||
336 | stack_base += PAGE_SIZE; | ||
337 | } | ||
338 | up_write(&mm->mmap_sem); | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | EXPORT_SYMBOL(ia32_setup_arg_pages); | ||
343 | |||
344 | #ifdef CONFIG_SYSCTL | 286 | #ifdef CONFIG_SYSCTL |
345 | /* Register vsyscall32 into the ABI table */ | 287 | /* Register vsyscall32 into the ABI table */ |
346 | #include <linux/sysctl.h> | 288 | #include <linux/sysctl.h> |