!VRULIdgoKmKPzJZzjj:nixos.org

Nix Hackers

897 Members
For people hacking on the Nix package manager itself189 Servers

Load older messages


SenderMessageTime
27 Nov 2024
@emilazy:matrix.orgemily

three possible solutions, of increasing elegance and decreasing layer violations

  1. Nix detects when it's poking at an aarch64-darwin binary – regardless of host platform! – and re-signs it after rewrite (so, Nix unconditionally links to rcodesign or similar I guess). and the code signature part of binaries is excluded from the content hash
  2. we put a manifest in nix-support listing files that are executables that need re-signing and (ditto) – this at least gives stdenv flexibility to get policy here even if we do the same sniffing by default
  3. we put a more elaborate manifest in nix-support listing files that need some kind of post-processing after rewriting and what tools to run on them and how to determine which parts of them should be excluded from the hash. this could also handle things like updating .zip checksums or whatever. but you could do things to "break the model" here of course, and it's not clear what the best format would be or how much flexibility you'd need
02:49:36
@Ericson2314:matrix.orgJohn Ericson
In reply to @emilazy:matrix.org
therefore rewriting binaries for CA self-references breaks them
ah ok emily I thought you meant the recent nixpkgs stuff
06:36:32
@Ericson2314:matrix.orgJohn Ericson emily: my actual plan is simply to have have self references :D 06:36:46
@Ericson2314:matrix.orgJohn Ericson I want "core" nixpkgs pkgs to be (a) no self references (b) relocatable, no /nix/store before any store path <asdfasdf>-<name> that's a reference 06:37:36
@Ericson2314:matrix.orgJohn Ericson (you can have /nix/store/asdfasdf-nix if it's just a made up path that's not a reference, like the ones in the nix manual --- I wouldn't want to make the manual illegal) 06:38:01
@emilazy:matrix.orgemily my point is that every aarch64-darwin binary essentially has a self-reference 06:38:11
@emilazy:matrix.orgemilyI mean, I guess it only actually breaks when you rewrite self-references06:38:28
@Ericson2314:matrix.orgJohn Ericsonyeah, I mean make it so there is nothing to rewrite06:38:36
@Ericson2314:matrix.orgJohn Ericsonrewriting is a bad hack06:38:44
@emilazy:matrix.orgemilysure. I would like a relocatable store. I have put thought into it06:38:53
@emilazy:matrix.orgemilyyou need to write your own Linux startup code, which is fun.06:39:01
@Ericson2314:matrix.orgJohn Ericson can't we just do $ORIGIN? 06:39:15
@Ericson2314:matrix.orgJohn Ericsonin rpath?06:39:18
@emilazy:matrix.orgemilydoesn't work for the ELF interpreter.06:39:21
@emilazy:matrix.orgemilyso you need your own bootstrap startup code to load a relative ELF interpreter.06:39:38
@Ericson2314:matrix.orgJohn Ericsonmmm06:40:01
@Ericson2314:matrix.orgJohn Ericsonwell, how much breaks if we use FHS interpreter heh06:40:12
@Ericson2314:matrix.orgJohn Ericsonit can still be the right thing within builds thanks to namespacing06:40:21
@emilazy:matrix.orgemily well, you'd break nix-ld for one thing 06:40:39
@emilazy:matrix.orgemily anyway I don't think relocatable store is practically achievable in Nixpkgs – we were just talking about glibc relying on self-reference and having a circular dependency with bash etc.; it's a nice moonshot idea but it would break so, so many packages and require quite extensive patching 06:40:45
@emilazy:matrix.orgemily certainly deploying ca-derivations for aarch64-darwin could not depend on that, I think, unless you want to delay it for years :) 06:41:11
@Ericson2314:matrix.orgJohn Ericsondoes the signature have to be adjacent?06:41:40
@emilazy:matrix.orgemilymy preference is for (3) because I want Hydra to be able to do actual full-blown macOS code signing, and making that solution work would pave the way towards that06:41:44
@emilazy:matrix.orgemilywhich would allow us to ship macOS GUI apps to users that don't have scary warnings on startup and can use functionality gated on entitlements that we currently have no way of delivering06:42:05
@emilazy:matrix.orgemily
In reply to @Ericson2314:matrix.org
does the signature have to be adjacent?
the hash (or signature) is embedded directly in the executable
06:42:25
@Ericson2314:matrix.orgJohn EricsonOK06:42:32
@emilazy:matrix.orgemilyin particular (3) is nice because it applies even when there's not rewriting going on06:42:55
@Ericson2314:matrix.orgJohn Ericsontbh I would ship linux-only CA first06:42:59
@emilazy:matrix.orgemilyit's a generic solution that happens to help solve the rewriting problem06:43:01
@Ericson2314:matrix.orgJohn Ericsonnot cause I hate mac06:43:04

Show newer messages


Back to Room ListRoom Version: 6