[Nix#9625] aarch64-darwin: sandbox issue with /private/etc/ssl/openssl.cnf #83

Open
opened 2024-03-16 06:44:49 +00:00 by lix-bot · 0 comments
Member

Upstream-Issue: NixOS/nix#9625

Describe the bug

Migrating from https://github.com/oxalica/rust-overlay/issues/148

In short, I'm having a new build failure for rust packages using oxalica/rust-overlay that seems to be related to a sandboxing issue (as it is giving a permissions error for /private/etc/ssl/openssl.cnf but succeeds with --option sandbox false. An identical flake was building without issue previously, so my guess is that it's related to the recently installed MacOS Sonoma 14.2 update.

I've been following https://github.com/NixOS/nix/issues/4119 with great interest, so I thought this ?sandbox issue belonged in nixos/nix but would be happy to move elsewhere.

Steps To Reproduce

Run the following with the below flake.nix:

$ nix develop
$ cargo init --name foo
$ cargo update
$ exit
$ git add .
$
$ nix build
error: builder for '/nix/store/s76i74llg2dbd49hc013y58zxmcbcry1-foo.drv' failed with exit code 1;
       last 10 log lines:
       > Finished cargoSetupPostPatchHook
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > Running phase: buildPhase
       > Executing cargoBuildHook
       > ++ env CC_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CXX_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CC_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CXX_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CARGO_BUILD_TARGET=aarch64-apple-darwin HOST_CC=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc HOST_CXX=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ cargo build -j 8 --target aarch64-apple-darwin --frozen --profile release
       > Auto configuration failed
       > 8082083840:error:02FFF001:system library:func(4095):Operation not permitted:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:122:fopen('/private/etc/ssl/openssl.cnf', 'rb')
       > 8082083840:error:20FFF002:BIO routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:127:
       > 8082083840:error:0EFFF002:configuration file routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/conf/conf_def.c:202:
       For full logs, run 'nix log /nix/store/s76i74llg2dbd49hc013y58zxmcbcry1-foo.drv'. 
$
$ nix build --option sandbox false
$ result/bin/foo
Hello, world!
{
  description = "Basic template for nix + rust";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    self,
    nixpkgs,
    rust-overlay,
  }: let
    system = "aarch64-darwin";
    pkgs = import nixpkgs {
      inherit system;
      overlays = [
        (import rust-overlay)
      ];
    };
    toolchain = pkgs.rust-bin.stable.latest.default;
    rustPlatform = pkgs.makeRustPlatform {
      rustc = toolchain;
      cargo = toolchain;
    };
    name = "foo";
  in {
    packages.${system} = {
      default = self.packages.${system}.${name};
      ${name} = rustPlatform.buildRustPackage {
        inherit name;
        version = "0.0.1";
        src = ./.;
        cargoLock.lockFile = ./Cargo.lock;
      };
    };

    apps.${system}.default = {
      type = "app";
      program = "${self.packages.${system}.${name}}/bin/${name}";
    };

    devShells.${system}.default = pkgs.mkShell {
      buildInputs = [toolchain];
    };
  };
}

Expected behavior

Successful build

nix-env --version output

$ nix-env --version
nix-env (Nix) 2.18.1

Additional context

I'm not finding any relevant issues googling or searching nixpkgs issues for "/private/etc/ssl/openssl.cnf" or "Auto configuration failed".

$ stat /private/etc/ssl/openssl.cnf
  File: /private/etc/ssl/openssl.cnf
  Size: 745             Blocks: 8          IO Block: 4096   regular file
Device: 1,25    Inode: 463498578   Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/   wheel)
Access: 2023-12-05 00:37:15.000000000 -0700
Modify: 2023-12-05 00:37:15.000000000 -0700
Change: 2023-12-12 12:15:52.130035727 -0700
 Birth: 2023-12-05 00:37:15.000000000 -0700

Full log:

$ nix log /nix/store/s76i74llg2dbd49hc013y58zxmcbcry1-foo.drv
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/8m5mxx9kjp334f38ww1mv65ivfamajnd-2h89izhgqg0vhmpwd913vgiplglql24l-source
source root is 2h89izhgqg0vhmpwd913vgiplglql24l-source
Executing cargoSetupPostUnpackHook
Finished cargoSetupPostUnpackHook
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
Executing cargoSetupPostPatchHook
Validating consistency between /private/tmp/nix-build-foo.drv-0/2h89izhgqg0vhmpwd913vgiplglql24l-source/Cargo.lock and /private/tmp/nix-build-foo.drv-0/cargo-vendor-dir/Cargo.lock
Finished cargoSetupPostPatchHook
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
Executing cargoBuildHook
++ env CC_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CXX_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CC_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CXX_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CARGO_BUILD_TARGET=aarch64-apple-darwin HOST_CC=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc HOST_CXX=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ cargo build -j 8 --target aarch64-apple-darwin --frozen --profile release
Auto configuration failed
8082083840:error:02FFF001:system library:func(4095):Operation not permitted:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:122:fopen('/private/etc/ssl/openssl.cnf', 'rb')
8082083840:error:20FFF002:BIO routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:127:
8082083840:error:0EFFF002:configuration file routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/conf/conf_def.c:202:

Priorities

Add 👍 to issues you find important.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/9625 **Describe the bug** Migrating from https://github.com/oxalica/rust-overlay/issues/148 In short, I'm having a new build failure for rust packages using `oxalica/rust-overlay` that seems to be related to a sandboxing issue (as it is giving a permissions error for `/private/etc/ssl/openssl.cnf` but succeeds with `--option sandbox false`. An identical flake was building without issue previously, so my guess is that it's related to the recently installed MacOS Sonoma 14.2 update. I've been following https://github.com/NixOS/nix/issues/4119 with great interest, so I thought this ?sandbox issue belonged in nixos/nix but would be happy to move elsewhere. **Steps To Reproduce** Run the following with the below `flake.nix`: ```console $ nix develop $ cargo init --name foo $ cargo update $ exit $ git add . $ $ nix build error: builder for '/nix/store/s76i74llg2dbd49hc013y58zxmcbcry1-foo.drv' failed with exit code 1; last 10 log lines: > Finished cargoSetupPostPatchHook > Running phase: updateAutotoolsGnuConfigScriptsPhase > Running phase: configurePhase > Running phase: buildPhase > Executing cargoBuildHook > ++ env CC_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CXX_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CC_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CXX_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CARGO_BUILD_TARGET=aarch64-apple-darwin HOST_CC=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc HOST_CXX=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ cargo build -j 8 --target aarch64-apple-darwin --frozen --profile release > Auto configuration failed > 8082083840:error:02FFF001:system library:func(4095):Operation not permitted:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:122:fopen('/private/etc/ssl/openssl.cnf', 'rb') > 8082083840:error:20FFF002:BIO routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:127: > 8082083840:error:0EFFF002:configuration file routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/conf/conf_def.c:202: For full logs, run 'nix log /nix/store/s76i74llg2dbd49hc013y58zxmcbcry1-foo.drv'. $ $ nix build --option sandbox false $ result/bin/foo Hello, world! ``` ```nix { description = "Basic template for nix + rust"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, rust-overlay, }: let system = "aarch64-darwin"; pkgs = import nixpkgs { inherit system; overlays = [ (import rust-overlay) ]; }; toolchain = pkgs.rust-bin.stable.latest.default; rustPlatform = pkgs.makeRustPlatform { rustc = toolchain; cargo = toolchain; }; name = "foo"; in { packages.${system} = { default = self.packages.${system}.${name}; ${name} = rustPlatform.buildRustPackage { inherit name; version = "0.0.1"; src = ./.; cargoLock.lockFile = ./Cargo.lock; }; }; apps.${system}.default = { type = "app"; program = "${self.packages.${system}.${name}}/bin/${name}"; }; devShells.${system}.default = pkgs.mkShell { buildInputs = [toolchain]; }; }; } ``` **Expected behavior** Successful build **`nix-env --version` output** ```console $ nix-env --version nix-env (Nix) 2.18.1 ``` **Additional context** I'm not finding any relevant issues googling or searching nixpkgs issues for "/private/etc/ssl/openssl.cnf" or "Auto configuration failed". ```console $ stat /private/etc/ssl/openssl.cnf File: /private/etc/ssl/openssl.cnf Size: 745 Blocks: 8 IO Block: 4096 regular file Device: 1,25 Inode: 463498578 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ wheel) Access: 2023-12-05 00:37:15.000000000 -0700 Modify: 2023-12-05 00:37:15.000000000 -0700 Change: 2023-12-12 12:15:52.130035727 -0700 Birth: 2023-12-05 00:37:15.000000000 -0700 ``` Full log: ```console $ nix log /nix/store/s76i74llg2dbd49hc013y58zxmcbcry1-foo.drv @nix { "action": "setPhase", "phase": "unpackPhase" } Running phase: unpackPhase unpacking source archive /nix/store/8m5mxx9kjp334f38ww1mv65ivfamajnd-2h89izhgqg0vhmpwd913vgiplglql24l-source source root is 2h89izhgqg0vhmpwd913vgiplglql24l-source Executing cargoSetupPostUnpackHook Finished cargoSetupPostUnpackHook @nix { "action": "setPhase", "phase": "patchPhase" } Running phase: patchPhase Executing cargoSetupPostPatchHook Validating consistency between /private/tmp/nix-build-foo.drv-0/2h89izhgqg0vhmpwd913vgiplglql24l-source/Cargo.lock and /private/tmp/nix-build-foo.drv-0/cargo-vendor-dir/Cargo.lock Finished cargoSetupPostPatchHook @nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" } Running phase: updateAutotoolsGnuConfigScriptsPhase @nix { "action": "setPhase", "phase": "configurePhase" } Running phase: configurePhase @nix { "action": "setPhase", "phase": "buildPhase" } Running phase: buildPhase Executing cargoBuildHook ++ env CC_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CXX_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CC_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CXX_AARCH64_APPLE_DARWIN=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc CARGO_BUILD_TARGET=aarch64-apple-darwin HOST_CC=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/cc HOST_CXX=/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/c++ cargo build -j 8 --target aarch64-apple-darwin --frozen --profile release Auto configuration failed 8082083840:error:02FFF001:system library:func(4095):Operation not permitted:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:122:fopen('/private/etc/ssl/openssl.cnf', 'rb') 8082083840:error:20FFF002:BIO routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:127: 8082083840:error:0EFFF002:configuration file routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/conf/conf_def.c:202: ``` **Priorities** Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
lix-bot added the
bug
imported
labels 2024-03-16 06:44:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#83
No description provided.