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

Graham/fh 496 nix installer incorrectly validates fstab entries #1338

Merged

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Dec 5, 2024

Description

Drastically simplify how we edit the fstab. Also, enable nosuid and noatime, since neither of those are necessary for /nix.

Checklist
  • Formatted with cargo fmt
  • Built with nix build
  • Ran flake checks with nix flake check
  • Added or updated relevant tests (leave unchecked if not applicable)
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • Linked to related issues (leave unchecked if not applicable)
Validating with install.determinate.systems

If a maintainer has added the upload to s3 label to this PR, it will become available for installation via install.determinate.systems:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/pr/$PR_NUMBER | sh -s -- install

src/lib.rs Show resolved Hide resolved
/nix should not contain suid/setgid binaries in general.
We don't need atime either.
At the time, I think we were wondering if nix-collect-garbage used atime.
It doesn't.

Having atime is a pretty big performance penalty, and macOS mounts most filesytems noatime already.
* Move the "prelude" into a suffix, which makes writing and updating the fstab a much simpler operation.
  The fstab on macOS, where this is used, appears to handle a suffix comment just fine.
* Stop trying to detect foreign / native fstab entries.
* Generally, cut out a lot of opportunities for failure by implementing this as a straightforward filter and map.
@grahamc grahamc force-pushed the graham/fh-496-nix-installer-incorrectly-validates-fstab-entries branch from 1dd8bf5 to 15ea3e6 Compare December 5, 2024 17:29
@grahamc grahamc force-pushed the graham/fh-496-nix-installer-incorrectly-validates-fstab-entries branch from 3322941 to 3cb1128 Compare December 5, 2024 17:48
grahamc added a commit to grahamc/nix that referenced this pull request Dec 5, 2024
The Determinate Nix Installer has set nosuid and noatime in DeterminateSystems/nix-installer#1338, and figured this perf and security improvement is worthy of upstreaming.

The /nix volume shouldn't have setuid binaries anyway, and filesystems seem to generally be noatime on macOS.
Further, the garbage collector doesn't use atime.
@grahamc grahamc enabled auto-merge (squash) December 5, 2024 19:03
@grahamc grahamc merged commit b75ab75 into main Dec 5, 2024
21 checks passed
@grahamc grahamc deleted the graham/fh-496-nix-installer-incorrectly-validates-fstab-entries branch December 5, 2024 19:04
@cole-h cole-h added this to the 0.32.0 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants