Bug 998 - Segmentation fault when invoked inside systemd-nspawn container
Segmentation fault when invoked inside systemd-nspawn container
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.9.8
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-09-18 19:57 MDT by Andrew Turny
Modified: 2021-09-21 10:12 MDT (History)
0 users

See Also:


Attachments
debug build stacktrace and strace (213.09 KB, text/plain)
2021-09-18 19:57 MDT, Andrew Turny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Turny 2021-09-18 19:57:04 MDT
Created attachment 559 [details]
debug build stacktrace and strace

In a fresh Arch Linux nspawn container, calling `sudo --login -u builduser /bin/true` (/bin/true or anything else) as root results in a segmentation fault.

/etc/sudoers.d/test contains the following, added with visudo:

    builduser ALL = NOPASSWD: /usr/bin/pacman


It works fine if one of following actions is taken:

- `resolve [!UNAVAIL=return]` is removed from the hosts line in /etc/nsswitch.conf.
- `builduser ALL = NOPASSWD: /usr/bin/pacman` is added to /etc/sudoers instead of a drop-in file.
- Not specifying `--login`.


sssd is not installed and the host uses systemd-resolved.

Stackstrace and strace attached.

--
sudo -l:
User builduser may run the following commands on archroot:
    (root) NOPASSWD: /usr/bin/pacman

sudo -V:
Sudo version 1.9.8p1
Sudoers policy plugin version 1.9.8p1
Sudoers file grammar version 48
Sudoers I/O plugin version 1.9.8p1
Sudoers audit plugin version 1.9.8p1
Comment 1 Todd C. Miller 2021-09-19 14:07:15 MDT
Thank you for your detailed report.  This is now fixed by https://www.sudo.ws/repos/sudo/rev/4b297f2ead15

The fix will be part of sudo 1.9.8p2
Comment 2 Todd C. Miller 2021-09-21 10:12:55 MDT
Fixed in sudo 1.9.8p2 which is available now.