[lkml]   [1996]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: binfmt_java problems
In H. Peter Anvin writes:

: Im my opinion there is a very serious problems with binfmt_java as
: implemented in the pre2.0 series kernels. This is particularly
: disturbing given the timings, although the problem is technically
: fairly trivial.

: The problem is that it assumes *way* too much about the user space
: environment. All of the following are assumed:

: 1. A /usr partition exists, is writable and/or the version of java
: installed there is appropriate;
: 2. /bin/bash (not even /bin/sh) exists and is appropriate for running
: shell scripts;
: 3. /usr/bin/java and /usr/bin/appletviewer are shell scripts.
: 4. It appears to me that it will not properly handle executing it from
: anywhere but the current directory, since it strips the path from
: the front.

I agree completely. It is very undesirable to have explicit paths
in the kernel. In the good old days the only exception was /etc/init
(/etc/rc, /bin/sh) started as first process, and even in that case
one could specify something else with a "init=..." command line parameter.
However, slowly the number of paths in the kernel increases.

I am aware of (completeness not guaranteed):

(in init/main.c) "/etc/init", "/bin/init", "/sbin/init", "/bin/sh", "/etc/rc"
"HOME=/", "HOME=/usr/root"
"/linuxrc", "/initrd"

(in fs/binfmt_elf.c) "/usr/lib/"

(in drivers/block/ide.c - only in a printk)

(in fs/exec.c) "/sbin/loader"

(in fs/umsdos/inode.c) "/linux"
#define UMSDOS_PSDROOT_NAME "linux"
#define UMSDOS_EMD_FILE "--linux-.---"

#define NCP_MSG_COMMAND "/sbin/nwmsg"

#define _PATH_JAVA "/usr/bin/java"
#define _PATH_APPLET "/usr/bin/appletviewer"
#define _PATH_SH "/bin/bash"

: I would suggest one of the following approaches:

: 1. Easiest: define /sbin/kjavad as a wrapper program ...
: 2. Somewhat harder: use /(s)bin/{java,appletviewer} ...

These still have explicit paths. You would like to avoid that.

: 3. Hardest/most flexible: set the appropriate paths through /proc/sys;
: disable Java binaries unless the paths are set.

: I'll try to hack up #3.

Seems a very good idea. (And not hard at all.)


 \ /
  Last update: 2005-03-22 13:37    [W:0.083 / U:6.004 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site