Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl: 7.76.1 -> 7.77.0 #124502

Closed
wants to merge 2 commits into from
Closed

curl: 7.76.1 -> 7.77.0 #124502

wants to merge 2 commits into from

Conversation

mweinelt
Copy link
Member

Motivation for this change

https://curl.se/changes.html\#7_77_0

Fixes: CVE-2021-22897, CVE-2021-22898, CVE-2021-22901

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Added a release notes entry if the change is major or breaking
  • Fits CONTRIBUTING.md.

@mweinelt mweinelt added 1.severity: security Issues which raise a security issue, or PRs that fix one 9.needs: port to stable A PR needs a backport to the stable release. backport release-21.05 labels May 26, 2021
@ofborg ofborg bot added the 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild label May 26, 2021
@ofborg ofborg bot requested a review from lovek323 May 26, 2021 14:38
@mweinelt
Copy link
Member Author

@lukegb
Copy link
Contributor

lukegb commented May 27, 2021

Testing a build of curl, nix, and running a smattering of NixOS tests to boot. Will report back.

@lukegb
Copy link
Contributor

lukegb commented May 27, 2021

curl, nix, and the simple test built. The installer tests also seem fine, so :shipit:

@SuperSandro2000
Copy link
Member

I think this update might break darwin:

checking for gethostbyname in -lsocket... no
checking for gethostbyname in -lwatt... no
checking for gethostbyname with both nsl and socket libs... no
checking for gethostbyname for Minix 3... no
checking for gethostbyname for eCos... no
checking for gethostbyname for AmigaOS bsdsocket.library... no
checking for gethostbyname in -lnetwork... no
checking for gethostbyname in -lnet... no
configure: error: couldn't find libraries for gethostbyname()
builder for '/nix/store/jvamzd2h2k0rpqagplyjs68645v9wj7x-curl-7.77.0.drv' failed with exit code 1

https://logs.nix.ci/?key=nixos/nixpkgs.124502&attempt_id=98158734-bf8f-4dbd-aa2a-abc9a125a501

@ofborg build curl

/cc @NixOS/darwin-maintainers

@risicle
Copy link
Contributor

risicle commented May 29, 2021

Can confirm @SuperSandro2000 's failure, macos 10.15, sandbox enabled.

@risicle
Copy link
Contributor

risicle commented May 29, 2021

The diff between the two curls https://github.com/curl/curl/compare/curl-7_76_1..curl-7_77_0 suggests that --with-openssl is now preferred over --with-ssl. Similarly --without-....

This also migrates sslSupport to opensslSupport, which affects packages
overriding the curl package in that regard.
@github-actions github-actions bot added the 6.topic: steam Steam game store/launcher (store.steampowered.com) label May 29, 2021
@mweinelt
Copy link
Member Author

Migrated to --with-openssl and from sslSupport to opensslSupport treewide. But that probably doesn't fix anything on darwin, no?

@risicle
Copy link
Contributor

risicle commented May 29, 2021

No it doesn't, still 👀 and 🤔

@risicle
Copy link
Contributor

risicle commented May 29, 2021

Yup, digging into the config.log it now wants the SystemConfiguration framework for darwin:

configure:20943: checking for gethostbyname
configure:20943: clang -o conftest -Qunused-arguments -Os -Werror=partial-availability   -framework SystemConfiguration conftest.c  >&5
ld: framework not found SystemConfiguration

the problem with this being that adding it causes a reference loop.

@risicle
Copy link
Contributor

risicle commented May 29, 2021

SystemConfiguration dependency added for NAT64 support in curl/curl#7121

@risicle
Copy link
Contributor

risicle commented May 30, 2021

Created #124982 in case we want to take that route.

@mweinelt
Copy link
Member Author

I feel like we do, thanks for investing the time. Did anyone mention the issue in #macos:nixos.org yet?

@mweinelt mweinelt added the 2.status: blocked by pr/issue Another PR or issue is preventing this from being completed label May 30, 2021
@risicle
Copy link
Contributor

risicle commented May 30, 2021

Yes, the conclusion was that this is indeed the first time a macos framework in included in the curl loop, so there's no prior art.

I think there are two possibilities:

a) hack the curl build system to allow building a SystemConfiguration-less version. Easiest solution short-term.. unpredictable maintenance burden long-term depending on curl upstream changes?
b) create an overridden, bootstrappable SystemConfiguration. Having a little look at this at the moment.

@risicle
Copy link
Contributor

risicle commented May 30, 2021

Option b) is tricky because apple sdk needed for framework's headers > comes in xar format > has xml-based metadata > libxml2 > python > expat ...

@andir
Copy link
Member

andir commented Jun 2, 2021

cc @NixOS/darwin-maintainers

@thefloweringash
Copy link
Member

b) create an overridden, bootstrappable SystemConfiguration. Having a little look at this at the moment.

This is my preferred solution. The more our build environment diverges from the expected build environment, the more likely problems like this will arise.

If we include pbzx in the bootstrap tools, we can start building with anything we require from the sdk immediately.

A start in that direction
diff --git a/pkgs/os-specific/darwin/apple-sdk/default.nix b/pkgs/os-specific/darwin/apple-sdk/default.nix
index 1b60abf562b..3cc9bd8e899 100644
--- a/pkgs/os-specific/darwin/apple-sdk/default.nix
+++ b/pkgs/os-specific/darwin/apple-sdk/default.nix
@@ -16,27 +16,20 @@ let
       sha256 = "13xq34sb7383b37hwy076gnhf96prpk1b4087p87xnwswxbrisih";
     };
 
-    nativeBuildInputs = [ xar cpio python3 pbzx ];
+    nativeBuildInputs = [ cpio pbzx ];
 
     outputs = [ "out" "dev" "man" ];
 
     unpackPhase = ''
-      xar -x -f $src
+      pbzx $src | cpio -idm
     '';
 
     installPhase = ''
-      start="$(pwd)"
-      mkdir -p $out
-      cd $out
-      pbzx -n $start/Payload | cpio -idm
+      mkdir $out
 
-      mv usr/* .
-      rmdir usr
+      cp -r System/* usr/* $out
 
-      mv System/* .
-      rmdir System
-
-      pushd lib
+      pushd $out/lib
       cp ${darwin-stubs}/usr/lib/libcups*.tbd .
       ln -s libcups.2.tbd      libcups.tbd
       ln -s libcupscgi.1.tbd   libcupscgi.tbd
diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix
index 3af444a2e52..cd7c0fb9980 100644
--- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix
@@ -97,16 +97,16 @@ in rec {
       mkdir $out/include
       cp -rd ${llvmPackages.libcxx.dev}/include/c++     $out/include
 
+      # copy package extraction tools
+      cp -d ${pkgs.pbzx}/bin/pbzx $out/bin
+      cp -d ${pkgs.xar}/lib/libxar*.dylib $out/lib
+      cp -d ${pkgs.bzip2.out}/lib/libbz2*.dylib $out/lib
+
       ${lib.optionalString targetPlatform.isAarch64 ''
         # copy .tbd assembly utils
         cp -d ${pkgs.darwin.rewrite-tbd}/bin/rewrite-tbd $out/bin
         cp -d ${pkgs.libyaml}/lib/libyaml*.dylib $out/lib
 
-        # copy package extraction tools
-        cp -d ${pkgs.pbzx}/bin/pbzx $out/bin
-        cp -d ${pkgs.xar}/lib/libxar*.dylib $out/lib
-        cp -d ${pkgs.bzip2.out}/lib/libbz2*.dylib $out/lib
-
         # copy sigtool
         cp -d ${pkgs.darwin.sigtool}/bin/sigtool $out/bin
         cp -d ${pkgs.darwin.sigtool}/bin/codesign $out/bin

@LnL7
Copy link
Member

LnL7 commented Jun 2, 2021

If possible I would rather avoid adding more things to bootstrap tools since anything in there is rather annoying to update.

Since curl itself is part of bootstrap tools already however. If I'm not mistaken we only need curl as native input and don't link against it, if that's the case the bootstrap version can be propagated much further in the stdenv stages possibly eliminating curl as a dependency alltogether.

@vcunat
Copy link
Member

vcunat commented Jul 17, 2021

I don't know... this feels like curl on all platform would get blocked due to this issue. What about... NAT64 not working on darwin in curl? (like so far, presumably) That commit isn't so complex, so e.g. simply revert it for darwin? (maybe just during bootstrapping) I mean, until someone implements some better solution like discussed above, but who knows how long that might take.

@FRidh FRidh added this to the 21.11 milestone Jul 24, 2021
@happysalada happysalada mentioned this pull request Sep 10, 2021
12 tasks
@risicle risicle mentioned this pull request Sep 27, 2021
12 tasks
@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Sep 28, 2021

Something needs to be done about this update.
Some options I see right now (partly copying what vcunat already wrote above):

  • drop the commit that is causing issues on darwin
  • use an older curl version for darwin (bootstraping)

Blocking this important update for more than 3 months just because Darwin stdenv is way behind and not easy to maintain is a pity but it shouldn't hold back Linux and create a lot of extra work for all people maintaining the Linux part of nixpkgs and NixOS.

@r-burns
Copy link
Contributor

r-burns commented Oct 9, 2021

Has anyone mentioned this to upstream? I'm sure a project as low-level as curl would be sympathetic to this breakage and be willing to provide a blessed path for systemconfiguration-less building.

@risicle
Copy link
Contributor

risicle commented Oct 15, 2021

My guess is that most macos developers wouldn't see the benefit of trying to build without SystemConfiguration.

@risicle risicle mentioned this pull request Oct 16, 2021
12 tasks
@SuperSandro2000
Copy link
Member

Has anyone mentioned this to upstream? I'm sure a project as low-level as curl would be sympathetic to this breakage and be willing to provide a blessed path for systemconfiguration-less building.

Most apple users are not using a very old SDK to build curl.

@lheckemann
Copy link
Member

Superseded by #141829. Feel free to reopen if I've misunderstood.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.severity: security Issues which raise a security issue, or PRs that fix one 2.status: blocked by pr/issue Another PR or issue is preventing this from being completed 6.topic: steam Steam game store/launcher (store.steampowered.com) 9.needs: port to stable A PR needs a backport to the stable release. 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild 10.rebuild-linux: 501+ 10.rebuild-linux: 5001+
Projects
None yet
Development

Successfully merging this pull request may close these issues.