Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ABRT in dynamic_user_acquire() #14733

Closed
wRAR opened this issue Feb 1, 2020 · 3 comments · Fixed by #14747
Closed

ABRT in dynamic_user_acquire() #14733

wRAR opened this issue Feb 1, 2020 · 3 comments · Fixed by #14747
Labels
bug 🐛 Programming errors, that need preferential fixing pid1
Milestone

Comments

@wRAR
Copy link

wRAR commented Feb 1, 2020

A Debian package (fwupd 1.3.7-1) installs a broken unit file, /lib/systemd/system/fwupd-refresh.service, that contains ExecStart=@bindir@/fwupdmgr refresh --no-metadata-check. When updating to this package version systemd crashed:

systemd[1]: Reloading.
systemd[1]: /lib/systemd/system/fwupd-refresh.service:17: Neither a valid executable name nor an absolute path: bindir@/fwupdmgr
systemd[1]: fwupd-refresh.service: Unit configuration has fatal error, unit will not be started.
systemd[1]: fwupd-refresh.service: Current command vanished from the unit file, execution of the command list won't be resumed.
systemd[1]: Assertion 'name' failed at src/core/dynamic-user.c:81, function dynamic_user_acquire(). Aborting.

I have the core file, here is the bt:

#0  0x00007f8dd5a3f367 in kill () at ../sysdeps/unix/syscall-template.S:78
#1  0x0000561425f2676f in crash (sig=6) at ../src/core/main.c:212
#2  <signal handler called>
#3  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#4  0x00007f8dd5a2a535 in __GI_abort () at abort.c:79
#5  0x00007f8dd5820947 in log_assert_failed_realm (realm=realm@entry=LOG_REALM_SYSTEMD, text=text@entry=0x561425f2f258 "name", file=file@entry=0x561425f33796 "src/core/dynamic-user.c", line=line@entry=81,
    func=func@entry=0x561425f55410 <__PRETTY_FUNCTION__.16857> "dynamic_user_acquire") at ../src/basic/log.c:809
#6  0x0000561425f13219 in dynamic_user_acquire (m=<optimized out>, name=0x0, ret=<optimized out>) at ../src/core/dynamic-user.c:81
#7  0x0000561425eb746e in dynamic_creds_acquire (group=0x0, user=0x0, m=0x561427b724d0, creds=<optimized out>) at ../src/core/dynamic-user.c:774
#8  unit_setup_dynamic_creds (u=<optimized out>) at ../src/core/unit.c:4915
#9  0x0000561425ee0190 in service_coldplug (u=0x561427b7ed70) at ../src/core/service.c:1201
#10 0x0000561425ebb44b in unit_coldplug (u=0x561427b7ed70) at ../src/core/unit.h:613
#11 unit_coldplug (u=0x561427b7ed70) at ../src/core/unit.c:3868
#12 0x0000561425ef44f9 in manager_coldplug (m=0x561427b724d0) at ../src/core/manager.c:1466
#13 0x0000561425f24066 in manager_reload (m=0x561427b724d0) at ../src/core/manager.c:3567
#14 invoke_main_loop (m=0x561427b724d0, saved_rlimit_nofile=<optimized out>, saved_rlimit_memlock=<optimized out>, ret_reexecute=<optimized out>, ret_retval=<optimized out>, ret_shutdown_verb=<optimized out>, ret_fds=<optimized out>,
    ret_switch_root_dir=<optimized out>, ret_switch_root_init=<optimized out>, ret_error_message=<optimized out>) at ../src/core/main.c:1753
#15 0x0000561425e78728 in main (argc=<optimized out>, argv=<optimized out>) at ../src/core/main.c:2682

Unfortunately I wasn't able to reproduce this, now systemd just says "Unit configuration has fatal error, unit will not be started.", even when updating the package to this version again.

systemd from Debian, 244.1-1. Initially filed at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950409

@yuwata
Copy link
Member

yuwata commented Feb 3, 2020

Please provide the following.

systemctl cat fwupd-refresh.service

@yuwata yuwata added bug 🐛 Programming errors, that need preferential fixing needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer pid1 labels Feb 3, 2020
@wRAR
Copy link
Author

wRAR commented Feb 3, 2020

# /lib/systemd/system/fwupd-refresh.service
[Unit]
Description=Refresh fwupd metadata and update motd
Documentation=man:fwupdmgr(1)
After=network.target network-online.target systemd-networkd.service NetworkManager.service connman.service

[Service]
Type=oneshot
CacheDirectory=fwupdmgr
StandardError=null
DynamicUser=yes
RestrictAddressFamilies=AF_NETLINK AF_UNIX AF_INET AF_INET6
SystemCallFilter=~@mount
ProtectKernelModules=yes
ProtectControlGroups=yes
RestrictRealtime=yes
SuccessExitStatus=2
ExecStart=@bindir@/fwupdmgr refresh --no-metadata-check

@yuwata yuwata removed the needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer label Feb 3, 2020
@yuwata
Copy link
Member

yuwata commented Feb 3, 2020

Thanks. Confirmed. Minimum reproducer is

  • step 1. create the following
# /etc/systemd/system/hoge.service
[Service]
Type=oneshot
ExecStart=sleep 1h
  • step 2.
$ sudo systemctl daemon-reload
$ sudo systemctl start hoge.service
  • step 3. Edit the unit file
# /etc/systemd/system/hoge.service
[Service]
Type=oneshot
ExecStart=@bindir@/sleep 1h
DynamicUser=yes
  • step 4.
$ sudo systemctl daemon-reload

@yuwata yuwata added this to the v245 milestone Feb 3, 2020
yuwata added a commit to yuwata/systemd that referenced this issue Feb 3, 2020
When unit is reloaded, and the reloaded unit has bad-setting, then
unit_patch_contexts() is not called and exec_context::user and group
may not be configured.

A minimum reproducer for the case is:
- step 1.
$ sudo systemctl edit --full hoge.service
[Service]
oneshot
ExecStart=sleep 1h

- step 2.
$ sudo systemctl start hoge.service

- step 3.
$ sudo systemctl edit --full hoge.service
[Service]
Type=oneshot
ExecStart=@bindir@/sleep 1h
DynamicUser=yes

Then pid1 crashed.

Fixes systemd#14733.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing pid1
Development

Successfully merging a pull request may close this issue.

2 participants