core: initialize groups list before checking SupplementaryGroups= of …#4533
Conversation
…a unit Always initialize the supplementary groups of caller before checking the unit SupplementaryGroups= option. Fixes systemd#4531
|
@tixxdz , thanks! This fixes #4531. But I wonder how should interact |
|
@evverx I see, actually I didn't look that much into the interaction with @poettering @keszybz a comment ? thanks |
Well, But doesn't work. I mean we get
Sure. But I'm not sure users read the code :-) |
|
@evverx hmm ok!
Hehe! Ok so the thing if we use supplementary groups and support them then coupled with DynamicUser= , services may share stuff, and we don't have control on the list of groups... IMHO If you manually set I will test later if DynamicUser= also honors the supplementary group list if the specified user if found. Thanks |
|
@tixxdz as documented SupplementaryGroups= should only extend, never override the supplemenary groups listed in /etc/groups. And I have the suspicion that we should use the same codepaths for this regardless if DynamicUsers= is set or not. After all, DynamicUsers= means "use a dynamic user if there is no static user for this". It does not mean "use a dynamic user, and fail if there is a static user"... |
|
@poettering ok, @evverx just assign to me since I'm still in the context. Thanks! |
|
@poettering , I'm not sure about |
|
@evverx for |
|
@evverx to complete on this, it may also fail on |
@tixxdz, oh, indeed
@poettering And this breaks the cc @lucab How to reproduce: -bash-4.3# systemctl cat hola --no-pager
# /etc/systemd/system/hola.service
[Service]
ExecStart=/busybox id
RootDirectory=/chroot
ProtectKernelTunables=yes
-bash-4.3# systemctl start hola
-bash-4.3# journalctl -u hola --no-pager
...
Nov 03 08:58:00 systemd-testsuite systemd[1]: hola.service: Passing 0 fds to service
Nov 03 08:58:00 systemd-testsuite systemd[1]: hola.service: About to execute: /busybox id
Nov 03 08:58:00 systemd-testsuite systemd[1]: hola.service: Forked /busybox as 195
Nov 03 08:58:00 systemd-testsuite systemd[1]: hola.service: Changed dead -> running
Nov 03 08:58:00 systemd-testsuite systemd[1]: hola.service: Job hola.service/start finished, result=done
Nov 03 08:58:00 systemd-testsuite systemd[1]: Started hola.service.
Nov 03 08:58:01 systemd-testsuite systemd[1]: hola.service: Failed to send unit change signal for hola.service: Connection reset by peer
Nov 03 08:58:01 systemd-testsuite systemd[1]: hola.service: Child 195 belongs to hola.service
Nov 03 08:58:01 systemd-testsuite systemd[1]: hola.service: Main process exited, code=exited, status=226/NAMESPACE
Nov 03 08:58:01 systemd-testsuite systemd[1]: hola.service: Changed running -> failed |
|
Hm, actually, the |
…a unit
Always initialize the supplementary groups of caller before checking the
unit SupplementaryGroups= option.
Fixes #4531