]> git.neil.brown.name Git - history.git/commit
[PATCH] binfmt_script argv[0] fix
authorAndrew Morton <akpm@osdl.org>
Fri, 1 Aug 2003 03:10:26 +0000 (20:10 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 1 Aug 2003 03:10:26 +0000 (20:10 -0700)
commit867c7a0a77311f210d23ae4964d4c910ff5453e1
treedf61f7c59d73c60c11757780f41339e6d4c03f3f
parentf4f980fb39970b1edfde3e7f09304ee0704dce0d
[PATCH] binfmt_script argv[0] fix

From: Arun Sharma <arun.sharma@intel.com>

A script such as

  #!/bin/foo.bar
  ...

where /bin/foo.bar is handled by binfmt_misc, is not handled correctly i.e.
the interpreter of foo.bar doesn't receive the correct arguments.

The binfmt_misc handler requires that bprm->filename is appropriately
filled so that the argv[1] could be correctly passed to the interpreter.

However, binfmt_script, as it exists today doesn't populate bprm->filename
correctly.

Another motivation for this patch is the output of ps.  Emulators which use
binfmt_misc may want to keep the output of ps consistent with native
execution.  This requires preserving bprm->filename.  The attached patch
guarantees this even if we have to go through several binfmt handlers
(think of finite loops involving binfmt_script and binfmt_misc).
fs/binfmt_misc.c
fs/binfmt_script.c
fs/exec.c
include/linux/binfmts.h