-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
setuid-wrapper activationScript is not atomic #18124
Comments
This makes the replacement of the old wapper dir with the new one atomic if the kernel and FS support RENAME_EXCHANGE, and falls back to at least ensuring the old wrapper dir remains on the FS if interrupted during the (now smaller) inconsistent window. Fixes NixOS#18124
@edolstra @shlevy so this was failing because it's ready a tmpfs upon install:
So, if we want My proposal would be to make Thoughts? |
I think it would be better to just not have /var/setuid-wrappers be a tmpfs since we're symlinking to a tmpfs anyway. |
@domenkozar Well, we can just change nixos-install not to create that tmpfs, right? Not sure why it's doing that anyway... |
I'll have a PR ready soon, fixing a bug atm. |
Before this commit updating /var/setuid-wrappers/ folder introduced a small window where NixOS activation scripts could be terminated and resulted into empty /var/setuid-wrappers/ folder. That's very unfortunate because one might lose sudo binary. Instead we use two atomic operations mv and ln (as described in https://axialcorps.com/2013/07/03/atomically-replacing-files-and-directories/) to achieve atomicity. Since /var/setuid-wrappers is not a directory anymore, tmpfs mountpoints were removed in installation scripts and in boot process. Tested: - upgrade /var/setuid-wrappers/ from folder to a symlink - make sure /run/setuid-wrappers-dirs/ legacy symlink is really deleted
It's currently possible to cancel
nixos-rebuild
between deletion of previous setuid wrappers and population of new ones. And yes, I've been able to lock myself out of machine (almost, if I didn't have root ssh key).Current implementation: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/security/setuid-wrappers.nix#L118-L120
Proposed implementation (see at the bottom of blog post): https://axialcorps.com/2013/07/03/atomically-replacing-files-and-directories/
The text was updated successfully, but these errors were encountered: