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

coreutils: fix unprivileged sandbox build #52672

Merged
merged 1 commit into from Dec 23, 2018
Merged

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Dec 22, 2018

In usernamespaces some POSIX assumptions break, which
make some coreutils fail when running with sandbox but without a nix-deamon.
With this pull request it is possible to bootstrap stdenv without root-permission,
which is quiet useful in HPC environments.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Mic92 Mic92 requested review from vcunat and dtzWill December 22, 2018 12:00
@Mic92
Copy link
Member Author

Mic92 commented Dec 22, 2018

I have 72 cores I would like to use.

@dtzWill
Copy link
Member

dtzWill commented Dec 23, 2018

I'm very much in favor of enabling this sort of usage!! However for something as absolutely critical as coreutils, I'm reluctant to disable so many tests. On one hand, AFAIK we've never had a problem with coreutils that a)was a build env/configuration problem and not just the fallout of intentional coreutils behavior change across version, AND/OR b)tests would have caught. On the other hand, we really don't want avoidable problems in these tools.

  • Disabling it (somehow?) only on such environments: similar (but less widespread) risks, and I expect would break hashes? Which is unfortunate, although I'm given the impression HPC users often require/prefer alternative NIX_STORE paths anyway.
  • Can an appropriate sandbox be created for this? Execution in QEMU?

I'm not entirely against this if we can't find other solutions, but seems worth at least brainstorming other ways first :).

@dtzWill
Copy link
Member

dtzWill commented Dec 23, 2018

Follow-up: is there a way to test this-- either to avoid regressions in the future once it's fixed, or more immediately to explore alternatives? :)

@Mic92
Copy link
Member Author

Mic92 commented Dec 23, 2018

Changing the /nix prefix is not required when the host system supports usernamespaces, which is what I do here. This works on debian and ubuntu-based systems.

  • Breaking the hash is what I want to avoid, since I want to use the these machines for testing nixpkgs/cross-compilation.
  • Disabling those tests conditionally will result in bit-rot when coreutils is upgraded
  • Execution in qemu requires access to /dev/kvm to get decent performance, which is not the default on most linux distribution

In usernamespaces some POSIX assumptions break, which
make some coreutils fail when running with sandbox but without a nix-deamon.
With this pull request it is possible to bootstrap stdenv without root-permission,
which is quiet useful in HPC environments.
@Mic92
Copy link
Member Author

Mic92 commented Dec 23, 2018

I updated the test list. Now it is only 5 out of 600 tests for coreutils that are disabled and are all related to chgrp, where the problem is that only one of the two groups in the sandbox are usable by the build user and 3 tests in gnulib, also related to ownership. If we would ever have a problem with those very basic commands, where are likely to catch this in other packages/nixos tests.

Does this sound acceptable?

@dtzWill
Copy link
Member

dtzWill commented Dec 23, 2018 via email

@Mic92 Mic92 merged commit 7c09454 into NixOS:staging Dec 23, 2018
@Mic92 Mic92 deleted the coreutils-fixes branch December 23, 2018 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants