Skip to content

libstore: Make our sandbox pivot_root directory accessible to ourself (backport #11684)#12193

Closed
mergify[bot] wants to merge 1 commit into2.18-maintenancefrom
mergify/bp/2.18-maintenance/pr-11684
Closed

libstore: Make our sandbox pivot_root directory accessible to ourself (backport #11684)#12193
mergify[bot] wants to merge 1 commit into2.18-maintenancefrom
mergify/bp/2.18-maintenance/pr-11684

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jan 10, 2025

If you have the Nix store mounted from a nonlocal filesystem whose exporter is not running as root, making the directory mode 000 makes it inaccessible to that remote unprivileged user and therefore breaks the build. (Specifically, I am running into this with a virtiofs mount using Apple Virtualization.framework as a non-root user, but I expect the same thing would happen with virtiofs in qemu on Linux as a non-root user or with various userspace network file servers.)

Make the directory mode 500 (dr-x------) to make the sandbox work in this use case, which explicitly conveys our intention to read and search the directory. The code only works because root can already bypass directory checks, so this does not actually grant more permissions to the directory owner / does not make the sandbox less secure.

Motivation

Context

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.


This is an automatic backport of pull request #11684 done by [Mergify](https://mergify.com).

If you have the Nix store mounted from a nonlocal filesystem whose
exporter is not running as root, making the directory mode 000 makes it
inaccessible to that remote unprivileged user and therefore breaks the
build. (Specifically, I am running into this with a virtiofs mount using
Apple Virtualization.framework as a non-root user, but I expect the
same thing would happen with virtiofs in qemu on Linux as a non-root
user or with various userspace network file servers.)

Make the directory mode 500 (dr-x------) to make the sandbox work in
this use case, which explicitly conveys our intention to read and search
the directory.  The code only works because root can already bypass
directory checks, so this does not actually grant more permissions to
the directory owner / does not make the sandbox less secure.

(cherry picked from commit 5a794d9)
@mergify mergify bot added the merge-queue label Jan 10, 2025
@roberth roberth added the automatic backport This PR is a backport produced by automation (does not trigger backporting) label Jan 20, 2025
@Mic92
Copy link
Member

Mic92 commented Apr 28, 2025

Nix 2.18 is eol.

@Mic92 Mic92 closed this Apr 28, 2025
@xokdvium xokdvium deleted the mergify/bp/2.18-maintenance/pr-11684 branch October 7, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments