• Yoav Zach's avatar
    [PATCH] binfmt misc fd passing via ELF aux vector · 191312cc
    Yoav Zach authored
    The proposed patch uses the aux-vector to pass the fd of the open misc
    binary to the interpreter, instead of using argv[1] for that purpose.
    
    Previous patch - open_nonreadable_binaries, offered the option of
    binfmt_misc opening the binary on behalf of the interpreter.  In case
    binfmt_misc is requested to do that it would pass the file-descriptor of
    the open binary to the interpreter as its second argument (argv[1]).  This
    method of passing the file descriptor was suspected to be problematic,
    since it changes the command line that users expect to see when using tools
    such as 'ps' and 'top'. 
    
    The proposed patch changes the method of passing the fd of the open binary
    to the translator.  Instead of passing it as an argument, binfmt_misc will
    request the ELF loader to pass it as a new element in the aux-vector that
    it prepares on the stack for ELF interpreter.  With this patch, argv[1]
    will hold the full path to the binary regardless of whether it opened it or
    not.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    191312cc
binfmt_misc.c 15.6 KB