diff options
Diffstat (limited to 'arch/ia64/ia32/binfmt_elf32.c')
-rw-r--r-- | arch/ia64/ia32/binfmt_elf32.c | 67 |
1 files changed, 16 insertions, 51 deletions
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c index 6f4d3d06f0ed..e1189ba1ca5e 100644 --- a/arch/ia64/ia32/binfmt_elf32.c +++ b/arch/ia64/ia32/binfmt_elf32.c | |||
@@ -195,62 +195,27 @@ ia64_elf32_init (struct pt_regs *regs) | |||
195 | ia32_load_state(current); | 195 | ia32_load_state(current); |
196 | } | 196 | } |
197 | 197 | ||
198 | /* | ||
199 | * Undo the override of setup_arg_pages() without this ia32_setup_arg_pages() | ||
200 | * will suffer infinite self recursion. | ||
201 | */ | ||
202 | #undef setup_arg_pages | ||
203 | |||
198 | int | 204 | int |
199 | ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack) | 205 | ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack) |
200 | { | 206 | { |
201 | unsigned long stack_base; | 207 | int ret; |
202 | struct vm_area_struct *mpnt; | 208 | |
203 | struct mm_struct *mm = current->mm; | 209 | ret = setup_arg_pages(bprm, IA32_STACK_TOP, executable_stack); |
204 | int i, ret; | 210 | if (!ret) { |
205 | 211 | /* | |
206 | stack_base = IA32_STACK_TOP - MAX_ARG_PAGES*PAGE_SIZE; | 212 | * Can't do it in ia64_elf32_init(). Needs to be done before |
207 | mm->arg_start = bprm->p + stack_base; | 213 | * calls to elf32_map() |
208 | 214 | */ | |
209 | bprm->p += stack_base; | 215 | current->thread.ppl = ia32_init_pp_list(); |
210 | if (bprm->loader) | ||
211 | bprm->loader += stack_base; | ||
212 | bprm->exec += stack_base; | ||
213 | |||
214 | mpnt = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); | ||
215 | if (!mpnt) | ||
216 | return -ENOMEM; | ||
217 | |||
218 | down_write(¤t->mm->mmap_sem); | ||
219 | { | ||
220 | mpnt->vm_mm = current->mm; | ||
221 | mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p; | ||
222 | mpnt->vm_end = IA32_STACK_TOP; | ||
223 | if (executable_stack == EXSTACK_ENABLE_X) | ||
224 | mpnt->vm_flags = VM_STACK_FLAGS | VM_EXEC; | ||
225 | else if (executable_stack == EXSTACK_DISABLE_X) | ||
226 | mpnt->vm_flags = VM_STACK_FLAGS & ~VM_EXEC; | ||
227 | else | ||
228 | mpnt->vm_flags = VM_STACK_FLAGS; | ||
229 | mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC)? | ||
230 | PAGE_COPY_EXEC: PAGE_COPY; | ||
231 | if ((ret = insert_vm_struct(current->mm, mpnt))) { | ||
232 | up_write(¤t->mm->mmap_sem); | ||
233 | kmem_cache_free(vm_area_cachep, mpnt); | ||
234 | return ret; | ||
235 | } | ||
236 | current->mm->stack_vm = current->mm->total_vm = vma_pages(mpnt); | ||
237 | } | 216 | } |
238 | 217 | ||
239 | for (i = 0 ; i < MAX_ARG_PAGES ; i++) { | 218 | return ret; |
240 | struct page *page = bprm->page[i]; | ||
241 | if (page) { | ||
242 | bprm->page[i] = NULL; | ||
243 | install_arg_page(mpnt, page, stack_base); | ||
244 | } | ||
245 | stack_base += PAGE_SIZE; | ||
246 | } | ||
247 | up_write(¤t->mm->mmap_sem); | ||
248 | |||
249 | /* Can't do it in ia64_elf32_init(). Needs to be done before calls to | ||
250 | elf32_map() */ | ||
251 | current->thread.ppl = ia32_init_pp_list(); | ||
252 | |||
253 | return 0; | ||
254 | } | 219 | } |
255 | 220 | ||
256 | static void | 221 | static void |