linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christian Brauner <brauner@kernel.org>
Cc: kernel test robot <oliver.sang@intel.com>,
	Kees Cook <keescook@chromium.org>,
	Ariadne Conill <ariadne@dereferenced.org>,
	0day robot <lkp@intel.com>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Rich Felker <dalias@libc.org>,
	Eric Biederman <ebiederm@xmission.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	LKML <linux-kernel@vger.kernel.org>,
	lkp@lists.01.org, Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	stable@vger.kernel.org
Subject: Re: [fs/exec]  80bd5afdd8: xfstests.generic.633.fail
Date: Mon, 31 Jan 2022 15:51:21 +0000	[thread overview]
Message-ID: <YfgFeWbZPl+gAUYE@casper.infradead.org> (raw)
In-Reply-To: <20220131153707.oe45h7tuci2cbfuv@wittgenstein>

On Mon, Jan 31, 2022 at 04:37:07PM +0100, Christian Brauner wrote:
> On Mon, Jan 31, 2022 at 03:19:22PM +0000, Matthew Wilcox wrote:
> > On Mon, Jan 31, 2022 at 04:08:19PM +0100, Christian Brauner wrote:
> > > On Mon, Jan 31, 2022 at 10:43:52PM +0800, kernel test robot wrote:
> > > I can fix this rather simply in our upstream fstests with:
> > > 
> > > static char *argv[] = {
> > > 	"",
> > > };
> > > 
> > > I guess.
> > > 
> > > But doesn't
> > > 
> > > static char *argv[] = {
> > > 	NULL,
> > > };
> > > 
> > > seem something that should work especially with execveat()?
> > 
> > The problem is that the exec'ed program sees an argc of 0, which is the
> > problem we're trying to work around in the kernel (instead of leaving
> > it to ld.so to fix for suid programs).
> 
> Ok, just seems a bit more intuitive for path-based exec than for
> fd-based execveat().
> 
> What's argv[0] supposed to contain in these cases?
> 
> 1. execveat(fd, NULL, ..., AT_EMPTY_PATH)
> 2. execveat(fd, "my-file", ..., )
> 
> "" in both 1. and 2.?
> "" in 1. and "my-file" in 2.?

You didn't specify argv for either of those, so I have no idea.
Programs shouldn't be assuming anything about argv[0]; it's purely
advisory.  Unfortunately, some of them do.  And some of them are suid.


  reply	other threads:[~2022-01-31 15:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27  0:07 [PATCH v3] fs/exec: require argv[0] presence in do_execveat_common() Ariadne Conill
2022-01-27  5:29 ` Kees Cook
2022-01-27 16:51   ` Eric W. Biederman
2022-01-31 14:43 ` [fs/exec] 80bd5afdd8: xfstests.generic.633.fail kernel test robot
2022-01-31 15:08   ` Christian Brauner
2022-01-31 15:19     ` Matthew Wilcox
2022-01-31 15:37       ` Christian Brauner
2022-01-31 15:51         ` Matthew Wilcox [this message]
2022-01-31 16:14           ` Christian Brauner
2022-01-31 17:13             ` Christian Brauner
2022-01-31 21:59               ` Andrew Morton
2022-01-31 22:49                 ` Kees Cook
2022-02-01 13:28                   ` Christian Brauner
2022-02-01 13:28                 ` Christian Brauner

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=YfgFeWbZPl+gAUYE@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --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-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=mtk.manpages@gmail.com \
    --cc=oliver.sang@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).