You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For userspace programs to work properly under a PaX/grsecurity kernel, sometimes we need to mark executables with flags to disable some protections, on a binary-by-binary basis.
The plan was to use the "paxctl" utility to add a PT_PAX_FLAGS header to the ELF binary. However, modifying a binary does not work in all cases (such as programs that self-check their own binary), and general support for PT_PAX_FLAGS is probably going away at some point in the future.
The new approach is to use an extended attribute (xattr) to set these flags, e.g.:
From a cursory glance it seems, however, that the Nix store currently does not support extended attributes on NAR packages, so these xattrs would be lost when downloading from a binary cache or when copying packages to another system.
In fact, it's a bug that Nix allows extended attributes to be set at all. canonicalisePathMetaData() should really detect if a file has EAs or ACLs and remove them or barf.
I don't even see it's a good way to go. For the case of self-checking binaries, even hash-rewriting might be a problem. Are there some other use cases? Also note the portability problems: what do we do if the target FS doesn't support those attributes?
Indeed, I've already read that. I had hoped it had changed since the thesis.
One wonders whether the adoption of a new archive format such as SquashFS would solve such problems. It's portable, it allows arbitrary xattrs (e.g. hashes of each file/inode in a directory, and a hash of those hashes can be stored as an xattr for the directory itself; this means the layout "on disk" doesn't matter) (another example would be selinux/pax/apparmor flags), great compression, and via things such as union filesystems, can be composed in much more intricate ways than one can with chroot and the like.
Reacted by Nikita Mikhailov, Sarfaraz Nawaz and Yueh-Shun Li
My portability concern was mainly about portable representing these extra metadata in nix store.
Ideally we'd want NAR <-> nix store to be a bijection on each supported platform/FS combination; i.e. you want to go back and forth, nix-copy-closure among different platforms/FS combinations, etc. all without losing or "adding" any information.
Activity
edolstra commentedon Dec 18, 2013
In fact, it's a bug that Nix allows extended attributes to be set at all. canonicalisePathMetaData() should really detect if a file has EAs or ACLs and remove them or barf.
ts468 commentedon Aug 16, 2015
What would need to be done to have EAs available in the nix store? What is the best way I could help?
vcunat commentedon Aug 16, 2015
I don't even see it's a good way to go. For the case of self-checking binaries, even hash-rewriting might be a problem. Are there some other use cases? Also note the portability problems: what do we do if the target FS doesn't support those attributes?
spacekitteh commentedon Nov 26, 2016
Is there any support at all for metadata in NAR packages?
vcunat commentedon Nov 26, 2016
No, IIRC there's basically nothing, "on purpose". This description certainly looks like it: https://github.com/NixOS/nix/blob/master/src/libutil/archive.hh#L10
spacekitteh commentedon Nov 26, 2016
vcunat commentedon Nov 27, 2016
You can read about (some of) the original reasoning in Nix Thesis (5.2.1). IMO portability of such metadata is a serious concern.
spacekitteh commentedon Nov 27, 2016
Indeed, I've already read that. I had hoped it had changed since the thesis.
One wonders whether the adoption of a new archive format such as SquashFS would solve such problems. It's portable, it allows arbitrary xattrs (e.g. hashes of each file/inode in a directory, and a hash of those hashes can be stored as an xattr for the directory itself; this means the layout "on disk" doesn't matter) (another example would be selinux/pax/apparmor flags), great compression, and via things such as union filesystems, can be composed in much more intricate ways than one can with chroot and the like.
vcunat commentedon Nov 27, 2016
My portability concern was mainly about portable representing these extra metadata in nix store.
Ideally we'd want NAR <-> nix store to be a bijection on each supported platform/FS combination; i.e. you want to go back and forth,
nix-copy-closureamong different platforms/FS combinations, etc. all without losing or "adding" any information.spacekitteh commentedon Nov 27, 2016
Yeah. Obviously it'd put some constraints on supported filesystems. What are the current supported ones, do you know?
canonicalisePathMetaData(): Remove extended attributes / ACLs
@samuelgrf has signed the CLA from Pull Request NixOS#185
Merge pull request NixOS#185 from samuelgrf/typos
Merge pull request NixOS#185 from DeterminateSystems/release-v3.9.1/9…
doc/inventory: 20 GREEN+YELLOW candidates landed + 4-pass review
libstore/serve-protocol: extract BasicConnection base, rename remoteV…
libstore: doc — fix worker-protocol-connection wrong-shard wording, d…
libstore/serve-protocol: extract BasicConnection base, rename remoteV…
libstore: doc — fix worker-protocol-connection wrong-shard wording, d…
libstore: rl-next — document NixOS#185's serve-protocol field rename
doc/inventory: pass-4 review — record NixOS#185 disclosure-gap fix + …
refactor(eval-cache): NixOS#185 step A — skip SelectorGetWHNF for wra…
refactor(eval-cache): NixOS#185 step B — fully retire SelectorGetWHNF…
refactor(eval-cache): NixOS#185/NixOS#186 whnf obsSet entries use val…
feat(eval-cache): NixOS#185/NixOS#186 walker dispatches SelectorArg; …
refactor(eval-cache): NixOS#185 Role 3 — OuterObject::whnf emits prod…
refactor(eval-cache): NixOS#185 retire SelectorGetWHNF entirely