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
- "<!--applet-->". 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
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
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))
fput(file);
out:
unlock_kernel();
+ up(¤t->mm->mmap_sem);
return ret;
}
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;
fput(file);
out:
unlock_kernel();
+ up(¤t->mm->mmap_sem);
return error;
}
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
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
struct file * file = NULL;
unsigned long error = -EFAULT;
+ down(¤t->mm->mmap_sem);
lock_kernel();
if (!(flags & MAP_ANONYMOUS)) {
error = -EBADF;
fput(file);
out:
unlock_kernel();
+ up(¤t->mm->mmap_sem);
return error;
}
struct file *file = NULL;
unsigned long retval;
+ down(¤t->mm->mmap_sem);
lock_kernel();
if(!(flags & MAP_ANONYMOUS)) {
if(!(file = fget(fd))) {
out:
unlock_kernel();
+ up(¤t->mm->mmap_sem);
return retval;
}
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
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
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;
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
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_MISC=m
-CONFIG_BINFMT_JAVA=m
#
# Floppy, IDE, and other block devices
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
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
}
}
+ down(¤t->mm->mmap_sem);
retval = -ENOMEM;
if(!(flags & MAP_FIXED) && !addr) {
unsigned long attempt = get_unmapped_area(addr, len);
if(!ret_type)
retval = ((retval < 0xf0000000) ? 0 : retval);
out_putf:
+ up(¤t->mm->mmap_sem);
if (file)
fput(file);
out:
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
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
}
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,
fd_offset);
if (error != N_TXTADDR(ex)) {
+ fput(file);
sys_close(fd);
send_sig(SIGKILL, current, 0);
return error;
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);
+++ /dev/null
-/*
- * 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 <ftom@netcom.com>.
- */
-
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/malloc.h>
-#include <linux/binfmts.h>
-#include <linux/init.h>
-
-#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, "<!--applet", 10))
- return -ENOEXEC;
-
- dput(bprm->dentry);
- bprm->dentry = NULL;
-
- /*
- * Set args: [0] the name of the appletviewer
- * [1] filename of html file
- *
- * This is done in reverse order, because of how the
- * user environment and arguments are stored.
- */
- remove_arg_zero(bprm);
- i_name = bprm->filename;
- retval = copy_strings_kernel(1, &i_name, bprm);
- if (retval < 0) return retval;
- bprm->argc++;
-
- i_name = binfmt_java_appletviewer;
- 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_appletviewer;
- dentry = open_namei(binfmt_java_appletviewer, 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 load_java(struct linux_binprm *bprm,struct pt_regs *regs)
-{
- int retval;
- MOD_INC_USE_COUNT;
- retval = do_load_java(bprm,regs);
- MOD_DEC_USE_COUNT;
- return retval;
-}
-
-static struct linux_binfmt java_format = {
-#ifndef MODULE
- NULL, 0, load_java, NULL, NULL
-#else
- NULL, &__this_module, load_java, NULL, NULL
-#endif
-};
-
-static int load_applet(struct linux_binprm *bprm,struct pt_regs *regs)
-{
- int retval;
- MOD_INC_USE_COUNT;
- retval = do_load_applet(bprm,regs);
- MOD_DEC_USE_COUNT;
- return retval;
-}
-
-static struct linux_binfmt applet_format = {
-#ifndef MODULE
- NULL, 0, load_applet, NULL, NULL
-#else
- NULL, &__this_module, load_applet, NULL, NULL
-#endif
-};
-
-int __init init_java_binfmt(void)
-{
- register_binfmt(&java_format);
- return register_binfmt(&applet_format);
-}
-
-#ifdef MODULE
-int init_module(void)
-{
- return init_java_binfmt();
-}
-
-void cleanup_module( void) {
- unregister_binfmt(&java_format);
- unregister_binfmt(&applet_format);
-}
-#endif
* two cases.
*/
if (bmap && !block) {
- set_bit(BH_Uptodate, &bh->b_state);
memset(bh->b_data, 0, size);
}
}
nr++;
} else {
/*
- * filesystem 'hole' represents zero-contents:
+ * filesystem 'hole' represents zero-contents.
+ *
+ * Don't mark the buffer up-to-date (that also implies
+ * that it is ok on disk, which it isn't), but _do_
+ * zero out the contents so that readers see the zeroes.
*/
memset(bh->b_data, 0, blocksize);
- set_bit(BH_Uptodate, &bh->b_state);
}
}
iblock++;
init_aout32_binfmt();
#endif
-#ifdef CONFIG_BINFMT_JAVA
- init_java_binfmt();
-#endif
-
#ifdef CONFIG_BINFMT_EM86
init_em86_binfmt();
#endif
bprm.dentry = dentry;
bprm.filename = filename;
bprm.sh_bang = 0;
- bprm.java = 0;
bprm.loader = 0;
bprm.exec = 0;
if ((bprm.argc = count(argv)) < 0) {
unsigned long blocknr;
blocknr = ext2_getblk_block(inode, block, 1, &error, &created);
- if (!blocknr)
+ if (!blocknr) {
+ if (!error)
+ error = -ENOSPC;
return error;
+ }
bh->b_dev = inode->i_dev;
bh->b_blocknr = blocknr;
*err = 0;
*created = 1;
}
- if (le32_to_cpu(*p)) {
+ if (*p) {
ext2_free_blocks (inode, tmp, 1);
brelse (result);
goto repeat;
bforget(bh);
if (ind_bh)
mark_buffer_dirty(ind_bh, 1);
- ext2_free_blocks (inode, tmp, 1);
+ ext2_free_blocks(inode, tmp, 1);
goto out;
}
retry = 1;
static int trunc_direct (struct inode * inode)
{
- struct buffer_head * bh;
int i, retry = 0;
unsigned long block_to_free = 0, free_count = 0;
int blocks = inode->i_sb->s_blocksize / 512;
if (!tmp)
continue;
- bh = find_buffer(inode->i_dev, tmp, inode->i_sb->s_blocksize);
- if (bh) {
- if (DATA_BUFFER_USED(bh)) {
- retry = 1;
- continue;
- }
- bh->b_count++;
- }
-
*p = 0;
inode->i_blocks -= blocks;
mark_inode_dirty(inode);
- bforget(bh);
/* accumulate blocks to free if they're contiguous */
if (free_count == 0)
return retry;
}
-static int trunc_indirect (struct inode * inode, int offset, u32 * p,
- struct buffer_head *dind_bh)
+static int trunc_indirect (struct inode * inode, int offset, u32 * p, struct buffer_head *dind_bh)
{
struct buffer_head * ind_bh;
int i, tmp, retry = 0;
indirect_block = 0;
for (i = indirect_block ; i < addr_per_block ; i++) {
u32 * ind = i + (u32 *) ind_bh->b_data;
- struct buffer_head * bh;
wait_on_buffer(ind_bh);
tmp = le32_to_cpu(*ind);
if (!tmp)
continue;
- /*
- * Use find_buffer so we don't block here.
- */
- bh = find_buffer(inode->i_dev, tmp, inode->i_sb->s_blocksize);
- if (bh) {
- if (DATA_BUFFER_USED(bh)) {
- retry = 1;
- continue;
- }
- bh->b_count++;
- }
*ind = 0;
inode->i_blocks -= blocks;
mark_inode_dirty(inode);
- bforget(bh);
mark_buffer_dirty(ind_bh, 1);
/* accumulate blocks to free if they're contiguous */
off = i / __NFDBITS;
if (!(bit & BITS(fds, off)))
continue;
- /*
- * The poll_wait routine will increment f_count if
- * the file is added to the wait table, so we don't
- * need to increment it now.
- */
- file = fcheck(i);
+ file = fget(i);
mask = POLLNVAL;
if (file) {
mask = DEFAULT_POLLMASK;
if (file->f_op && file->f_op->poll)
mask = file->f_op->poll(file, wait);
+ fput(file);
}
if ((mask & POLLIN_SET) && ISSET(bit, __IN(fds,off))) {
SET(bit, __RES_IN(fds,off));
mask = 0;
fd = fdpnt->fd;
if (fd >= 0) {
- /* poll_wait increments f_count if needed */
- struct file * file = fcheck(fd);
+ struct file * file = fget(fd);
mask = POLLNVAL;
if (file != NULL) {
mask = DEFAULT_POLLMASK;
if (file->f_op && file->f_op->poll)
mask = file->f_op->poll(file, wait);
mask &= fdpnt->events | POLLERR | POLLHUP;
+ fput(file);
}
if (mask) {
wait = NULL;
unsigned long page[MAX_ARG_PAGES];
unsigned long p; /* current top of mem */
int sh_bang;
- int java; /* Java binary, prevent recursive invocation */
struct dentry * dentry;
int e_uid, e_gid;
kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
extern int init_aout_binfmt(void);
extern int init_aout32_binfmt(void);
extern int init_script_binfmt(void);
-extern int init_java_binfmt(void);
extern int init_em86_binfmt(void);
extern int init_misc_binfmt(void);
KERN_PANIC=15, /* int: panic timeout */
KERN_REALROOTDEV=16, /* real root device to mount after initrd */
- KERN_JAVA_INTERPRETER=19, /* path to Java(tm) interpreter */
- KERN_JAVA_APPLETVIEWER=20, /* path to Java(tm) appletviewer */
KERN_SPARC_REBOOT=21, /* reboot command on Sparc */
KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
KERN_PRINTK=23, /* struct: control printk logging parameters */
extern int panic_timeout;
extern int console_loglevel, C_A_D;
extern int bdf_prm[], bdflush_min[], bdflush_max[];
-extern char binfmt_java_interpreter[], binfmt_java_appletviewer[];
extern int sysctl_overcommit_memory;
extern int nr_queued_signals, max_queued_signals;
{KERN_REALROOTDEV, "real-root-dev", &real_root_dev, sizeof(int),
0644, NULL, &proc_dointvec},
#endif
-#ifdef CONFIG_BINFMT_JAVA
- {KERN_JAVA_INTERPRETER, "java-interpreter", binfmt_java_interpreter,
- 64, 0644, NULL, &proc_dostring, &sysctl_string },
- {KERN_JAVA_APPLETVIEWER, "java-appletviewer", binfmt_java_appletviewer,
- 64, 0644, NULL, &proc_dostring, &sysctl_string },
-#endif
#ifdef __sparc__
{KERN_SPARC_REBOOT, "reboot-cmd", reboot_command,
256, 0644, NULL, &proc_dostring, &sysctl_string },