linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Ren Zhijie <renzhijie2@huawei.com>
Cc: ebiederm@xmission.com, keescook@chromium.org, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	tanghui20@huawei.com
Subject: Re: [PATCH] exec: Force binary name when argv is empty
Date: Tue, 20 Sep 2022 20:24:24 +0100	[thread overview]
Message-ID: <YyoTaBah0/z+ewWE@ZenIV> (raw)
In-Reply-To: <20220920120812.231417-1-renzhijie2@huawei.com>

On Tue, Sep 20, 2022 at 08:08:12PM +0800, Ren Zhijie wrote:
> From: Hui Tang <tanghui20@huawei.com>
> 
> First run './execv-main execv-child', there is empty in 'COMMAND' column
> when run 'ps -u'.
> 
>  USER       PID %CPU %MEM    VSZ   RSS TTY    [...] TIME COMMAND
>  root       368  0.3  0.0   4388   764 ttyS0        0:00 ./execv-main
>  root       369  0.6  0.0   4520   812 ttyS0        0:00
> 
> The program 'execv-main' as follows:
> 
>  int main(int argc, char **argv)
>  {
>    char *execv_argv[] = {NULL};
>    pid_t pid = fork();
> 
>    if (pid == 0) {
>      execv(argv[1], execv_argv);
>    } else if (pid > 0) {
>      wait(NULL);
>    }
>    return 0;
>  }
> 
> So replace empty string ("") added with the name of binary
> when calling execve with a NULL argv.
> 
> Fixes: dcd46d897adb ("exec: Force single empty string when argv is empty")

I don't see the point, to be honest...  You've passed BS argv to execve(),
why would you expect anything pretty from ps(1)?

IOW, where's the bug you are fixing?


      parent reply	other threads:[~2022-09-20 19:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 12:08 Ren Zhijie
2022-09-20 14:42 ` Eric W. Biederman
2022-09-20 22:21   ` Kees Cook
2022-09-20 19:24 ` Al Viro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YyoTaBah0/z+ewWE@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=ebiederm@xmission.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=renzhijie2@huawei.com \
    --cc=tanghui20@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox