* process 'ld-linux-x86-64' launched '/tmp/testscriptWLyRCA' with NULL argv: empty string added
@ 2023-05-03 19:17 Cristian Rodríguez
2023-05-15 18:32 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 2+ messages in thread
From: Cristian Rodríguez @ 2023-05-03 19:17 UTC (permalink / raw)
To: libc mailing list
[-- Attachment #1: Type: text/plain, Size: 394 bytes --]
Hi:
Apparently posix/tst-execvpe6.c is not valid anymore at least on linux
where NULL argv is invalid. The kernel is way too nice and not killing the
process as it should but using an empty string instead.
so,
char *args3[] = { NULL };
if (run_script (fname2, args3))
return 1;
is testing..
char *args3[] = { "", NULL };
if (run_script (fname2, args3))
return 1;
instead.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: process 'ld-linux-x86-64' launched '/tmp/testscriptWLyRCA' with NULL argv: empty string added
2023-05-03 19:17 process 'ld-linux-x86-64' launched '/tmp/testscriptWLyRCA' with NULL argv: empty string added Cristian Rodríguez
@ 2023-05-15 18:32 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella Netto @ 2023-05-15 18:32 UTC (permalink / raw)
To: Cristian Rodríguez, libc mailing list
On 03/05/23 16:17, Cristian Rodríguez via Libc-alpha wrote:
> Hi:
>
> Apparently posix/tst-execvpe6.c is not valid anymore at least on linux
> where NULL argv is invalid. The kernel is way too nice and not killing the
> process as it should but using an empty string instead.
>
> so,
>
> char *args3[] = { NULL };
> if (run_script (fname2, args3))
> return 1;
>
> is testing..
>
> char *args3[] = { "", NULL };
> if (run_script (fname2, args3))
> return 1;
>
> instead.
My understanding is kernel will append an empty string to avoid breaking
userspace:
fs/exec.c:
1919 retval = count(argv, MAX_ARG_STRINGS);
1920 if (retval == 0)
1921 pr_warn_once("process '%s' launched '%s' with NULL argv: empty string added\n",
1922 current->comm, bprm->filename);
[...]
1949 /*
1950 * When argv is empty, add an empty string ("") as argv[0] to
1951 * ensure confused userspace programs that start processing
1952 * from argv[1] won't end up walking envp. See also
1953 * bprm_stack_limits().
1954 */
1955 if (bprm->argc == 0) {
1956 retval = copy_string_kernel("", bprm);
1957 if (retval < 0)
1958 goto out_free;
1959 bprm->argc = 1;
1960 }
So this is not really 'invalid'.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-15 18:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 19:17 process 'ld-linux-x86-64' launched '/tmp/testscriptWLyRCA' with NULL argv: empty string added Cristian Rodríguez
2023-05-15 18:32 ` Adhemerval Zanella Netto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).