Commit Graph

19 Commits

Author SHA1 Message Date
Peder Bergebakken Sundt
eb02e003b0 buildFHSEnvBubblewrap/buildFHSEnv: permit pname+version instead of name 2024-04-24 15:26:52 +02:00
Peder Bergebakken Sundt
bbb1f25bfb buildFHSEnvBubblewrap: do not infer pname from name 2024-04-24 15:26:52 +02:00
Thomas Watson
9bcd91ba09 build-fhsenv-bubblewrap: reference 32-bit binaries only if multiArch
Fixes issues using bubblewrap'd fhsenvs in scenarios where i686 is not
supported (such as Rosetta 2 emulation in a Linux VM on Apple Silicon).
2024-04-07 10:44:53 -05:00
annalee
7541ec60b6
Merge remote-tracking branch 'upstream/master' into staging-next 2024-03-25 18:04:41 +00:00
Philip Taron
a14127aa64 Avoid top-level with ...; in pkgs/build-support/build-fhsenv-bubblewrap/default.nix 2024-03-19 22:31:19 +01:00
hellwolf
09b82b349a
build-fhsenv-bubblewrap: fix fhsenv etc entries
* added more comments.
* symlink fhsenv etc entries when necessary.
2024-03-10 19:23:45 +02:00
Jeff Huffman
a6671578ff
buildFHSEnv: bind dbus session bus into place when privateTmp enabled (#278917) 2024-01-09 18:29:53 +01:00
Jeff Huffman
aa070a5d9a
buildFHSEnv: fix privateTmp for sddm 2023-12-21 12:11:35 -05:00
K900
5eb4128d60 buildFHSEnv: propagate host /etc if nested
This fixes use cases like launching Lutris/Heroic from Steam.
2023-12-16 10:04:09 +03:00
Jeff Huffman
195248b6c1 buildFHSEnv, steam: isolate steam's /tmp from host
Works around steam's misbehavior: https://github.com/ValveSoftware/steam-for-linux/issues/9121
2023-12-13 23:33:05 -08:00
Jeff Huffman
452b8162ec buildFHSEnv: use symlinks instead of bind mounts for files from host /etc
Closes #247065
2023-12-13 23:33:05 -08:00
Arthur Gautier
233ca3d9ac buildFHSenv: fixup /etc permissions
when bubblewraps tries to link all the required files in etc from the
host to the fhs environment, it will re-create the /etc directory.
It will do so with `0700` permissions. This causes permissions issues
with non-root programs when they need to access configuration in the
environment /etc.

By mounting /etc as a tmpfs early, bwrap will make the directory `0755`
as expected.
2023-11-12 17:02:53 -08:00
Bjørn Forsman
55e30da2eb buildFHSEnvBubblewrap: preserve pname, version
It's useful to have access to these attributes from packages built with
buildFHSEnvBubblewrap, and it reduces the difference between FHS and
non-FHS packages.

'name' is already handled by runCommandLocal.
2023-10-06 19:37:39 +02:00
Bjørn Forsman
70b5588b4e buildFHSEnvBubblewrap: allow being passed 'pname'
`buildFHSEnvBubblewrap { pname = ...; }` currently results in eval error
because args.name doesn't exist then. Fix it by only using args.name if
it exists.
2023-09-24 19:57:21 +02:00
rnhmjoj
c945723356
buildFHSEnv: disable security features by default
The implicit contract of buildFHSUserEnv was that it allows to run
software built for a typical GNU/Linux distribution (not NixOS) without
patching it (patchelf, autoPatchelfHook, etc.). Note that this does not
inherently imply running untrusted programs.

buildFHSUserEnv was implemented by using chroot and assembling a
standard-compliant FHS environment in the new root. As expected, this
did not provide any kind of isolation between the system and the
programs.

However, when it was later reimplemented using bubblewrap
(PR #225748), which *is* a security tool, several isolation features
involving detaches Linux namespaces were turned on by default.
This decision has introduced a number of breakages that are very
difficult to debug and trace back to this change.
For example: `unshareIPC` breaks software audio mixing in programs using
ALSA (dmix) and `unsharePID` breaks gdb,

Since:

  1. the security features were enable without any clear threat model;
  2. `buildFHSEnvBubblewrap` is supposed to be a drop-in replacement of
     `buildFHSEnvChrootenv` (see the release notes for NixOS 23.05);
  3. the change is breaking in several common cases (security does not
     come for free);
  4. the contract was not changed, or at least communicated in a clear
     way to the users;

all security features should be turned off by default.

P.S. It would be useful to create a variant of buildFHSEnv that does
provide some isolation. This could unshare some namespaces and mount
only limited parts of the filesystem.
Note that buildFHSEnv mounts every directory in / under the new root, so
again, very little is gained by unsharing alone.
2023-09-08 09:15:50 +02:00
Atemu
d5f0da152a Revert "Merge pull request #230693 from Atemu/fix/fhsenv-escape-runScript-path"
This reverts commit 840f2e0ac5, reversing
changes made to d3ed0402e5.

This breaks appimage which puts args into the runScript and we don't provide a
good way to pass thru additional args.

The actual bug was in nix-alien which should escape paths; providing a valid
runScript is the responsibility of the caller.
2023-05-22 11:34:04 -03:00
Atemu
cd96817b29 buildFHSEnvBubblewrap: escape runScript path
Fixes https://github.com/NixOS/nixpkgs/issues/230651

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
2023-05-11 08:28:05 +02:00
Weijia Wang
3c6e26b2ee buildFHSEnv: restrict pkgsi686Linux to x86_64-linux 2023-04-22 15:31:27 +03:00
Atemu
f63a12f296 tree-wide: buildFHSUserEnv -> buildFHSEnv 2023-04-16 10:15:13 +02:00