• Andrew Morton's avatar
    [PATCH] binfmt_script argv[0] fix · 867c7a0a
    Andrew Morton authored
    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).
    867c7a0a
exec.c 30.4 KB