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
Fix race between explicit mount and handling automount request from kernel #5916
Conversation
Patch looks good, but could you add a short comment about this issue to the if block you are changing? Otherwise the next one looking at these sources or changing them might break this again. Something brief suffices, possibly containing a link to this issue containing the longer explanation... Otherwirse looks excellent! thanks for spending the time to track this down, much appreciated. |
If a process accesses an autofs filesystem while systemd is in the middle of starting the mount unit on top of it, it is possible for the autofs_ptype_missing_direct request from the kernel to be received after the mount unit has been fully started: systemd forks and execs mount ... ... access autofs, blocks mount exits ... systemd receives SIGCHLD ... ... kernel sends request systemd receives request ... systemd needs to respond to this request, otherwise the kernel will continue to block access to the mount point.
ff986f0
to
61fd5ed
Compare
No problem. I've added a brief comment. |
thanks! |
…5916) If a process accesses an autofs filesystem while systemd is in the middle of starting the mount unit on top of it, it is possible for the autofs_ptype_missing_direct request from the kernel to be received after the mount unit has been fully started: systemd forks and execs mount ... ... access autofs, blocks mount exits ... systemd receives SIGCHLD ... ... kernel sends request systemd receives request ... systemd needs to respond to this request, otherwise the kernel will continue to block access to the mount point.
…5916) If a process accesses an autofs filesystem while systemd is in the middle of starting the mount unit on top of it, it is possible for the autofs_ptype_missing_direct request from the kernel to be received after the mount unit has been fully started: systemd forks and execs mount ... ... access autofs, blocks mount exits ... systemd receives SIGCHLD ... ... kernel sends request systemd receives request ... systemd needs to respond to this request, otherwise the kernel will continue to block access to the mount point. (cherry picked from commit e7d54bf) [fbui: adjust context] [fbui: fixes bsc#1076308] [fbui: fixes CVE-2018-1049]
…5916) If a process accesses an autofs filesystem while systemd is in the middle of starting the mount unit on top of it, it is possible for the autofs_ptype_missing_direct request from the kernel to be received after the mount unit has been fully started: systemd forks and execs mount ... ... access autofs, blocks mount exits ... systemd receives SIGCHLD ... ... kernel sends request systemd receives request ... systemd needs to respond to this request, otherwise the kernel will continue to block access to the mount point.
If a process accesses an autofs filesystem while systemd is in the middle of starting the mount unit on top of it, it is possible for the
autofs_ptype_missing_direct
request from the kernel to be received afterthe mount unit has been fully started:
systemd needs to respond to this request, otherwise the kernel will continue to block access to the mount point.
While I have only encountered this bug during boot on systems with automounted network filesystems, it can be triggered reasonably reliable with an artificial test case as follows:
The delay in the
sleep 0.006
command needs to be tweaked so that the automount request is sometimes, but not always, the trigger for systemd to mount the unit, and such that "Automount point already active?" only occasionally appears in the journal. Eventually the "Got automount request" message will appear after "Mounted /tmp/target", showing that the autofs request was received too late:When this happens the
cat
command will hang, even though the/tmp/target
filesystem was successfully mounted. Anything else that tries to access/tmp/target
will also hang until it is unmounted (viaumount
orsystemctl stop
).