Loading fs/exec.c +17 −0 Original line number Diff line number Diff line Loading @@ -1805,6 +1805,9 @@ static int __do_execve_file(int fd, struct filename *filename, goto out_unmark; bprm->argc = count(argv, MAX_ARG_STRINGS); if (bprm->argc == 0) pr_warn_once("process '%s' launched '%s' with NULL argv: empty string added\n", current->comm, bprm->filename); if ((retval = bprm->argc) < 0) goto out; Loading @@ -1829,6 +1832,20 @@ static int __do_execve_file(int fd, struct filename *filename, if (retval < 0) goto out; /* * When argv is empty, add an empty string ("") as argv[0] to * ensure confused userspace programs that start processing * from argv[1] won't end up walking envp. See also * bprm_stack_limits(). */ if (bprm->argc == 0) { const char *argv[] = { "", NULL }; retval = copy_strings_kernel(1, argv, bprm); if (retval < 0) goto out; bprm->argc = 1; } retval = exec_binprm(bprm); if (retval < 0) goto out; Loading Loading
fs/exec.c +17 −0 Original line number Diff line number Diff line Loading @@ -1805,6 +1805,9 @@ static int __do_execve_file(int fd, struct filename *filename, goto out_unmark; bprm->argc = count(argv, MAX_ARG_STRINGS); if (bprm->argc == 0) pr_warn_once("process '%s' launched '%s' with NULL argv: empty string added\n", current->comm, bprm->filename); if ((retval = bprm->argc) < 0) goto out; Loading @@ -1829,6 +1832,20 @@ static int __do_execve_file(int fd, struct filename *filename, if (retval < 0) goto out; /* * When argv is empty, add an empty string ("") as argv[0] to * ensure confused userspace programs that start processing * from argv[1] won't end up walking envp. See also * bprm_stack_limits(). */ if (bprm->argc == 0) { const char *argv[] = { "", NULL }; retval = copy_strings_kernel(1, argv, bprm); if (retval < 0) goto out; bprm->argc = 1; } retval = exec_binprm(bprm); if (retval < 0) goto out; Loading