X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=fs%2Fbinfmt_script.c;h=afdf4e3cafc2aa5f1c1ff1dc0e8cfb256c6a3b89;hb=d0bffab0439fb7edaee09677b636eef5991e8b80;hp=5027a3e149222bd5945c87d9521e6e7a6108dc77;hpb=c157750a901d767ecb95f1dbabd0972dee396b1e;p=karo-tx-linux.git diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index 5027a3e14922..afdf4e3cafc2 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c @@ -24,6 +24,16 @@ static int load_script(struct linux_binprm *bprm) if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) return -ENOEXEC; + + /* + * If the script filename will be inaccessible after exec, typically + * because it is a "/dev/fd//.." path against an O_CLOEXEC fd, give + * up now (on the assumption that the interpreter will want to load + * this file). + */ + if (bprm->interp_flags & BINPRM_FLAGS_PATH_INACCESSIBLE) + return -ENOENT; + /* * This section does the #! interpretation. * Sorta complicated, but hopefully it will work. -TYT