util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Gerber <dg@atufi.org>
To: Sean Anderson <seanga2@gmail.com>
Cc: dottedmag@dottedmag.net, id@mbekkema.name, jpeach@apache.org,
	kzak@redhat.com, util-linux@vger.kernel.org
Subject: Re: [PATCH v2 0/6] unshare: Add support for mapping ranges of user/group IDs
Date: Fri, 14 Jan 2022 18:15:31 +0100	[thread overview]
Message-ID: <87zgny2q8c.fsf@atufi.org> (raw)
In-Reply-To: <73850170-db69-7d64-ca9e-6e41dfa4eab9@gmail.com>


2022-01-14, Sean Anderson:
> It's stack garbage. Try
>
> diff --git i/sys-utils/unshare.c w/sys-utils/unshare.c
> index 3cdd90329..5ac7af3de 100644
> --- i/sys-utils/unshare.c
> +++ w/sys-utils/unshare.c
> @@ -385,10 +385,10 @@ struct map_range {
>   */
>  static int uint_to_id(const char *name, size_t sz)
>  {
> -       char buf[UID_BUFSIZ];
> +       char buf[UID_BUFSIZ] = {0};
>  -       mem2strcpy(buf, name, sz, sizeof(buf));
> -       return strtoul_or_err(name, _("could not parse ID"));
> +       memcpy(buf, name, min(sz, sizeof(buf) - 1));
> +       return strtoul_or_err(buf, _("could not parse ID"));
>  }
>    /**

That works, thanks.


> > Also, I would suggest adopting the same argument order as in /proc/<pid>/uid_map and newuidmap -- inner,outer,count.

> I think this is a rather silly order. Since this is a mapping, the "natural" order is

> outer -> inner

> and only from the new namespace's PoV is it

> inner -> outer

> It certainly helped me remember things once I reversed the order...

All right, this may make some sense to me now. To the user discovering these tools though (me yesterday) the worst is missing one "standard" notation...

> > This doc string has it reversed:

> As noted above, this is intended.

> >   * struct map_range - A range of IDs to map
> >   * @outer: First ID inside the namespace
> >   * @inner: First ID outside the namespace

I mean "@outer: First ID inside ..." surely is a typo, isn't it?


Best,

Daniel

  reply	other threads:[~2022-01-14 17:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 18:26 [PATCH v2 0/6] unshare: Add support for mapping ranges of user/group IDs Sean Anderson
2021-11-24 18:26 ` [PATCH v2 1/6] include/c: Add abs_diff macro Sean Anderson
2021-11-24 18:26 ` [PATCH v2 2/6] unshare: Add waitchild helper Sean Anderson
2021-11-24 18:26 ` [PATCH v2 3/6] unshare: Add some helpers for forking and synchronizing Sean Anderson
2021-11-24 18:26 ` [PATCH v2 4/6] unshare: Add options to map blocks of user/group IDs Sean Anderson
2021-11-24 18:26 ` [PATCH v2 5/6] unshare: Add option to automatically create user and group maps Sean Anderson
2021-11-24 18:26 ` [PATCH v2 6/6] unshare: Document --map-{groups,users,auto} Sean Anderson
2021-12-01 15:16 ` [PATCH v2 0/6] unshare: Add support for mapping ranges of user/group IDs Karel Zak
2022-01-14 10:29 ` Daniel Gerber
2022-01-14 14:42   ` Sean Anderson
2022-01-14 17:15     ` Daniel Gerber [this message]
2022-01-15  0:53       ` Sean Anderson
2022-01-18 11:50   ` Karel Zak

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=87zgny2q8c.fsf@atufi.org \
    --to=dg@atufi.org \
    --cc=dottedmag@dottedmag.net \
    --cc=id@mbekkema.name \
    --cc=jpeach@apache.org \
    --cc=kzak@redhat.com \
    --cc=seanga2@gmail.com \
    --cc=util-linux@vger.kernel.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).