Import 2.1.112pre1
[davej-history.git] / fs / exec.c
blob41ca7c2832d6729c093923ca5472e6cfe26851c0
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/fs.h>
26 #include <linux/sched.h>
27 #include <linux/kernel.h>
28 #include <linux/mm.h>
29 #include <linux/slab.h>
30 #include <linux/file.h>
31 #include <linux/mman.h>
32 #include <linux/a.out.h>
33 #include <linux/errno.h>
34 #include <linux/signal.h>
35 #include <linux/string.h>
36 #include <linux/stat.h>
37 #include <linux/fcntl.h>
38 #include <linux/ptrace.h>
39 #include <linux/user.h>
40 #include <linux/binfmts.h>
41 #include <linux/personality.h>
42 #include <linux/smp.h>
43 #include <linux/smp_lock.h>
44 #include <linux/init.h>
46 #include <asm/system.h>
47 #include <asm/uaccess.h>
48 #include <asm/pgtable.h>
49 #include <asm/mmu_context.h>
51 #include <linux/config.h>
53 #ifdef CONFIG_KMOD
54 #include <linux/kmod.h>
55 #endif
57 asmlinkage int sys_exit(int exit_code);
58 asmlinkage int sys_brk(unsigned long);
61 * Here are the actual binaries that will be accepted:
62 * add more with "register_binfmt()" if using modules...
64 * These are defined again for the 'real' modules if you are using a
65 * module definition for these routines.
68 static struct linux_binfmt *formats = (struct linux_binfmt *) NULL;
70 __initfunc(void binfmt_setup(void))
72 #ifdef CONFIG_BINFMT_MISC
73 init_misc_binfmt();
74 #endif
76 #ifdef CONFIG_BINFMT_ELF
77 init_elf_binfmt();
78 #endif
80 #ifdef CONFIG_BINFMT_ELF32
81 init_elf32_binfmt();
82 #endif
84 #ifdef CONFIG_BINFMT_AOUT
85 init_aout_binfmt();
86 #endif
88 #ifdef CONFIG_BINFMT_AOUT32
89 init_aout32_binfmt();
90 #endif
92 #ifdef CONFIG_BINFMT_JAVA
93 init_java_binfmt();
94 #endif
96 #ifdef CONFIG_BINFMT_EM86
97 init_em86_binfmt();
98 #endif
100 /* This cannot be configured out of the kernel */
101 init_script_binfmt();
104 int register_binfmt(struct linux_binfmt * fmt)
106 struct linux_binfmt ** tmp = &formats;
108 if (!fmt)
109 return -EINVAL;
110 if (fmt->next)
111 return -EBUSY;
112 while (*tmp) {
113 if (fmt == *tmp)
114 return -EBUSY;
115 tmp = &(*tmp)->next;
117 fmt->next = formats;
118 formats = fmt;
119 return 0;
122 #ifdef CONFIG_MODULES
123 int unregister_binfmt(struct linux_binfmt * fmt)
125 struct linux_binfmt ** tmp = &formats;
127 while (*tmp) {
128 if (fmt == *tmp) {
129 *tmp = fmt->next;
130 return 0;
132 tmp = &(*tmp)->next;
134 return -EINVAL;
136 #endif /* CONFIG_MODULES */
138 /* N.B. Error returns must be < 0 */
139 int open_dentry(struct dentry * dentry, int mode)
141 struct inode * inode = dentry->d_inode;
142 struct file * f;
143 int fd, error;
145 error = -EINVAL;
146 if (!inode->i_op || !inode->i_op->default_file_ops)
147 goto out;
148 fd = get_unused_fd();
149 if (fd >= 0) {
150 error = -ENFILE;
151 f = get_empty_filp();
152 if (!f)
153 goto out_fd;
154 f->f_flags = mode;
155 f->f_mode = (mode+1) & O_ACCMODE;
156 f->f_dentry = dentry;
157 f->f_pos = 0;
158 f->f_reada = 0;
159 f->f_op = inode->i_op->default_file_ops;
160 if (f->f_op->open) {
161 error = f->f_op->open(inode,f);
162 if (error)
163 goto out_filp;
165 fd_install(fd, f);
166 dget(dentry);
168 return fd;
170 out_filp:
171 if (error > 0)
172 error = -EIO;
173 put_filp(f);
174 out_fd:
175 put_unused_fd(fd);
176 out:
177 return error;
181 * Note that a shared library must be both readable and executable due to
182 * security reasons.
184 * Also note that we take the address to load from from the file itself.
186 asmlinkage int sys_uselib(const char * library)
188 int fd, retval;
189 struct file * file;
190 struct linux_binfmt * fmt;
192 lock_kernel();
193 fd = sys_open(library, 0, 0);
194 retval = fd;
195 if (fd < 0)
196 goto out;
197 file = fget(fd);
198 retval = -ENOEXEC;
199 if (file && file->f_dentry && file->f_op && file->f_op->read) {
200 for (fmt = formats ; fmt ; fmt = fmt->next) {
201 int (*fn)(int) = fmt->load_shlib;
202 if (!fn)
203 continue;
204 /* N.B. Should use file instead of fd */
205 retval = fn(fd);
206 if (retval != -ENOEXEC)
207 break;
210 fput(file);
211 sys_close(fd);
212 out:
213 unlock_kernel();
214 return retval;
218 * count() counts the number of arguments/envelopes
220 static int count(char ** argv)
222 int i = 0;
224 if (argv != NULL) {
225 for (;;) {
226 char * p;
227 int error;
229 error = get_user(p,argv);
230 if (error)
231 return error;
232 if (!p)
233 break;
234 argv++;
235 i++;
238 return i;
242 * 'copy_string()' copies argument/envelope strings from user
243 * memory to free pages in kernel mem. These are in a format ready
244 * to be put directly into the top of new user memory.
246 * Modified by TYT, 11/24/91 to add the from_kmem argument, which specifies
247 * whether the string and the string array are from user or kernel segments:
249 * from_kmem argv * argv **
250 * 0 user space user space
251 * 1 kernel space user space
252 * 2 kernel space kernel space
254 * We do this by playing games with the fs segment register. Since it
255 * is expensive to load a segment register, we try to avoid calling
256 * set_fs() unless we absolutely have to.
258 unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
259 unsigned long p, int from_kmem)
261 char *str;
262 mm_segment_t old_fs;
264 if (!p)
265 return 0; /* bullet-proofing */
266 old_fs = get_fs();
267 if (from_kmem==2)
268 set_fs(KERNEL_DS);
269 while (argc-- > 0) {
270 int len;
271 unsigned long pos;
273 if (from_kmem == 1)
274 set_fs(KERNEL_DS);
275 get_user(str, argv+argc);
276 if (!str)
277 panic("VFS: argc is wrong");
278 if (from_kmem == 1)
279 set_fs(old_fs);
280 len = strlen_user(str); /* includes the '\0' */
281 if (p < len) { /* this shouldn't happen - 128kB */
282 set_fs(old_fs);
283 return 0;
285 p -= len;
286 pos = p;
287 while (len) {
288 char *pag;
289 int offset, bytes_to_copy;
291 offset = pos % PAGE_SIZE;
292 if (!(pag = (char *) page[pos/PAGE_SIZE]) &&
293 !(pag = (char *) page[pos/PAGE_SIZE] =
294 (unsigned long *) get_free_page(GFP_USER))) {
295 if (from_kmem==2)
296 set_fs(old_fs);
297 return 0;
299 bytes_to_copy = PAGE_SIZE - offset;
300 if (bytes_to_copy > len)
301 bytes_to_copy = len;
302 copy_from_user(pag + offset, str, bytes_to_copy);
303 pos += bytes_to_copy;
304 str += bytes_to_copy;
305 len -= bytes_to_copy;
308 if (from_kmem==2)
309 set_fs(old_fs);
310 return p;
313 unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm)
315 unsigned long stack_base;
316 struct vm_area_struct *mpnt;
317 int i;
319 stack_base = STACK_TOP - MAX_ARG_PAGES*PAGE_SIZE;
321 p += stack_base;
322 if (bprm->loader)
323 bprm->loader += stack_base;
324 bprm->exec += stack_base;
326 mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
327 if (mpnt) {
328 mpnt->vm_mm = current->mm;
329 mpnt->vm_start = PAGE_MASK & (unsigned long) p;
330 mpnt->vm_end = STACK_TOP;
331 mpnt->vm_page_prot = PAGE_COPY;
332 mpnt->vm_flags = VM_STACK_FLAGS;
333 mpnt->vm_ops = NULL;
334 mpnt->vm_offset = 0;
335 mpnt->vm_file = NULL;
336 mpnt->vm_pte = 0;
337 insert_vm_struct(current->mm, mpnt);
338 current->mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
341 for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
342 if (bprm->page[i]) {
343 current->mm->rss++;
344 put_dirty_page(current,bprm->page[i],stack_base);
346 stack_base += PAGE_SIZE;
348 return p;
352 * Read in the complete executable. This is used for "-N" files
353 * that aren't on a block boundary, and for files on filesystems
354 * without bmap support.
356 int read_exec(struct dentry *dentry, unsigned long offset,
357 char * addr, unsigned long count, int to_kmem)
359 struct file file;
360 struct inode * inode = dentry->d_inode;
361 int result = -ENOEXEC;
363 if (!inode->i_op || !inode->i_op->default_file_ops)
364 goto end_readexec;
365 if (init_private_file(&file, dentry, 1))
366 goto end_readexec;
367 if (!file.f_op->read)
368 goto close_readexec;
369 if (file.f_op->llseek) {
370 if (file.f_op->llseek(&file,offset,0) != offset)
371 goto close_readexec;
372 } else
373 file.f_pos = offset;
374 if (to_kmem) {
375 mm_segment_t old_fs = get_fs();
376 set_fs(get_ds());
377 result = file.f_op->read(&file, addr, count, &file.f_pos);
378 set_fs(old_fs);
379 } else {
380 result = verify_area(VERIFY_WRITE, addr, count);
381 if (result)
382 goto close_readexec;
383 result = file.f_op->read(&file, addr, count, &file.f_pos);
385 close_readexec:
386 if (file.f_op->release)
387 file.f_op->release(inode,&file);
388 end_readexec:
389 return result;
392 static int exec_mmap(void)
394 struct mm_struct * mm, * old_mm;
395 int retval;
397 if (current->mm->count == 1) {
398 flush_cache_mm(current->mm);
399 exit_mmap(current->mm);
400 clear_page_tables(current);
401 flush_tlb_mm(current->mm);
402 return 0;
406 * The clear_page_tables done later on exec does the right thing
407 * to the page directory when shared, except for graceful abort
408 * (the oom is wrong there, too, IMHO)
410 retval = -ENOMEM;
411 mm = mm_alloc();
412 if (!mm)
413 goto fail_nomem;
414 mm->cpu_vm_mask = (1UL << smp_processor_id());
415 mm->total_vm = 0;
416 mm->rss = 0;
417 old_mm = current->mm;
418 current->mm = mm;
419 retval = new_page_tables(current);
420 if (retval)
421 goto fail_restore;
422 activate_context(current);
423 up(&mm->mmap_sem);
424 mmput(old_mm);
425 return 0;
428 * Failure ... restore the prior mm_struct.
430 fail_restore:
431 /* The pgd belongs to the parent ... don't free it! */
432 mm->pgd = NULL;
433 current->mm = old_mm;
434 mmput(mm);
436 fail_nomem:
437 return retval;
441 * This function makes sure the current process has its own signal table,
442 * so that flush_old_signals can later reset the signals without disturbing
443 * other processes. (Other processes might share the signal table via
444 * the CLONE_SIGHAND option to clone().)
447 static inline int make_private_signals(void)
449 struct signal_struct * newsig;
451 if (atomic_read(&current->sig->count) <= 1)
452 return 0;
453 newsig = kmalloc(sizeof(*newsig), GFP_KERNEL);
454 if (newsig == NULL)
455 return -ENOMEM;
456 spin_lock_init(&newsig->siglock);
457 atomic_set(&newsig->count, 1);
458 memcpy(newsig->action, current->sig->action, sizeof(newsig->action));
459 current->sig = newsig;
460 return 0;
464 * If make_private_signals() made a copy of the signal table, decrement the
465 * refcount of the original table, and free it if necessary.
466 * We don't do that in make_private_signals() so that we can back off
467 * in flush_old_exec() if an error occurs after calling make_private_signals().
470 static inline void release_old_signals(struct signal_struct * oldsig)
472 if (current->sig == oldsig)
473 return;
474 if (atomic_dec_and_test(&oldsig->count))
475 kfree(oldsig);
479 * These functions flushes out all traces of the currently running executable
480 * so that a new one can be started
483 static inline void flush_old_signals(struct task_struct *t)
485 flush_signals(t);
486 flush_signal_handlers(t);
489 static inline void flush_old_files(struct files_struct * files)
491 unsigned long j;
493 j = 0;
494 for (;;) {
495 unsigned long set, i;
497 i = j * __NFDBITS;
498 if (i >= files->max_fds)
499 break;
500 set = files->close_on_exec.fds_bits[j];
501 files->close_on_exec.fds_bits[j] = 0;
502 j++;
503 for ( ; set ; i++,set >>= 1) {
504 if (set & 1)
505 sys_close(i);
510 int flush_old_exec(struct linux_binprm * bprm)
512 char * name;
513 int i, ch, retval;
514 struct signal_struct * oldsig;
517 * Make sure we have a private signal table
519 oldsig = current->sig;
520 retval = make_private_signals();
521 if (retval) goto flush_failed;
524 * Release all of the old mmap stuff
526 retval = exec_mmap();
527 if (retval) goto mmap_failed;
529 /* This is the point of no return */
530 release_old_signals(oldsig);
532 if (current->euid == current->uid && current->egid == current->gid)
533 current->dumpable = 1;
534 name = bprm->filename;
535 for (i=0; (ch = *(name++)) != '\0';) {
536 if (ch == '/')
537 i = 0;
538 else
539 if (i < 15)
540 current->comm[i++] = ch;
542 current->comm[i] = '\0';
544 flush_thread();
546 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid ||
547 permission(bprm->dentry->d_inode,MAY_READ))
548 current->dumpable = 0;
550 flush_old_signals(current);
551 flush_old_files(current->files);
553 return 0;
555 mmap_failed:
556 if (current->sig != oldsig)
557 kfree(current->sig);
558 flush_failed:
559 current->sig = oldsig;
560 return retval;
564 * Fill the binprm structure from the inode.
565 * Check permissions, then read the first 512 bytes
567 int prepare_binprm(struct linux_binprm *bprm)
569 int mode;
570 int retval,id_change,cap_raised;
571 struct inode * inode = bprm->dentry->d_inode;
573 mode = inode->i_mode;
574 if (!S_ISREG(mode)) /* must be regular file */
575 return -EACCES;
576 if (!(mode & 0111)) /* with at least _one_ execute bit set */
577 return -EACCES;
578 if (IS_NOEXEC(inode)) /* FS mustn't be mounted noexec */
579 return -EACCES;
580 if (!inode->i_sb)
581 return -EACCES;
582 if ((retval = permission(inode, MAY_EXEC)) != 0)
583 return retval;
584 /* better not execute files which are being written to */
585 if (inode->i_writecount > 0)
586 return -ETXTBSY;
588 bprm->e_uid = current->euid;
589 bprm->e_gid = current->egid;
590 id_change = cap_raised = 0;
592 /* Set-uid? */
593 if (mode & S_ISUID) {
594 bprm->e_uid = inode->i_uid;
595 if (bprm->e_uid != current->euid)
596 id_change = 1;
599 /* Set-gid? */
601 * If setgid is set but no group execute bit then this
602 * is a candidate for mandatory locking, not a setgid
603 * executable.
605 if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
606 bprm->e_gid = inode->i_gid;
607 if (!in_group_p(bprm->e_gid))
608 id_change = 1;
611 /* We don't have VFS support for capabilities yet */
612 cap_clear(bprm->cap_inheritable);
613 cap_clear(bprm->cap_permitted);
614 cap_clear(bprm->cap_effective);
616 /* To support inheritance of root-permissions and suid-root
617 * executables under compatibility mode, we raise the
618 * effective and inherited bitmasks of the executable file
619 * (translation: we set the executable "capability dumb" and
620 * set the allowed set to maximum). We don't set any forced
621 * bits.
623 * If only the real uid is 0, we only raise the inheritable
624 * bitmask of the executable file (translation: we set the
625 * allowed set to maximum and the application to "capability
626 * smart").
629 if (!issecure(SECURE_NOROOT)) {
630 if (bprm->e_uid == 0 || current->uid == 0)
631 cap_set_full(bprm->cap_inheritable);
632 if (bprm->e_uid == 0)
633 cap_set_full(bprm->cap_effective);
636 /* Only if pP' is _not_ a subset of pP, do we consider there
637 * has been a capability related "change of capability". In
638 * such cases, we need to check that the elevation of
639 * privilege does not go against other system constraints.
640 * The new Permitted set is defined below -- see (***). */
642 kernel_cap_t working =
643 cap_combine(bprm->cap_permitted,
644 cap_intersect(bprm->cap_inheritable,
645 current->cap_inheritable));
646 if (!cap_issubset(working, current->cap_permitted)) {
647 cap_raised = 1;
654 if (id_change || cap_raised) {
655 /* We can't suid-execute if we're sharing parts of the executable */
656 /* or if we're being traced (or if suid execs are not allowed) */
657 /* (current->mm->count > 1 is ok, as we'll get a new mm anyway) */
658 if (IS_NOSUID(inode)
659 || (current->flags & PF_PTRACED)
660 || (current->fs->count > 1)
661 || (atomic_read(&current->sig->count) > 1)
662 || (current->files->count > 1)) {
663 if (id_change && !capable(CAP_SETUID))
664 return -EPERM;
665 if (cap_raised && !capable(CAP_SETPCAP))
666 return -EPERM;
670 memset(bprm->buf,0,sizeof(bprm->buf));
671 return read_exec(bprm->dentry,0,bprm->buf,128,1);
675 * This function is used to produce the new IDs and capabilities
676 * from the old ones and the file's capabilities.
678 * The formula used for evolving capabilities is:
680 * pI' = pI
681 * (***) pP' = fP | (fI & pI)
682 * pE' = pP' & fE [NB. fE is 0 or ~0]
684 * I=Inheritable, P=Permitted, E=Effective // p=process, f=file
685 * ' indicates post-exec().
688 void compute_creds(struct linux_binprm *bprm)
690 /* For init, we want to retain the capabilities set
691 * in the init_task struct. Thus we skip the usual
692 * capability rules */
693 if (current->pid != 1) {
694 int new_permitted = bprm->cap_permitted.cap |
695 (bprm->cap_inheritable.cap &
696 current->cap_inheritable.cap);
698 current->cap_permitted.cap = new_permitted;
699 current->cap_effective.cap = new_permitted &
700 bprm->cap_effective.cap;
703 /* AUD: Audit candidate if current->cap_effective is set */
705 current->suid = current->euid = current->fsuid = bprm->e_uid;
706 current->sgid = current->egid = current->fsgid = bprm->e_gid;
707 if (current->euid != current->uid || current->egid != current->gid ||
708 !cap_isclear(current->cap_permitted))
709 current->dumpable = 0;
713 void remove_arg_zero(struct linux_binprm *bprm)
715 if (bprm->argc) {
716 unsigned long offset;
717 char * page;
718 offset = bprm->p % PAGE_SIZE;
719 page = (char*)bprm->page[bprm->p/PAGE_SIZE];
720 while(bprm->p++,*(page+offset++))
721 if(offset==PAGE_SIZE){
722 offset=0;
723 page = (char*)bprm->page[bprm->p/PAGE_SIZE];
725 bprm->argc--;
730 * cycle the list of binary formats handler, until one recognizes the image
732 int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
734 int try,retval=0;
735 struct linux_binfmt *fmt;
736 #ifdef __alpha__
737 /* handle /sbin/loader.. */
739 struct exec * eh = (struct exec *) bprm->buf;
741 if (!bprm->loader && eh->fh.f_magic == 0x183 &&
742 (eh->fh.f_flags & 0x3000) == 0x3000)
744 char * dynloader[] = { "/sbin/loader" };
745 struct dentry * dentry;
747 dput(bprm->dentry);
748 bprm->dentry = NULL;
749 remove_arg_zero(bprm);
750 bprm->p = copy_strings(1, dynloader, bprm->page, bprm->p, 2);
751 bprm->argc++;
752 bprm->loader = bprm->p;
753 dentry = open_namei(dynloader[0], 0, 0);
754 retval = PTR_ERR(dentry);
755 if (IS_ERR(dentry))
756 return retval;
757 bprm->dentry = dentry;
758 retval = prepare_binprm(bprm);
759 if (retval<0)
760 return retval;
761 /* should call search_binary_handler recursively here,
762 but it does not matter */
765 #endif
766 for (try=0; try<2; try++) {
767 for (fmt = formats ; fmt ; fmt = fmt->next) {
768 int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary;
769 if (!fn)
770 continue;
771 retval = fn(bprm, regs);
772 if (retval >= 0) {
773 if (bprm->dentry)
774 dput(bprm->dentry);
775 bprm->dentry = NULL;
776 current->did_exec = 1;
777 return retval;
779 if (retval != -ENOEXEC)
780 break;
781 if (!bprm->dentry) /* We don't have the dentry anymore */
782 return retval;
784 if (retval != -ENOEXEC) {
785 break;
786 #ifdef CONFIG_KMOD
787 }else{
788 #define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
789 char modname[20];
790 if (printable(bprm->buf[0]) &&
791 printable(bprm->buf[1]) &&
792 printable(bprm->buf[2]) &&
793 printable(bprm->buf[3]))
794 break; /* -ENOEXEC */
795 sprintf(modname, "binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
796 request_module(modname);
797 #endif
800 return retval;
805 * sys_execve() executes a new program.
807 int do_execve(char * filename, char ** argv, char ** envp, struct pt_regs * regs)
809 struct linux_binprm bprm;
810 struct dentry * dentry;
811 int retval;
812 int i;
814 bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
815 for (i=0 ; i<MAX_ARG_PAGES ; i++) /* clear page-table */
816 bprm.page[i] = 0;
818 dentry = open_namei(filename, 0, 0);
819 retval = PTR_ERR(dentry);
820 if (IS_ERR(dentry))
821 return retval;
823 bprm.dentry = dentry;
824 bprm.filename = filename;
825 bprm.sh_bang = 0;
826 bprm.java = 0;
827 bprm.loader = 0;
828 bprm.exec = 0;
829 if ((bprm.argc = count(argv)) < 0) {
830 dput(dentry);
831 return bprm.argc;
834 if ((bprm.envc = count(envp)) < 0) {
835 dput(dentry);
836 return bprm.envc;
839 retval = prepare_binprm(&bprm);
841 if (retval >= 0) {
842 bprm.p = copy_strings(1, &bprm.filename, bprm.page, bprm.p, 2);
843 bprm.exec = bprm.p;
844 bprm.p = copy_strings(bprm.envc,envp,bprm.page,bprm.p,0);
845 bprm.p = copy_strings(bprm.argc,argv,bprm.page,bprm.p,0);
846 if (!bprm.p)
847 retval = -E2BIG;
850 if (retval >= 0)
851 retval = search_binary_handler(&bprm,regs);
852 if (retval >= 0)
853 /* execve success */
854 return retval;
856 /* Something went wrong, return the inode and free the argument pages*/
857 if (bprm.dentry)
858 dput(bprm.dentry);
860 for (i=0 ; i<MAX_ARG_PAGES ; i++)
861 free_page(bprm.page[i]);
863 return retval;