Linux 2.3.0
[davej-history.git] / fs / exec.c
blobcf5dc765b222c1e922ec50410dc4e1b3fc44ddd1
1 /*
2 * linux/fs/exec.c
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
7 /*
8 * #!-checking implemented by tytso.
9 */
11 * Demand-loading implemented 01.12.91 - no need to read anything but
12 * the header into memory. The inode of the executable is put into
13 * "current->executable", and page faults do the actual loading. Clean.
15 * Once more I can proudly say that linux stood up to being changed: it
16 * was less than 2 hours work to get demand-loading completely implemented.
18 * Demand loading changed July 1993 by Eric Youngdale. Use mmap instead,
19 * current->executable is only used by the procfs. This allows a dispatch
20 * table to check for several different types of binary formats. We keep
21 * trying until we recognize the file or we run out of supported binary
22 * formats.
25 #include <linux/config.h>
26 #include <linux/slab.h>
27 #include <linux/file.h>
28 #include <linux/mman.h>
29 #include <linux/a.out.h>
30 #include <linux/stat.h>
31 #include <linux/fcntl.h>
32 #include <linux/smp_lock.h>
33 #include <linux/init.h>
35 #include <asm/uaccess.h>
36 #include <asm/pgtable.h>
37 #include <asm/mmu_context.h>
39 #ifdef CONFIG_KMOD
40 #include <linux/kmod.h>
41 #endif
44 * Here are the actual binaries that will be accepted:
45 * add more with "register_binfmt()" if using modules...
47 * These are defined again for the 'real' modules if you are using a
48 * module definition for these routines.
51 static struct linux_binfmt *formats = (struct linux_binfmt *) NULL;
53 void __init binfmt_setup(void)
55 #ifdef CONFIG_BINFMT_MISC
56 init_misc_binfmt();
57 #endif
59 #ifdef CONFIG_BINFMT_ELF
60 init_elf_binfmt();
61 #endif
63 #ifdef CONFIG_BINFMT_ELF32
64 init_elf32_binfmt();
65 #endif
67 #ifdef CONFIG_BINFMT_AOUT
68 init_aout_binfmt();
69 #endif
71 #ifdef CONFIG_BINFMT_AOUT32
72 init_aout32_binfmt();
73 #endif
75 #ifdef CONFIG_BINFMT_JAVA
76 init_java_binfmt();
77 #endif
79 #ifdef CONFIG_BINFMT_EM86
80 init_em86_binfmt();
81 #endif
83 /* This cannot be configured out of the kernel */
84 init_script_binfmt();
87 int register_binfmt(struct linux_binfmt * fmt)
89 struct linux_binfmt ** tmp = &formats;
91 if (!fmt)
92 return -EINVAL;
93 if (fmt->next)
94 return -EBUSY;
95 while (*tmp) {
96 if (fmt == *tmp)
97 return -EBUSY;
98 tmp = &(*tmp)->next;
100 fmt->next = formats;
101 formats = fmt;
102 return 0;
105 #ifdef CONFIG_MODULES
106 int unregister_binfmt(struct linux_binfmt * fmt)
108 struct linux_binfmt ** tmp = &formats;
110 while (*tmp) {
111 if (fmt == *tmp) {
112 *tmp = fmt->next;
113 return 0;
115 tmp = &(*tmp)->next;
117 return -EINVAL;
119 #endif /* CONFIG_MODULES */
121 /* N.B. Error returns must be < 0 */
122 int open_dentry(struct dentry * dentry, int mode)
124 struct inode * inode = dentry->d_inode;
125 struct file * f;
126 int fd, error;
128 error = -EINVAL;
129 if (!inode->i_op || !inode->i_op->default_file_ops)
130 goto out;
131 fd = get_unused_fd();
132 if (fd >= 0) {
133 error = -ENFILE;
134 f = get_empty_filp();
135 if (!f)
136 goto out_fd;
137 f->f_flags = mode;
138 f->f_mode = (mode+1) & O_ACCMODE;
139 f->f_dentry = dentry;
140 f->f_pos = 0;
141 f->f_reada = 0;
142 f->f_op = inode->i_op->default_file_ops;
143 if (f->f_op->open) {
144 error = f->f_op->open(inode,f);
145 if (error)
146 goto out_filp;
148 fd_install(fd, f);
149 dget(dentry);
151 return fd;
153 out_filp:
154 if (error > 0)
155 error = -EIO;
156 put_filp(f);
157 out_fd:
158 put_unused_fd(fd);
159 out:
160 return error;
164 * Note that a shared library must be both readable and executable due to
165 * security reasons.
167 * Also note that we take the address to load from from the file itself.
169 asmlinkage int sys_uselib(const char * library)
171 int fd, retval;
172 struct file * file;
173 struct linux_binfmt * fmt;
175 lock_kernel();
176 fd = sys_open(library, 0, 0);
177 retval = fd;
178 if (fd < 0)
179 goto out;
180 file = fget(fd);
181 retval = -ENOEXEC;
182 if (file && file->f_dentry && file->f_op && file->f_op->read) {
183 for (fmt = formats ; fmt ; fmt = fmt->next) {
184 int (*fn)(int) = fmt->load_shlib;
185 if (!fn)
186 continue;
187 /* N.B. Should use file instead of fd */
188 retval = fn(fd);
189 if (retval != -ENOEXEC)
190 break;
193 fput(file);
194 sys_close(fd);
195 out:
196 unlock_kernel();
197 return retval;
201 * count() counts the number of arguments/envelopes
203 static int count(char ** argv)
205 int i = 0;
207 if (argv != NULL) {
208 for (;;) {
209 char * p;
210 int error;
212 error = get_user(p,argv);
213 if (error)
214 return error;
215 if (!p)
216 break;
217 argv++;
218 i++;
221 return i;
225 * 'copy_string()' copies argument/envelope strings from user
226 * memory to free pages in kernel mem. These are in a format ready
227 * to be put directly into the top of new user memory.
229 * Modified by TYT, 11/24/91 to add the from_kmem argument, which specifies
230 * whether the string and the string array are from user or kernel segments:
232 * from_kmem argv * argv **
233 * 0 user space user space
234 * 1 kernel space user space
235 * 2 kernel space kernel space
237 * We do this by playing games with the fs segment register. Since it
238 * is expensive to load a segment register, we try to avoid calling
239 * set_fs() unless we absolutely have to.
241 unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
242 unsigned long p, int from_kmem)
244 char *str;
245 mm_segment_t old_fs;
247 if (!p)
248 return 0; /* bullet-proofing */
249 old_fs = get_fs();
250 if (from_kmem==2)
251 set_fs(KERNEL_DS);
252 while (argc-- > 0) {
253 int len;
254 unsigned long pos;
256 if (from_kmem == 1)
257 set_fs(KERNEL_DS);
258 get_user(str, argv+argc);
259 if (!str)
260 panic("VFS: argc is wrong");
261 if (from_kmem == 1)
262 set_fs(old_fs);
263 len = strlen_user(str); /* includes the '\0' */
264 if (p < len) { /* this shouldn't happen - 128kB */
265 set_fs(old_fs);
266 return 0;
268 p -= len;
269 pos = p;
270 while (len) {
271 char *pag;
272 int offset, bytes_to_copy;
274 offset = pos % PAGE_SIZE;
275 if (!(pag = (char *) page[pos/PAGE_SIZE]) &&
276 !(pag = (char *) page[pos/PAGE_SIZE] =
277 (unsigned long *) get_free_page(GFP_USER))) {
278 if (from_kmem==2)
279 set_fs(old_fs);
280 return 0;
282 bytes_to_copy = PAGE_SIZE - offset;
283 if (bytes_to_copy > len)
284 bytes_to_copy = len;
285 copy_from_user(pag + offset, str, bytes_to_copy);
286 pos += bytes_to_copy;
287 str += bytes_to_copy;
288 len -= bytes_to_copy;
291 if (from_kmem==2)
292 set_fs(old_fs);
293 return p;
296 unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm)
298 unsigned long stack_base;
299 struct vm_area_struct *mpnt;
300 int i;
302 stack_base = STACK_TOP - MAX_ARG_PAGES*PAGE_SIZE;
304 p += stack_base;
305 if (bprm->loader)
306 bprm->loader += stack_base;
307 bprm->exec += stack_base;
309 mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
310 if (mpnt) {
311 mpnt->vm_mm = current->mm;
312 mpnt->vm_start = PAGE_MASK & (unsigned long) p;
313 mpnt->vm_end = STACK_TOP;
314 mpnt->vm_page_prot = PAGE_COPY;
315 mpnt->vm_flags = VM_STACK_FLAGS;
316 mpnt->vm_ops = NULL;
317 mpnt->vm_offset = 0;
318 mpnt->vm_file = NULL;
319 mpnt->vm_pte = 0;
320 insert_vm_struct(current->mm, mpnt);
321 current->mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
324 for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
325 if (bprm->page[i]) {
326 current->mm->rss++;
327 put_dirty_page(current,bprm->page[i],stack_base);
329 stack_base += PAGE_SIZE;
331 return p;
335 * Read in the complete executable. This is used for "-N" files
336 * that aren't on a block boundary, and for files on filesystems
337 * without bmap support.
339 int read_exec(struct dentry *dentry, unsigned long offset,
340 char * addr, unsigned long count, int to_kmem)
342 struct file file;
343 struct inode * inode = dentry->d_inode;
344 int result = -ENOEXEC;
346 if (!inode->i_op || !inode->i_op->default_file_ops)
347 goto end_readexec;
348 if (init_private_file(&file, dentry, 1))
349 goto end_readexec;
350 if (!file.f_op->read)
351 goto close_readexec;
352 if (file.f_op->llseek) {
353 if (file.f_op->llseek(&file,offset,0) != offset)
354 goto close_readexec;
355 } else
356 file.f_pos = offset;
357 if (to_kmem) {
358 mm_segment_t old_fs = get_fs();
359 set_fs(get_ds());
360 result = file.f_op->read(&file, addr, count, &file.f_pos);
361 set_fs(old_fs);
362 } else {
363 result = verify_area(VERIFY_WRITE, addr, count);
364 if (result)
365 goto close_readexec;
366 result = file.f_op->read(&file, addr, count, &file.f_pos);
368 close_readexec:
369 if (file.f_op->release)
370 file.f_op->release(inode,&file);
371 end_readexec:
372 return result;
375 static int exec_mmap(void)
377 struct mm_struct * mm, * old_mm;
378 int retval, nr;
380 if (atomic_read(&current->mm->count) == 1) {
381 flush_cache_mm(current->mm);
382 mm_release();
383 release_segments(current->mm);
384 exit_mmap(current->mm);
385 flush_tlb_mm(current->mm);
386 return 0;
389 retval = -ENOMEM;
390 mm = mm_alloc();
391 if (!mm)
392 goto fail_nomem;
394 mm->cpu_vm_mask = (1UL << smp_processor_id());
395 mm->total_vm = 0;
396 mm->rss = 0;
398 * Make sure we have a private ldt if needed ...
400 nr = current->tarray_ptr - &task[0];
401 copy_segments(nr, current, mm);
403 old_mm = current->mm;
404 current->mm = mm;
405 retval = new_page_tables(current);
406 if (retval)
407 goto fail_restore;
408 activate_context(current);
409 up(&mm->mmap_sem);
410 mm_release();
411 mmput(old_mm);
412 return 0;
415 * Failure ... restore the prior mm_struct.
417 fail_restore:
418 /* The pgd belongs to the parent ... don't free it! */
419 mm->pgd = NULL;
420 current->mm = old_mm;
421 /* restore the ldt for this task */
422 copy_segments(nr, current, NULL);
423 mmput(mm);
425 fail_nomem:
426 return retval;
430 * This function makes sure the current process has its own signal table,
431 * so that flush_signal_handlers can later reset the handlers without
432 * disturbing other processes. (Other processes might share the signal
433 * table via the CLONE_SIGHAND option to clone().)
436 static inline int make_private_signals(void)
438 struct signal_struct * newsig;
440 if (atomic_read(&current->sig->count) <= 1)
441 return 0;
442 newsig = kmalloc(sizeof(*newsig), GFP_KERNEL);
443 if (newsig == NULL)
444 return -ENOMEM;
445 spin_lock_init(&newsig->siglock);
446 atomic_set(&newsig->count, 1);
447 memcpy(newsig->action, current->sig->action, sizeof(newsig->action));
448 current->sig = newsig;
449 return 0;
453 * If make_private_signals() made a copy of the signal table, decrement the
454 * refcount of the original table, and free it if necessary.
455 * We don't do that in make_private_signals() so that we can back off
456 * in flush_old_exec() if an error occurs after calling make_private_signals().
459 static inline void release_old_signals(struct signal_struct * oldsig)
461 if (current->sig == oldsig)
462 return;
463 if (atomic_dec_and_test(&oldsig->count))
464 kfree(oldsig);
468 * These functions flushes out all traces of the currently running executable
469 * so that a new one can be started
472 static inline void flush_old_files(struct files_struct * files)
474 unsigned long j;
476 j = 0;
477 for (;;) {
478 unsigned long set, i;
480 i = j * __NFDBITS;
481 if (i >= files->max_fds)
482 break;
483 set = files->close_on_exec.fds_bits[j];
484 files->close_on_exec.fds_bits[j] = 0;
485 j++;
486 for ( ; set ; i++,set >>= 1) {
487 if (set & 1)
488 sys_close(i);
493 int flush_old_exec(struct linux_binprm * bprm)
495 char * name;
496 int i, ch, retval;
497 struct signal_struct * oldsig;
500 * Make sure we have a private signal table
502 oldsig = current->sig;
503 retval = make_private_signals();
504 if (retval) goto flush_failed;
507 * Release all of the old mmap stuff
509 retval = exec_mmap();
510 if (retval) goto mmap_failed;
512 /* This is the point of no return */
513 release_old_signals(oldsig);
515 if (current->euid == current->uid && current->egid == current->gid)
516 current->dumpable = 1;
517 name = bprm->filename;
518 for (i=0; (ch = *(name++)) != '\0';) {
519 if (ch == '/')
520 i = 0;
521 else
522 if (i < 15)
523 current->comm[i++] = ch;
525 current->comm[i] = '\0';
527 flush_thread();
529 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid ||
530 permission(bprm->dentry->d_inode,MAY_READ))
531 current->dumpable = 0;
533 flush_signal_handlers(current);
534 flush_old_files(current->files);
536 return 0;
538 mmap_failed:
539 if (current->sig != oldsig)
540 kfree(current->sig);
541 flush_failed:
542 current->sig = oldsig;
543 return retval;
547 * We mustn't allow tracing of suid binaries, unless
548 * the tracer has the capability to trace anything..
550 static inline int must_not_trace_exec(struct task_struct * p)
552 return (p->flags & PF_PTRACED) && !cap_raised(p->p_pptr->cap_effective, CAP_SYS_PTRACE);
556 * Fill the binprm structure from the inode.
557 * Check permissions, then read the first 512 bytes
559 int prepare_binprm(struct linux_binprm *bprm)
561 int mode;
562 int retval,id_change,cap_raised;
563 struct inode * inode = bprm->dentry->d_inode;
565 mode = inode->i_mode;
566 if (!S_ISREG(mode)) /* must be regular file */
567 return -EACCES;
568 if (!(mode & 0111)) /* with at least _one_ execute bit set */
569 return -EACCES;
570 if (IS_NOEXEC(inode)) /* FS mustn't be mounted noexec */
571 return -EACCES;
572 if (!inode->i_sb)
573 return -EACCES;
574 if ((retval = permission(inode, MAY_EXEC)) != 0)
575 return retval;
576 /* better not execute files which are being written to */
577 if (inode->i_writecount > 0)
578 return -ETXTBSY;
580 bprm->e_uid = current->euid;
581 bprm->e_gid = current->egid;
582 id_change = cap_raised = 0;
584 /* Set-uid? */
585 if (mode & S_ISUID) {
586 bprm->e_uid = inode->i_uid;
587 if (bprm->e_uid != current->euid)
588 id_change = 1;
591 /* Set-gid? */
593 * If setgid is set but no group execute bit then this
594 * is a candidate for mandatory locking, not a setgid
595 * executable.
597 if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
598 bprm->e_gid = inode->i_gid;
599 if (!in_group_p(bprm->e_gid))
600 id_change = 1;
603 /* We don't have VFS support for capabilities yet */
604 cap_clear(bprm->cap_inheritable);
605 cap_clear(bprm->cap_permitted);
606 cap_clear(bprm->cap_effective);
608 /* To support inheritance of root-permissions and suid-root
609 * executables under compatibility mode, we raise the
610 * effective and inherited bitmasks of the executable file
611 * (translation: we set the executable "capability dumb" and
612 * set the allowed set to maximum). We don't set any forced
613 * bits.
615 * If only the real uid is 0, we only raise the inheritable
616 * bitmask of the executable file (translation: we set the
617 * allowed set to maximum and the application to "capability
618 * smart").
621 if (!issecure(SECURE_NOROOT)) {
622 if (bprm->e_uid == 0 || current->uid == 0)
623 cap_set_full(bprm->cap_inheritable);
624 if (bprm->e_uid == 0)
625 cap_set_full(bprm->cap_effective);
628 /* Only if pP' is _not_ a subset of pP, do we consider there
629 * has been a capability related "change of capability". In
630 * such cases, we need to check that the elevation of
631 * privilege does not go against other system constraints.
632 * The new Permitted set is defined below -- see (***). */
634 kernel_cap_t working =
635 cap_combine(bprm->cap_permitted,
636 cap_intersect(bprm->cap_inheritable,
637 current->cap_inheritable));
638 if (!cap_issubset(working, current->cap_permitted)) {
639 cap_raised = 1;
643 if (id_change || cap_raised) {
644 /* We can't suid-execute if we're sharing parts of the executable */
645 /* or if we're being traced (or if suid execs are not allowed) */
646 /* (current->mm->count > 1 is ok, as we'll get a new mm anyway) */
647 if (IS_NOSUID(inode)
648 || must_not_trace_exec(current)
649 || (atomic_read(&current->fs->count) > 1)
650 || (atomic_read(&current->sig->count) > 1)
651 || (atomic_read(&current->files->count) > 1)) {
652 if (id_change && !capable(CAP_SETUID))
653 return -EPERM;
654 if (cap_raised && !capable(CAP_SETPCAP))
655 return -EPERM;
659 memset(bprm->buf,0,sizeof(bprm->buf));
660 return read_exec(bprm->dentry,0,bprm->buf,128,1);
664 * This function is used to produce the new IDs and capabilities
665 * from the old ones and the file's capabilities.
667 * The formula used for evolving capabilities is:
669 * pI' = pI
670 * (***) pP' = fP | (fI & pI)
671 * pE' = pP' & fE [NB. fE is 0 or ~0]
673 * I=Inheritable, P=Permitted, E=Effective // p=process, f=file
674 * ' indicates post-exec().
677 void compute_creds(struct linux_binprm *bprm)
679 int new_permitted = cap_t(bprm->cap_permitted) |
680 (cap_t(bprm->cap_inheritable) &
681 cap_t(current->cap_inheritable));
683 /* For init, we want to retain the capabilities set
684 * in the init_task struct. Thus we skip the usual
685 * capability rules */
686 if (current->pid != 1) {
687 cap_t(current->cap_permitted) = new_permitted;
688 cap_t(current->cap_effective) = new_permitted &
689 cap_t(bprm->cap_effective);
692 /* AUD: Audit candidate if current->cap_effective is set */
694 current->suid = current->euid = current->fsuid = bprm->e_uid;
695 current->sgid = current->egid = current->fsgid = bprm->e_gid;
696 if (current->euid != current->uid || current->egid != current->gid ||
697 !cap_issubset(new_permitted, current->cap_permitted))
698 current->dumpable = 0;
702 void remove_arg_zero(struct linux_binprm *bprm)
704 if (bprm->argc) {
705 unsigned long offset;
706 char * page;
707 offset = bprm->p % PAGE_SIZE;
708 page = (char*)bprm->page[bprm->p/PAGE_SIZE];
709 while(bprm->p++,*(page+offset++))
710 if(offset==PAGE_SIZE){
711 offset=0;
712 page = (char*)bprm->page[bprm->p/PAGE_SIZE];
714 bprm->argc--;
719 * cycle the list of binary formats handler, until one recognizes the image
721 int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
723 int try,retval=0;
724 struct linux_binfmt *fmt;
725 #ifdef __alpha__
726 /* handle /sbin/loader.. */
728 struct exec * eh = (struct exec *) bprm->buf;
729 struct linux_binprm bprm_loader;
731 if (!bprm->loader && eh->fh.f_magic == 0x183 &&
732 (eh->fh.f_flags & 0x3000) == 0x3000)
734 int i;
735 char * dynloader[] = { "/sbin/loader" };
736 struct dentry * dentry;
738 dput(bprm->dentry);
739 bprm->dentry = NULL;
741 bprm_loader.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
742 for (i=0 ; i<MAX_ARG_PAGES ; i++) /* clear page-table */
743 bprm_loader.page[i] = 0;
745 dentry = open_namei(dynloader[0], 0, 0);
746 retval = PTR_ERR(dentry);
747 if (IS_ERR(dentry))
748 return retval;
749 bprm->dentry = dentry;
750 bprm->loader = bprm_loader.p;
751 retval = prepare_binprm(bprm);
752 if (retval<0)
753 return retval;
754 /* should call search_binary_handler recursively here,
755 but it does not matter */
758 #endif
759 for (try=0; try<2; try++) {
760 for (fmt = formats ; fmt ; fmt = fmt->next) {
761 int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary;
762 if (!fn)
763 continue;
764 retval = fn(bprm, regs);
765 if (retval >= 0) {
766 if (bprm->dentry)
767 dput(bprm->dentry);
768 bprm->dentry = NULL;
769 current->did_exec = 1;
770 return retval;
772 if (retval != -ENOEXEC)
773 break;
774 if (!bprm->dentry) /* We don't have the dentry anymore */
775 return retval;
777 if (retval != -ENOEXEC) {
778 break;
779 #ifdef CONFIG_KMOD
780 }else{
781 #define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
782 char modname[20];
783 if (printable(bprm->buf[0]) &&
784 printable(bprm->buf[1]) &&
785 printable(bprm->buf[2]) &&
786 printable(bprm->buf[3]))
787 break; /* -ENOEXEC */
788 sprintf(modname, "binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
789 request_module(modname);
790 #endif
793 return retval;
798 * sys_execve() executes a new program.
800 int do_execve(char * filename, char ** argv, char ** envp, struct pt_regs * regs)
802 struct linux_binprm bprm;
803 struct dentry * dentry;
804 int retval;
805 int i;
807 bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
808 for (i=0 ; i<MAX_ARG_PAGES ; i++) /* clear page-table */
809 bprm.page[i] = 0;
811 dentry = open_namei(filename, 0, 0);
812 retval = PTR_ERR(dentry);
813 if (IS_ERR(dentry))
814 return retval;
816 bprm.dentry = dentry;
817 bprm.filename = filename;
818 bprm.sh_bang = 0;
819 bprm.java = 0;
820 bprm.loader = 0;
821 bprm.exec = 0;
822 if ((bprm.argc = count(argv)) < 0) {
823 dput(dentry);
824 return bprm.argc;
827 if ((bprm.envc = count(envp)) < 0) {
828 dput(dentry);
829 return bprm.envc;
832 retval = prepare_binprm(&bprm);
834 if (retval >= 0) {
835 bprm.p = copy_strings(1, &bprm.filename, bprm.page, bprm.p, 2);
836 bprm.exec = bprm.p;
837 bprm.p = copy_strings(bprm.envc,envp,bprm.page,bprm.p,0);
838 bprm.p = copy_strings(bprm.argc,argv,bprm.page,bprm.p,0);
839 if (!bprm.p)
840 retval = -E2BIG;
843 if (retval >= 0)
844 retval = search_binary_handler(&bprm,regs);
845 if (retval >= 0)
846 /* execve success */
847 return retval;
849 /* Something went wrong, return the inode and free the argument pages*/
850 if (bprm.dentry)
851 dput(bprm.dentry);
853 for (i=0 ; i<MAX_ARG_PAGES ; i++)
854 free_page(bprm.page[i]);
856 return retval;