Public bug reported:

virt-login-shell is part of libvirt-lxc which we don't really support
anyway favoring the much much better LXD.

But never the less just crashing seems bad.

$ virt-login-shell
Segmentation fault (core dumped)


On Focal we need the virt-login-shell helper instead which is incoming.
Not sure if it is an issue there, but in all former releases it seems broken.
OTOH that this is broken since what seems forever confirms that it can't be too 
important to anyone.

dmesg:
[705801.102482] virt-login-shel[9127]: segfault at 0 ip 0000556291d32262 sp 
00007fff3d963a00 error 4 in virt-login-shell[556291d2f000+c0000]
[705801.102493] Code: 00 89 6c 24 30 4c 8b a4 24 b8 00 00 00 4c 8d b4 24 b0 00 
00 00 44 89 54 24 28 eb 0e 80 7f 01 00 0f 85 c5 07 00 00 49 83 c4 08 <49> 8b 3c 
24 48 85 ff 0f 84 2a 08 00 00 80 3f 25 74 e0 48 8b 74 24

gdb with debug symbols
(gdb) bt
#0  virLoginShellAllowedUser (ngroups=13, groups=0x55555569f080, 
name=0x55555569ded0 "ubuntu", conf=0x5555556a0330) at 
../../../tools/virt-login-shell.c:57
#1  main (argc=<optimized out>, argv=<optimized out>) at 
../../../tools/virt-login-shell.c:242


    if (virConfGetValueStringList(conf, "allowed_users", false, &users) < 0)
        goto cleanup;

    for (entries = users; *entries; entries++) {
        char *entry = *entries;

This should give up if users is empty

(gdb) p entries
$1 = (char **) 0x0
(gdb) p users
$2 = (char **) 0x0

That is due to the default config /etc/libvirt/virt-login-shell.conf not
allowing anyone.

If the config contains a user the error is good:
libvirt:  error : ubuntu not matched against 'allowed_users' in 
/etc/libvirt/virt-login-shell.conf: Operation not permitted

If the config allows the user but nothing exists it is good as well:
libvirt: LXC Driver error : Domain not found: No domain with matching name 
'ubuntu'
libvirt: LXC Driver error : Domain not found: No domain with matching name 
'ubuntu'

So just add a null check and return gracefully.

** Affects: libvirt (Ubuntu)
     Importance: Undecided
         Status: Triaged

** Changed in: libvirt (Ubuntu)
       Status: New => Triaged

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1861798

Title:
  virt-login-shell crashes

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1861798/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to