diff options
Diffstat (limited to 'fs/binfmt_script.c')
-rw-r--r-- | fs/binfmt_script.c | 10 |
1 files changed, 10 insertions, 0 deletions
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) | |||
24 | 24 | ||
25 | if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) | 25 | if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) |
26 | return -ENOEXEC; | 26 | return -ENOEXEC; |
27 | |||
28 | /* | ||
29 | * If the script filename will be inaccessible after exec, typically | ||
30 | * because it is a "/dev/fd/<fd>/.." path against an O_CLOEXEC fd, give | ||
31 | * up now (on the assumption that the interpreter will want to load | ||
32 | * this file). | ||
33 | */ | ||
34 | if (bprm->interp_flags & BINPRM_FLAGS_PATH_INACCESSIBLE) | ||
35 | return -ENOENT; | ||
36 | |||
27 | /* | 37 | /* |
28 | * This section does the #! interpretation. | 38 | * This section does the #! interpretation. |
29 | * Sorta complicated, but hopefully it will work. -TYT | 39 | * Sorta complicated, but hopefully it will work. -TYT |