From 606a272879c0882181c1e409b5ffc34242b3bc6d Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:25:47 -0500 Subject: [PATCH] Import 2.3.9pre3 --- Documentation/Configure.help | 38 ------- arch/alpha/config.in | 3 - arch/alpha/kernel/osf_sys.c | 2 + arch/arm/kernel/sys_arm.c | 2 + arch/i386/config.in | 3 - arch/mips/config.in | 4 - arch/mips/kernel/syscall.c | 2 + arch/mips/kernel/sysirix.c | 2 + arch/ppc/config.in | 1 - arch/ppc/defconfig | 1 - arch/ppc/kernel/syscalls.c | 6 +- arch/sparc/config.in | 3 - arch/sparc/defconfig | 1 - arch/sparc64/config.in | 5 +- arch/sparc64/defconfig | 1 - arch/sparc64/solaris/misc.c | 2 + fs/Makefile | 8 -- fs/binfmt_aout.c | 5 +- fs/binfmt_java.c | 196 ----------------------------------- fs/buffer.c | 8 +- fs/exec.c | 5 - fs/ext2/file.c | 5 +- fs/ext2/inode.c | 2 +- fs/ext2/truncate.c | 29 +----- fs/select.c | 12 +-- include/linux/binfmts.h | 2 - include/linux/sysctl.h | 2 - kernel/sysctl.c | 7 -- 28 files changed, 36 insertions(+), 321 deletions(-) delete mode 100644 fs/binfmt_java.c diff --git a/Documentation/Configure.help b/Documentation/Configure.help index 2caf07806ea6..135d4b373570 100644 --- a/Documentation/Configure.help +++ b/Documentation/Configure.help @@ -1705,44 +1705,6 @@ CONFIG_BINFMT_AOUT because some crucial programs on your system might still be in A.OUT format. -Kernel support for JAVA binaries (obsolete) -CONFIG_BINFMT_JAVA - JAVA(tm) is an object oriented programming language developed by - SUN; JAVA programs are compiled into "JAVA bytecode" binaries which - can then be interpreted by run time systems on many different - architectures and operating systems. These JAVA binaries are - becoming a universal executable format. - - If you want to execute JAVA binaries, read the Java on Linux HOWTO, - available via FTP (user: anonymous) at - ftp://metalab.unc.edu/pub/Linux/docs/HOWTO. You will then need to - install the run time system contained in the Java Developers Kit - (JDK) as described in the HOWTO. This is completely independent of - the Linux kernel and you do NOT need to say Y here for this to work. - - Saying Y here allows you to execute a JAVA bytecode binary just like - any other Linux program: by simply typing in its name. (You also - need to have the JDK installed for this to work). As more and more - Java programs become available, the use for this will gradually - increase. You can even execute HTML files containing JAVA applets - (little embedded JAVA binaries) if those files start with the string - "". If you want to use this, say Y here and read - Documentation/java.txt. - - If you disable this option it will reduce your kernel by about 4 KB. - This is not much and by itself does not warrant removing support. - However its removal is a good idea if you do not have the JDK - installed. You may answer M for module support and later load the - module when you install the JDK or find an interesting Java program - that you can't live without. The module will be called - binfmt_java.o. - - The complete functionality of this Java support is also provided by - the more general option "Kernel support for MISC binaries", - below. This option is therefore considered obsolete and you should - say N here and Y to "Kernel support for MISC binaries" if you're - interested in transparently executing Java programs. - Kernel support for Linux/Intel ELF binaries CONFIG_BINFMT_EM86 Say Y here if you want to be able to execute Linux/Intel ELF diff --git a/arch/alpha/config.in b/arch/alpha/config.in index 4a0da0cbcb30..75b3e9563e7e 100644 --- a/arch/alpha/config.in +++ b/arch/alpha/config.in @@ -187,9 +187,6 @@ bool 'Sysctl support' CONFIG_SYSCTL tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC -if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA -fi tristate 'Kernel support for Linux/Intel ELF binaries' CONFIG_BINFMT_EM86 tristate 'Parallel port support' CONFIG_PARPORT if [ "$CONFIG_PARPORT" != "n" ]; then diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 38bd43947c08..9ff616afa3b1 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c @@ -255,6 +255,7 @@ asmlinkage unsigned long osf_mmap(unsigned long addr, unsigned long len, struct file *file = NULL; unsigned long ret = -EBADF; + down(¤t->mm->mmap_sem); lock_kernel(); #if 0 if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED)) @@ -272,6 +273,7 @@ asmlinkage unsigned long osf_mmap(unsigned long addr, unsigned long len, fput(file); out: unlock_kernel(); + up(¤t->mm->mmap_sem); return ret; } diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index 9da64aad0d1f..94f158b3e7b3 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c @@ -72,6 +72,7 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg) struct file * file = NULL; struct mmap_arg_struct a; + down(¤t->mm->mmap_sem); lock_kernel(); if (copy_from_user(&a, arg, sizeof(a))) goto out; @@ -87,6 +88,7 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg) fput(file); out: unlock_kernel(); + up(¤t->mm->mmap_sem); return error; } diff --git a/arch/i386/config.in b/arch/i386/config.in index 789b19b3c0c6..f0ac5e2c03e8 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -91,9 +91,6 @@ bool 'Sysctl support' CONFIG_SYSCTL tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC -if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA -fi tristate 'Parallel port support' CONFIG_PARPORT if [ "$CONFIG_PARPORT" != "n" ]; then diff --git a/arch/mips/config.in b/arch/mips/config.in index 6ec172d725d9..d2ad0f4927ec 100644 --- a/arch/mips/config.in +++ b/arch/mips/config.in @@ -76,10 +76,6 @@ fi define_bool CONFIG_BINFMT_AOUT n define_bool CONFIG_BINFMT_ELF y tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC -if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC - tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA -fi bool 'Networking support' CONFIG_NET bool 'System V IPC' CONFIG_SYSVIPC diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 11415b79f440..bf84e76dbc8e 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -61,6 +61,7 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, int prot, struct file * file = NULL; unsigned long error = -EFAULT; + down(¤t->mm->mmap_sem); lock_kernel(); if (!(flags & MAP_ANONYMOUS)) { error = -EBADF; @@ -74,6 +75,7 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, int prot, fput(file); out: unlock_kernel(); + up(¤t->mm->mmap_sem); return error; } diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 4110648634d3..321ee3026409 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c @@ -1103,6 +1103,7 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot, struct file *file = NULL; unsigned long retval; + down(¤t->mm->mmap_sem); lock_kernel(); if(!(flags & MAP_ANONYMOUS)) { if(!(file = fget(fd))) { @@ -1130,6 +1131,7 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot, out: unlock_kernel(); + up(¤t->mm->mmap_sem); return retval; } diff --git a/arch/ppc/config.in b/arch/ppc/config.in index 565b39fd1df7..a3c166a8a898 100644 --- a/arch/ppc/config.in +++ b/arch/ppc/config.in @@ -65,7 +65,6 @@ bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT define_bool CONFIG_BINFMT_ELF y define_bool CONFIG_KERNEL_ELF y tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC -tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA tristate 'Parallel port support' CONFIG_PARPORT if [ "$CONFIG_PARPORT" != "n" ]; then diff --git a/arch/ppc/defconfig b/arch/ppc/defconfig index d746c7e64162..6761d8602f61 100644 --- a/arch/ppc/defconfig +++ b/arch/ppc/defconfig @@ -35,7 +35,6 @@ CONFIG_SYSVIPC=y CONFIG_BINFMT_ELF=y CONFIG_KERNEL_ELF=y # CONFIG_BINFMT_MISC is not set -# CONFIG_BINFMT_JAVA is not set # CONFIG_PARPORT is not set CONFIG_VGA_CONSOLE=y CONFIG_FB=y diff --git a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c index 3aa0becef6fb..5ae2957574f8 100644 --- a/arch/ppc/kernel/syscalls.c +++ b/arch/ppc/kernel/syscalls.c @@ -201,12 +201,16 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, lock_kernel(); if (!(flags & MAP_ANONYMOUS)) { - if (fd >= NR_OPEN || !(file = current->files->fd[fd])) + if (!(file = fget(fd))) goto out; } flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + down(¤t->mm->mmap_sem); ret = do_mmap(file, addr, len, prot, flags, offset); + up(¤t->mm->mmap_sem); + if (file) + fput(file); out: unlock_kernel(); return ret; diff --git a/arch/sparc/config.in b/arch/sparc/config.in index 1fc89b977346..1f485d4ca462 100644 --- a/arch/sparc/config.in +++ b/arch/sparc/config.in @@ -72,9 +72,6 @@ bool 'Sysctl support' CONFIG_SYSCTL tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC -if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA -fi endmenu mainmenu_option next_comment diff --git a/arch/sparc/defconfig b/arch/sparc/defconfig index 1caf1143a71f..07985d46d7c0 100644 --- a/arch/sparc/defconfig +++ b/arch/sparc/defconfig @@ -80,7 +80,6 @@ CONFIG_SYSCTL=y CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y CONFIG_BINFMT_MISC=m -CONFIG_BINFMT_JAVA=m # # Floppy, IDE, and other block devices diff --git a/arch/sparc64/config.in b/arch/sparc64/config.in index 58ac24500485..4b840ee9ab63 100644 --- a/arch/sparc64/config.in +++ b/arch/sparc64/config.in @@ -62,10 +62,7 @@ if [ "$CONFIG_SPARC32_COMPAT" != "n" ]; then tristate 'Kernel support for 32-bit ELF binaries' CONFIG_BINFMT_ELF32 bool 'Kernel support for 32-bit (ie. SunOS) a.out binaries' CONFIG_BINFMT_AOUT32 fi -if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC - tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA -fi +tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate 'Solaris binary emulation' CONFIG_SOLARIS_EMUL fi diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index 86eb05819807..f55370272978 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -91,7 +91,6 @@ CONFIG_BINFMT_ELF=y CONFIG_BINFMT_ELF32=y # CONFIG_BINFMT_AOUT32 is not set CONFIG_BINFMT_MISC=m -CONFIG_BINFMT_JAVA=m CONFIG_SOLARIS_EMUL=m CONFIG_PARPORT=m CONFIG_PARPORT_AX=m diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c index c29b79f6857c..4b3a1ce5d313 100644 --- a/arch/sparc64/solaris/misc.c +++ b/arch/sparc64/solaris/misc.c @@ -83,6 +83,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o } } + down(¤t->mm->mmap_sem); retval = -ENOMEM; if(!(flags & MAP_FIXED) && !addr) { unsigned long attempt = get_unmapped_area(addr, len); @@ -102,6 +103,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o if(!ret_type) retval = ((retval < 0xf0000000) ? 0 : retval); out_putf: + up(¤t->mm->mmap_sem); if (file) fput(file); out: diff --git a/fs/Makefile b/fs/Makefile index b94509a03217..069b1a2a41e3 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -263,14 +263,6 @@ else endif endif -ifeq ($(CONFIG_BINFMT_JAVA),y) -BINFMTS += binfmt_java.o -else - ifeq ($(CONFIG_BINFMT_JAVA),m) - M_OBJS += binfmt_java.o - endif -endif - ifeq ($(CONFIG_BINFMT_EM86),y) BINFMTS += binfmt_em86.o else diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 2b886a147ead..2baf75c4b0a9 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c @@ -396,7 +396,7 @@ static inline int do_load_aout_binary(struct linux_binprm * bprm, struct pt_regs fd = open_dentry(bprm->dentry, O_RDONLY); if (fd < 0) return fd; - file = fcheck(fd); + file = fget(fd); if ((fd_offset & ~PAGE_MASK) != 0) { printk(KERN_WARNING @@ -406,6 +406,7 @@ static inline int do_load_aout_binary(struct linux_binprm * bprm, struct pt_regs } if (!file->f_op || !file->f_op->mmap || ((fd_offset & ~PAGE_MASK) != 0)) { + fput(file); sys_close(fd); do_brk(0, ex.a_text+ex.a_data); read_exec(bprm->dentry, fd_offset, @@ -422,6 +423,7 @@ static inline int do_load_aout_binary(struct linux_binprm * bprm, struct pt_regs fd_offset); if (error != N_TXTADDR(ex)) { + fput(file); sys_close(fd); send_sig(SIGKILL, current, 0); return error; @@ -431,6 +433,7 @@ static inline int do_load_aout_binary(struct linux_binprm * bprm, struct pt_regs PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, fd_offset + ex.a_text); + fput(file); sys_close(fd); if (error != N_DATADDR(ex)) { send_sig(SIGKILL, current, 0); diff --git a/fs/binfmt_java.c b/fs/binfmt_java.c deleted file mode 100644 index 2bd036d98e68..000000000000 --- a/fs/binfmt_java.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * linux/fs/binfmt_java.c - * - * Copyright (C) 1996 Brian A. Lantz - * derived from binfmt_script.c - * - * Simplified and modified to support binary java interpreters - * by Tom May . - */ - -#include -#include -#include -#include -#include -#include - -#define _PATH_JAVA "/usr/bin/java" -#define _PATH_APPLET "/usr/bin/appletviewer" - -/* These paths can be modified with sysctl(). */ - -char binfmt_java_interpreter[65] = _PATH_JAVA; -char binfmt_java_appletviewer[65] = _PATH_APPLET; - -static int do_load_java(struct linux_binprm *bprm,struct pt_regs *regs) -{ - char *i_name; - int len; - int retval; - struct dentry * dentry; - unsigned char *ucp = (unsigned char *) bprm->buf; - - if ((ucp[0] != 0xca) || (ucp[1] != 0xfe) || (ucp[2] != 0xba) || (ucp[3] != 0xbe)) - return -ENOEXEC; - - /* - * Fail if we're called recursively, e.g., the Java interpreter - * is a java binary. - */ - - if (bprm->java) - return -ENOEXEC; - - bprm->java = 1; - - dput(bprm->dentry); - bprm->dentry = NULL; - - /* - * Set args: [0] the name of the java interpreter - * [1] name of java class to execute, which is the - * filename without the path and without trailing - * ".class". Note that the interpreter will use - * its own way to found the class file (typically using - * environment variable CLASSPATH), and may in fact - * execute a different file from the one we want. - * - * This is done in reverse order, because of how the - * user environment and arguments are stored. - */ - remove_arg_zero(bprm); - len = strlen (bprm->filename); - if (len >= 6 && !strcmp (bprm->filename + len - 6, ".class")) - bprm->filename[len - 6] = 0; - if ((i_name = strrchr (bprm->filename, '/')) != NULL) - i_name++; - else - i_name = bprm->filename; - - retval = copy_strings_kernel(1, &i_name, bprm); - if (retval < 0) - return retval; - bprm->argc++; - - i_name = binfmt_java_interpreter; - retval = copy_strings_kernel(1, &i_name, bprm); - if (retval < 0) - return retval; - bprm->argc++; - - /* - * OK, now restart the process with the interpreter's dentry. - */ - bprm->filename = binfmt_java_interpreter; - dentry = open_namei(binfmt_java_interpreter, 0, 0); - retval = PTR_ERR(dentry); - if (IS_ERR(dentry)) - return retval; - - bprm->dentry = dentry; - retval = prepare_binprm(bprm); - if (retval < 0) - return retval; - - return search_binary_handler(bprm,regs); -} - -static int do_load_applet(struct linux_binprm *bprm,struct pt_regs *regs) -{ - char *i_name; - struct dentry * dentry; - int retval; - - if (strncmp (bprm->buf, "