All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@ubuntu.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>, Eryu Guan <guan@eryu.me>,
	fstests <fstests@vger.kernel.org>, Christoph Hellwig <hch@lst.de>,
	"Darrick J . Wong" <djwong@kernel.org>,
	David Howells <dhowells@redhat.com>
Subject: Re: [PATCH v10 0/6] fstests: add idmapped mounts tests
Date: Wed, 24 Mar 2021 14:49:53 +0100	[thread overview]
Message-ID: <20210324134953.ddq7njuohjekszhf@wittgenstein> (raw)
In-Reply-To: <CAOQ4uxgEkB++O3i12_xa9OTwsudu+Y6COUitJaW=+0FcBiA6oQ@mail.gmail.com>

On Wed, Mar 24, 2021 at 03:33:53PM +0200, Amir Goldstein wrote:
> On Wed, Mar 24, 2021 at 1:24 PM Amir Goldstein <amir73il@gmail.com> wrote:
> >
> > On Wed, Mar 24, 2021 at 10:41 AM Christian Brauner
> > <christian.brauner@ubuntu.com> wrote:
> > >
> > > On Wed, Mar 24, 2021 at 10:03:43AM +0200, Amir Goldstein wrote:
> > > > On Mon, Mar 22, 2021 at 4:22 PM Christian Brauner
> > > > <christian.brauner@ubuntu.com> wrote:
> > > > >
> > > > > On Mon, Mar 22, 2021 at 02:50:02PM +0100, Christian Brauner wrote:
> > > > > > On Mon, Mar 22, 2021 at 02:45:16PM +0100, Christian Brauner wrote:
> > > > > > > From: Christian Brauner <christian.brauner@ubuntu.com>
> > > > > > >
> > > > > > > Hey everyone,
> > > > > > >
> > > > > > > This series is available from:
> > > > > > > https://git.kernel.org/brauner/xfstests-dev/h/idmapped_mounts
> > > > > > > https://gitlab.com/brauner/xfstests/-/tree/idmapped_mounts
> > > > > > > https://github.com/brauner/xfstests/tree/idmapped_mounts
> > > > > >
> > > > > > I sent this series from my kernel.org mail address and patch 2/6 hasn't
> > > > > > made it through this time too. So it seems that vger is rejecting it due
> > > > > > to its size is my guess. I'll go poing the #korg folks to ask what's
> > > > > > going on and whether that can be handled.
> > > > >
> > > > > Ok, Konstantin confirmed that patch 2/6 got dropped because of it's
> > > > > size. Nothing to do about this now but just as an fyi.
> > > > >
> > > >
> > > > Since 2/6 got dropped, I'll write a small nit here which is also
> > >
> > > You could still pull it from above. I don't think resending would retain
> > > the patch afaict until vger has been ported by Konstantin.
> > >
> > > > relevant to the rest of the series:
> > > >
> > > > --- a/tests/generic/group
> > > > +++ b/tests/generic/group
> > > > @@ -634,3 +634,4 @@
> > > >  629 auto quick rw copy_range
> > > >  630 auto quick rw dedupe clone
> > > >  631 auto quick mount
> > > > +632 auto atime attr cap io_uring mount perms quick rw unlink
> > > >
> > > > This is a mouthful of test tags, but that doesn't hurt.
> > > > I would personally not bother with obscure tags like 'unlink' but whatever.
> > > >
> > > > Two things I would request are:
> > > > 1. Keep 'auto quick' before all other tags. There is no strong rule about
> > > >     this format, but that's the common practice and it makes sense IMO
> > > >     because -g auto and -g quick are the far more commonly used groups of
> > > >     tests, so it's convenient to be able to 'eye grep' those tests in
> > > > the group file.
> > > > 2. Please tags all the idmapped tests with a tag 'idmapped' (or whatever)
> > > >     This would be used for running tests with -g idmapped for quick sanity
> > > >     when modifiying idmapped mounts related code
> > >
> > > Ok, I'll wait for Eryu to respond (Since I assume he'll be the one in
> > > charge of applying it?)
> >
> > He will.
> >
> > Meanwhile, found a bug in Makefile:
> >
> > --- a/src/idmapped-mounts/Makefile
> > +++ b/src/idmapped-mounts/Makefile
> > @@ -25,11 +25,11 @@ depend: .dep
> >
> >  include $(BUILDRULES)
> >
> > -idmapped-mounts:
> > +idmapped-mounts: $(CFILES_IDMAPPED_MOUNTS)
> >         @echo "    [CC]    $@"
> >         $(Q)$(LTLINK) $(CFILES_IDMAPPED_MOUNTS) -o $@ $(CFLAGS)
> > $(LDFLAGS) $(LDLIBS)
> >
> > -mount-idmapped:
> > +mount-idmapped: $(CFILES_MOUNT_IDMAPPED)
> >         @echo "    [CC]    $@"
> >         $(Q)$(LTLINK) $(CFILES_MOUNT_IDMAPPED) -o $@ $(CFLAGS)
> > $(LDFLAGS) $(LDLIBS)
> >  ---
> >
> > And in parsing of /proc/<pid>/ns/user:
> >
> > --- a/src/idmapped-mounts/mount-idmapped.c
> > +++ b/src/idmapped-mounts/mount-idmapped.c
> > @@ -175,7 +175,7 @@ static int write_id_mapping(idmap_type_t map_type,
> > pid_t pid, const char *buf, s
> >         int fd = -EBADF, setgroups_fd = -EBADF;
> >         int fret = -1;
> >         int ret;
> > -       char path[STRLITERALLEN("/proc") + INTTYPE_TO_STRLEN(pid_t) +
> > +       char path[STRLITERALLEN("/proc/") + INTTYPE_TO_STRLEN(pid_t) +
> >                   STRLITERALLEN("/setgroups") + 1];
> >
> >         if (geteuid() != 0 && map_type == ID_TYPE_GID) {
> > @@ -273,7 +273,7 @@ static int get_userns_fd_from_idmap(struct list *idmap)
> >  {
> >         int ret;
> >         pid_t pid;
> > -       char path_ns[STRLITERALLEN("/proc") + INTTYPE_TO_STRLEN(pid_t) +
> > +       char path_ns[STRLITERALLEN("/proc/") + INTTYPE_TO_STRLEN(pid_t) +
> >                   STRLITERALLEN("/ns/user") + 1];
> >
> >         pid = do_clone(get_userns_fd_cb, NULL, CLONE_NEWUSER | CLONE_NEWNS);
> > @@ -364,7 +364,7 @@ int main(int argc, char *argv[])
> >         while ((ret = getopt_long_only(argc, argv, "", longopts,
> > &index)) != -1) {
> >                 switch (ret) {
> >                 case 'a':
> > -                       if (strnequal(optarg, "/proc",
> > STRLITERALLEN("/proc/"))) {
> > +                       if (strnequal(optarg, "/proc/",
> > STRLITERALLEN("/proc/"))) {
> >                                 fd_userns = open(optarg, O_RDONLY | O_CLOEXEC);
> > ---
> >
> 
> And also:
> 
> @@ -402,12 +402,15 @@ int main(int argc, char *argv[])
>                 exit(EXIT_FAILURE);
>         }
> 
> -       if (!list_empty(&active_map)) {
> +       if (!list_empty(&active_map) || fd_userns > 0) {
>                 struct mount_attr attr = {
>                         .attr_set = MOUNT_ATTR_IDMAP,
>                 };
> 
> -               attr.userns_fd = get_userns_fd_from_idmap(&active_map);
> +               if (fd_userns > 0)
> +                       attr.userns_fd = fd_userns;
> +               else
> +                       attr.userns_fd = get_userns_fd_from_idmap(&active_map);
>                 if (attr.userns_fd < 0)
>                         exit_log("%m - Failed to create user namespace\n");
> ---
> 
> It's a bug in the test helper program, not a bug in the test per-se because
> the test does not use the
> --map-mount=/proc/<pid>/ns/user option.

Thanks! Will fix and also re-order the patches.
Christian

  reply	other threads:[~2021-03-24 13:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 13:45 [PATCH v10 0/6] fstests: add idmapped mounts tests Christian Brauner
2021-03-22 13:45 ` [PATCH v10 1/6] generic/631: add test for detached mount propagation Christian Brauner
2021-03-24  7:40   ` Amir Goldstein
2021-03-24  7:50     ` Christian Brauner
2021-03-24  8:04       ` Amir Goldstein
2021-03-24  8:39         ` Christian Brauner
2021-03-24  9:45           ` Amir Goldstein
2021-03-24  9:52             ` Christian Brauner
2021-03-22 13:45 ` [PATCH v10 3/6] common/rc: add _scratch_{u}mount_idmapped() helpers Christian Brauner
2021-03-22 13:45 ` [PATCH v10 4/6] common/quota: move _qsetup() helper to common code Christian Brauner
2021-03-22 13:45 ` [PATCH v10 5/6] xfs/529: quotas and idmapped mounts Christian Brauner
2021-03-22 13:45 ` [PATCH v10 6/6] xfs/530: quotas on " Christian Brauner
2021-03-22 13:50 ` [PATCH v10 0/6] fstests: add idmapped mounts tests Christian Brauner
2021-03-22 14:21   ` Christian Brauner
2021-03-24  8:03     ` Amir Goldstein
2021-03-24  8:41       ` Christian Brauner
2021-03-24 11:24         ` Amir Goldstein
2021-03-24 13:33           ` Amir Goldstein
2021-03-24 13:49             ` Christian Brauner [this message]
2021-03-24 13:45           ` Christian Brauner
2021-03-24 14:01             ` Amir Goldstein
2021-03-24 14:03               ` 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=20210324134953.ddq7njuohjekszhf@wittgenstein \
    --to=christian.brauner@ubuntu.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=hch@lst.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.