aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 3892c1a23241..d8fc0605b9d2 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -738,10 +738,8 @@ static int load_elf_binary(struct linux_binprm *bprm)
738 change some of these later */ 738 change some of these later */
739 retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP), 739 retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP),
740 executable_stack); 740 executable_stack);
741 if (retval < 0) { 741 if (retval < 0)
742 send_sig(SIGKILL, current, 0);
743 goto out_free_dentry; 742 goto out_free_dentry;
744 }
745 743
746 current->mm->start_stack = bprm->p; 744 current->mm->start_stack = bprm->p;
747 745
@@ -763,10 +761,8 @@ static int load_elf_binary(struct linux_binprm *bprm)
763 and clear the area. */ 761 and clear the area. */
764 retval = set_brk(elf_bss + load_bias, 762 retval = set_brk(elf_bss + load_bias,
765 elf_brk + load_bias); 763 elf_brk + load_bias);
766 if (retval) { 764 if (retval)
767 send_sig(SIGKILL, current, 0);
768 goto out_free_dentry; 765 goto out_free_dentry;
769 }
770 nbyte = ELF_PAGEOFFSET(elf_bss); 766 nbyte = ELF_PAGEOFFSET(elf_bss);
771 if (nbyte) { 767 if (nbyte) {
772 nbyte = ELF_MIN_ALIGN - nbyte; 768 nbyte = ELF_MIN_ALIGN - nbyte;
@@ -820,7 +816,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
820 error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, 816 error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
821 elf_prot, elf_flags, 0); 817 elf_prot, elf_flags, 0);
822 if (BAD_ADDR(error)) { 818 if (BAD_ADDR(error)) {
823 send_sig(SIGKILL, current, 0);
824 retval = IS_ERR((void *)error) ? 819 retval = IS_ERR((void *)error) ?
825 PTR_ERR((void*)error) : -EINVAL; 820 PTR_ERR((void*)error) : -EINVAL;
826 goto out_free_dentry; 821 goto out_free_dentry;
@@ -851,7 +846,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
851 elf_ppnt->p_memsz > TASK_SIZE || 846 elf_ppnt->p_memsz > TASK_SIZE ||
852 TASK_SIZE - elf_ppnt->p_memsz < k) { 847 TASK_SIZE - elf_ppnt->p_memsz < k) {
853 /* set_brk can never work. Avoid overflows. */ 848 /* set_brk can never work. Avoid overflows. */
854 send_sig(SIGKILL, current, 0);
855 retval = -EINVAL; 849 retval = -EINVAL;
856 goto out_free_dentry; 850 goto out_free_dentry;
857 } 851 }
@@ -883,12 +877,9 @@ static int load_elf_binary(struct linux_binprm *bprm)
883 * up getting placed where the bss needs to go. 877 * up getting placed where the bss needs to go.
884 */ 878 */
885 retval = set_brk(elf_bss, elf_brk); 879 retval = set_brk(elf_bss, elf_brk);
886 if (retval) { 880 if (retval)
887 send_sig(SIGKILL, current, 0);
888 goto out_free_dentry; 881 goto out_free_dentry;
889 }
890 if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) { 882 if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) {
891 send_sig(SIGSEGV, current, 0);
892 retval = -EFAULT; /* Nobody gets to see this, but.. */ 883 retval = -EFAULT; /* Nobody gets to see this, but.. */
893 goto out_free_dentry; 884 goto out_free_dentry;
894 } 885 }
@@ -909,7 +900,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
909 elf_entry += loc->interp_elf_ex.e_entry; 900 elf_entry += loc->interp_elf_ex.e_entry;
910 } 901 }
911 if (BAD_ADDR(elf_entry)) { 902 if (BAD_ADDR(elf_entry)) {
912 force_sig(SIGSEGV, current);
913 retval = IS_ERR((void *)elf_entry) ? 903 retval = IS_ERR((void *)elf_entry) ?
914 (int)elf_entry : -EINVAL; 904 (int)elf_entry : -EINVAL;
915 goto out_free_dentry; 905 goto out_free_dentry;
@@ -922,7 +912,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
922 } else { 912 } else {
923 elf_entry = loc->elf_ex.e_entry; 913 elf_entry = loc->elf_ex.e_entry;
924 if (BAD_ADDR(elf_entry)) { 914 if (BAD_ADDR(elf_entry)) {
925 force_sig(SIGSEGV, current);
926 retval = -EINVAL; 915 retval = -EINVAL;
927 goto out_free_dentry; 916 goto out_free_dentry;
928 } 917 }
@@ -934,19 +923,15 @@ static int load_elf_binary(struct linux_binprm *bprm)
934 923
935#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES 924#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
936 retval = arch_setup_additional_pages(bprm, !!elf_interpreter); 925 retval = arch_setup_additional_pages(bprm, !!elf_interpreter);
937 if (retval < 0) { 926 if (retval < 0)
938 send_sig(SIGKILL, current, 0);
939 goto out; 927 goto out;
940 }
941#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */ 928#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */
942 929
943 install_exec_creds(bprm); 930 install_exec_creds(bprm);
944 retval = create_elf_tables(bprm, &loc->elf_ex, 931 retval = create_elf_tables(bprm, &loc->elf_ex,
945 load_addr, interp_load_addr); 932 load_addr, interp_load_addr);
946 if (retval < 0) { 933 if (retval < 0)
947 send_sig(SIGKILL, current, 0);
948 goto out; 934 goto out;
949 }
950 /* N.B. passed_fileno might not be initialized? */ 935 /* N.B. passed_fileno might not be initialized? */
951 current->mm->end_code = end_code; 936 current->mm->end_code = end_code;
952 current->mm->start_code = start_code; 937 current->mm->start_code = start_code;