Sandbox adds a /bin/sh
binding even if enable-embedded-sandbox-shell
is false #525
Labels
No labels
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#525
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
In
src/libstore/globals.cc
these lines add a binding toSANDBOX_SHELL
as/bin/sh
even ifHAVE_EMBEDDED_SANDBOX_SHELL
isn't defined:Whether
SANDBOX_SHELL
is defined doesn't depend on the value ofenable-embedded-sandbox-shell
, just on whether the busybox program was found.From
src/libstore/meson.build
:From the main
meson.build
:From the main
meson.options
:The
required
field offind_program
is only false if thesandbox-shell
option remains at the default of"busybox"
, but that means that if busybox is detected as installed on the system, then it always gets bound to/bin/sh
in the sandbox.Steps To Reproduce
enable-embedded-sandbox-shell
set to false and busybox present on the host systemMy output:
Running
strings build/src/libstore/liblixstore.so | grep busybox
should show whether the binding/bin/sh=/usr/bin/busybox
is embedded into libstore.Expected behavior
Disabling
enable-embedded-sandbox-shell
should also prevent theSANBDOX_SHELL
being mounted as/bin/sh
.nix --version
outputSpecifically, commit
727258241
.This breaks many build scripts that use
/bin/sh
when the system busybox prefers it's own applets from the binaries onPATH
.If I am correctly understanding this bug filing, it is not a bug. The /bin/sh in the sandbox is not intended to be used except for bootstrapping, and is the only binary actually in the sandbox. If your build scripts are broken in the sandbox, consider using
patchShebangs
since they shouldn't depend on /bin/sh to begin with.Our builds only ship the embedded shell on static builds:
df0137226d/package.nix (L225)
Here, embedded means the sandbox shell binary is actually included within the nix binary itself then extracted at runtime. However, all nix-based Lix builds provide a /bin/sh that is busybox inside the sandbox, and that is effectively a standard expectation of the derivation build environment: a fairly minimal busybox that can be used for bootstrapping; the embedding just changes from whence it comes.
Granted, perhaps it should be removed since it is a major sandbox impurity that it comes from the nix implementation, but that would be a very breaking change that is very low on the priority list.
So the "expected" behaviour in this bug filing is very much unexpected behaviour in my view.
Ah, that makes sense. I don't know why I thought the embedded sandbox shell should influence that. But I do think there should be an option for disabling the embedding of system's busybox if present. I'm trying to bootstrap some derivations without using nixpkgs and I'd rather disable system's /bin/sh for this phase than patch every package I'm building.