Re: unshare regression in 2.42-rc1

Christian Albrecht Goeschel Ndjomouo <[email protected]> Sun, 22 Mar 2026 12:57:03 +0000
Newsgroups org.kernel.vger.util-linux,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <SJ0P220MB05417CC33D6BA305A9CEE320E94AA@SJ0P220MB0541.NAMP220.PROD.OUTLOOK.COM>
Hi Chris,

Thank you for pointing out this regression.

The problem is that if ul_getuserpw_str() cannot find any user with the pro=
vided
UID or username, the unshare internal helper function get_user() will error=
 out
and stop argument parsing, even if a valid numeric value was provided. Prev=
iously,
the code would fallback to simply converting the string to an unsigned int =
and use
it for the uid_t, so I added that behavior back.

I found this issue to be true for the --map-group option as well, so I went=
 ahead and fixed
both cases in this latest patch: https://github.com/util-linux/util-linux/p=
ull/4134/changes/c74df906b67b2f9930662ca4e1ba04c21569d529

Please let us know if this fixed the problem on your end.

Regards,

Christian Goeschel Ndjomouo

________________________________________
From: Chris Hofstaedtler <[email protected]>
Sent: Sunday, March 22, 2026 7:37 AM
To: Karel Zak
Cc: [email protected]; [email protected]; util-linux=
@vger.kernel.org; Christian Albrecht Goeschel Ndjomouo; Helmut Grohne
Subject: unshare regression in 2.42-rc1

Hi Karel, Christian,

Debian CI found a regression in the unshare command when using
--map-user with numeric UIDs. This worked in 2.41 and earlier:

% unshare --version && unshare --user --map-auto --map-user=3D65536 id
unshare from util-linux 2.41.3
uid=3D65536 gid=3D65534(nogroup) groups=3D65534(nogroup)

And is broken in 2.42-rc1:

% unshare --version && unshare --user --map-auto --map-user=3D65536 id
unshare from util-linux 2.42-rc1
unshare: failed to parse uid '65536'

Note the following (true in both cases):
$ grep 65536 /etc/passwd
%

I suspect (but did not verify yet) this was introduced in
commit 0a7fb806118bc4418e231081bd13c69bbc31b988
> unshare: use the new ul_get{grp,userpw}_str() routines
>
> This change refactors get_group() and get_user(), so that it
> uses the new routines ul_getgrp_str() and ul_getuserpw_str(),
> to simplify the code and remove the overkill mem allocations.
https://github.com/util-linux/util-linux/commit/0a7fb806118bc4418e231081bd1=
3c69bbc31b988<https://github.com/util-linux/util-linux/commit/0a7fb806118bc=
4418e231081bd13c69bbc31b988>

Thanks to Helmut Grohne for reducing the failed debvm CI run to the
short unshare command.

Best,
Chris