Re: Java in Linux kernel: some issues

Jan Kasprzak (kas@muni.cz)
Thu, 16 May 1996 17:38:15 +0200 (MET DST)


:
: Why not simply load /usr/sbin/unknown-exec and have this user level
: program determine what to do with the file, checking magic numbers and
: running the appropriate interpreter. I would even allow you to run file
: on whatever you are trying to exec and handle that to postcript or
: whatever if that's what you want ;)
:
: If /usr/sbin/unknown-exec doesn't exist you have normal pre-java-patch
: behavior, but if it is there it receives the arguments to exec as its
: arguments. I imagine it doing something along these lines:
:
: open argv[0]
: check magic numbers
: if (is-java) exec(java,args...)
: else if (is-foo-p-code) exec(foo,args...)
: .
: .
: .
: else return "cannot execute binary file"
:
Maybe I am missing someting, but:

0) I will suggest /sbin/unknown-exec (which can be symbolic link
to /usr/sbin).

1) argv[0] can have no relation
to the executable (i.e. open (argv[0],...) can fail). So for example
you will not able to have a java-interpreted login shell :-).

2) After you exec() /usr/sbin/unknown-exec, you are not allowed
to return "cannot execute binary file" (ENOEXEC, I think), since
there is no longer a text which has called exec(). So you have
no valid return address.

-Yenya

-- 
Jan "Yenya" Kasprzak  |  mailto:kas@muni.cz  |   http://www.fi.muni.cz/~kas/
[[[[ Student of Informatics, Faculty of Informatics, Masaryk University ]]]]
[[[[      Czech Linux Homepage:  http://www.fi.muni.cz/~kas/linux/      ]]]]
``Hoping the problem  magically goes away  by ignoring it is the  "microsoft
approach to programming"  and should never be allowed.''    --Linus Torvalds