lkml.org 
[lkml]   [2022]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [fs/exec] 80bd5afdd8: xfstests.generic.633.fail
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.

\
 
 \ /
  Last update: 2022-01-31 16:52    [W:0.050 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site