From: Alexey Dobriyan <adobriyan@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: Eric Biederman <ebiederm@xmission.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org,
Ariadne Conill <ariadne@dereferenced.org>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Matthew Wilcox <willy@infradead.org>,
Christian Brauner <brauner@kernel.org>,
Rich Felker <dalias@libc.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] selftests/exec: Avoid future NULL argv execve warning
Date: Wed, 2 Feb 2022 18:13:39 +0300 [thread overview]
Message-ID: <Yfqfo0rbq/B/l6IP@localhost.localdomain> (raw)
In-Reply-To: <20220201000807.2453486-1-keescook@chromium.org>
On Mon, Jan 31, 2022 at 04:08:07PM -0800, Kees Cook wrote:
> Build actual argv for launching recursion test to avoid future warning
> about using an empty argv in execve().
> --- a/tools/testing/selftests/exec/recursion-depth.c
> +++ b/tools/testing/selftests/exec/recursion-depth.c
> @@ -24,8 +24,14 @@
> #include <sys/mount.h>
> #include <unistd.h>
>
> +#define FILENAME "/tmp/1"
> +#define HASHBANG "#!" FILENAME "\n"
> +
> int main(void)
> {
> + char * const argv[] = { FILENAME, NULL };
> + int rv;
Can we move out of -Wdeclaration-after-statement mentality in tests at least?
> - int rv = execve(FILENAME, NULL, NULL);
> + rv = execve(FILENAME, argv, NULL);
int rv = execve(FILENAME, (char*[]){FILENAME, NULL}, NULL);
is cleaner (and modern)!
> if (rv == -1 && errno == ELOOP) {
> return 0;
> }
next prev parent reply other threads:[~2022-02-02 15:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 0:08 [PATCH] selftests/exec: Avoid future NULL argv execve warning Kees Cook
2022-02-02 15:13 ` Alexey Dobriyan [this message]
2022-02-02 17:38 ` Shuah Khan
2022-02-02 21:00 ` Alexey Dobriyan
2022-02-04 16:11 ` Shuah Khan
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=Yfqfo0rbq/B/l6IP@localhost.localdomain \
--to=adobriyan@gmail.com \
--cc=ariadne@dereferenced.org \
--cc=brauner@kernel.org \
--cc=dalias@libc.org \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).