Repository navigation
dotnet: use brotli from nixpkgs instead of vendored copy - #579247
Conversation
Build dotnet/runtime with CLR_CMAKE_USE_SYSTEM_BROTLI: through --with-system-libs from .NET 10, and through the build files of the runtime for .NET 8 and 9. The runtime packs then have no static brotli libraries, thus the NativeAOT link gets the library directory of brotli. Assisted-by: Claude Code (Claude Opus 5.5) with patchix
|
This seems like a good idea, but I'm currently testing #579239, which could go straight into master, and has the upstream fix for the vendored brotli. |
|
That's all correct, but the version bump does fix the vulnerability. I guess the questions is whether I should cancel my nixpkgs-review, and restart them with this cherry-picked? Has this change been tested on darwin at all? |
|
No, I only built and tested it on Linux for the presence of a vendored brotli decoder: https://gist.github.com/irgolic/1a4d2c41462be01a97a9765316bafb34. I did not run nixpkgs-review. I can rebase on top of yours once it's ready, if you prefer? |
That would be okay, but there probably won't be conflicts anyway. I should be able to run some darwin tests after the update PR is tested. |
|
Thanks! |
|
Since there are a lot of fragile hacks here to force it to use the system brotli, should we perhaps delete the vendored one in patchPhase? |
The build now stops with an error when a version does not use CLR_CMAKE_USE_SYSTEM_BROTLI, and it cannot compile the bundled copy. Assisted-by: Claude Code (Claude Opus 5.5) with patchix
Agreed, just pushed a 2nd commit to do so. |
We might want to just get it over with and do 'all'. |
ca20ab4 to
4fe861e
Compare
Agree, done – fixed up into the first commit. Makes you think, what would a large-scale "remove all bundled dependencies" operation look like in nixpkgs? Debian has a good policy regarding this, so their eMudhra response was easy and fast. |
If we're going to keep the 'all', I think we need all the other dependencies. It's currently failing to build because it's missing I'm not against saving that for another PR if it's going to turn into a big project. Also maybe we want to consider doing some of this for 10+ only, since that's where they added |
4fe861e to
ca20ab4
Compare
|
I force pushed it back to what it was before the "all" change. It seems like replacing all vendoring is more complicated, I agree it should be saved for another PR. I think it's a great goal to strive for, and might do well with some wider nixpkgs discourse too. Glad 10+ added |
| src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets \ | ||
| --replace-fail \ | ||
| '<LinkerArg Include="-Wl,--as-needed"' \ | ||
| '<LinkerArg Include="-L${lib.getLib brotli}/lib;-Wl,-rpath,${lib.getLib brotli}/lib" /> |
There was a problem hiding this comment.
Is this the right thing to do on darwin? This is the thing I'm most suspicious about for that platform. I'm running nixpkgs-review on it now.
There was a problem hiding this comment.
I'm not able to build brotli 1.2.1 for node in nixpkgs on nix-darwin using the upstream patch. Fails in test-worker-memory.js:
error: Cannot build '/nix/store/z26yq9s0k6nkn0j6mmdaf41v8qwr1ij0-nodejs-slim-24.21.0.drv'.
Reason: builder failed with exit code 2.
Output paths:
/nix/store/4jmwki9qn56n8rv0c2syym04h5gsay14-nodejs-slim-24.21.0
/nix/store/9zsg1lh9bjkkgs9rga8iwrhwgqbqjx37-nodejs-slim-24.21.0-libv8
/nix/store/aasizb5yhzp2ns4xj91dj8q5lm5aaxgn-nodejs-slim-24.21.0-dev
/nix/store/kas4kw9jr9sh5si550fcgbfblbmib5l9-nodejs-slim-24.21.0-npm
/nix/store/ldpvmmdd8d61gar2np78xm3midgd7mk5-nodejs-slim-24.21.0-corepack
Last 25 log lines:
> ...
> ok 5367 known_issues/test-stdin-is-always-net.socket
> ---
> duration_ms: 428.89200
> ...
> ok 5368 known_issues/test-stream-writable-sync-error
> ---
> duration_ms: 116.17300
> ...
> ok 5369 known_issues/test-url-parse-conformance
> ---
> duration_ms: 235.03500
> ...
> ok 5370 known_issues/test-vm-function-declaration-uses-define
> ---
> duration_ms: 152.91100
> ...
> ok 5371 known_issues/test-vm-timeout-escape-nexttick
> ---
> duration_ms: 856.18900
> ...
>
> Failed tests:
> out/Release/node /nix/var/nix/builds/nix-81402-461299554/node-v24.21.0/test/parallel/test-worker-memory.js
> make: *** [Makefile:596: test-ci-js] Error 1
For full logs, run:
nix log /nix/store/z26yq9s0k6nkn0j6mmdaf41v8qwr1ij0-nodejs-slim-24.21.0.drv
error: Cannot build '/nix/store/z26yq9s0k6nkn0j6mmdaf41v8qwr1ij0-nodejs-slim-24.21.0.drv'.
Reason: builder failed with exit code 2.
Output paths:
/nix/store/4jmwki9qn56n8rv0c2syym04h5gsay14-nodejs-slim-24.21.0
/nix/store/9zsg1lh9bjkkgs9rga8iwrhwgqbqjx37-nodejs-slim-24.21.0-libv8
/nix/store/aasizb5yhzp2ns4xj91dj8q5lm5aaxgn-nodejs-slim-24.21.0-dev
/nix/store/kas4kw9jr9sh5si550fcgbfblbmib5l9-nodejs-slim-24.21.0-npm
/nix/store/ldpvmmdd8d61gar2np78xm3midgd7mk5-nodejs-slim-24.21.0-corepack
Last 25 log lines:
> ...
> ok 5367 known_issues/test-stdin-is-always-net.socket
> ---
> duration_ms: 428.89200
> ...
> ok 5368 known_issues/test-stream-writable-sync-error
> ---
> duration_ms: 116.17300
> ...
> ok 5369 known_issues/test-url-parse-conformance
> ---
> duration_ms: 235.03500
> ...
> ok 5370 known_issues/test-vm-function-declaration-uses-define
> ---
> duration_ms: 152.91100
> ...
> ok 5371 known_issues/test-vm-timeout-escape-nexttick
> ---
> duration_ms: 856.18900
> ...
>
> Failed tests:
> out/Release/node /nix/var/nix/builds/nix-81402-461299554/node-v24.21.0/test/parallel/test-worker-memory.js
> make: *** [Makefile:596: test-ci-js] Error 1
For full logs, run:
nix log /nix/store/z26yq9s0k6nkn0j6mmdaf41v8qwr1ij0-nodejs-slim-24.21.0.drv
error: Cannot build '/nix/store/s7fjmivav2a4ggwsxgw775xli38sz9ch-fixup-yarn-lock-26.11.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/d6jdbjk3gdkkvc7b63fgn676ffsmnn9p-fixup-yarn-lock-26.11
error: Cannot build '/nix/store/55rwlvgm04n709hy41a61k0dfrwrhk7a-nodejs-24.21.0-source.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/ipx2lhih3xvanlim0vf7r1lz378m6wyy-nodejs-24.21.0-source
error: Cannot build '/nix/store/0qi8qd97fhkgmrb2kczs6ak8n6h7wld5-nodejs-24.21.0.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/d2rcvk87jga0d1bks7ic9mc0kw1b9rn8-nodejs-24.21.0
error: Cannot build '/nix/store/q6vfl6kycjv85w7r9lacxvn4djmh9fxb-devcontainer-0.89.0.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/5f6yxkamw2idamqi15wx8pad1sj2wpjg-devcontainer-0.89.0
error: Cannot build '/nix/store/ra85z4a4am6zyajnlxvcgjndwda4nr5j-system-applications.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/i7x6ibav2lb70w6gy93596mic2pwwkqz-system-applications
error: Cannot build '/nix/store/17h7npzkvjfh1r7rszq3qk6fs3hf250h-system-path.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/jfwyjyyknx5nfvz5dq5njinklzmq302v-system-path
❌ git+file:///private/etc/nix-darwin/.claude/worktrees/agent-abc9f163dc1ae392b#darwinConfigurations.XXX.system
error: Cannot build '/nix/store/x1zrdxgp1c5na88kgh2z1ijnzv3k3kpv-darwin-system-26.11.bb0b90d.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/33j2fghnvm381qzzzy2vxsqvdb8rw7f2-darwin-system-26.11.bb0b90d
There was a problem hiding this comment.
I'm not able to build brotli 1.2.1 for node in nixpkgs on nix-darwin using the upstream patch. Fails in test-worker-memory.js:
@buffyg Do you mean with this PR?
nixpkgs-review passed for me, and I was able to build dotnet-sdk_{8..11}.tests.
Could you give instructions to reproduce?
|
|
I'm not all that comfortable with darwin linking stuff, but this is an AOT executable, and it looks correct. |
Part of #578375.
The .NET source build bundles a copy of the
brotlidecoder insrc/runtime/src/native/external/brotli. After this change, an update ofbrotliin nixpkgs also updates the decoder of .NET. Thus the fix ofCVE-2026-111497comes withbrotli1.2.1 (#577208), which is instaging.This change fixes:
Note, there are 7 more .NET packages that will likely need a separate fix:
Note
AI Disclosure: Claude Code made the code change, the commit message and the first version of this pull request description, with patchix. Claude Code used Claude Opus 5.5. This pull request description is written in ASD-STE100 (Simplified Technical English), examined with memelint in
strictmode. As the automation/AI policy requires, I established confidence in this output: by manual review of the code change and of this description, and with the verification tooling that this description discloses.Test
See https://gist.github.com/irgolic/1a4d2c41462be01a97a9765316bafb34 for the test outputs; they were too long to fit in the PR description.
Before the change, the scanner finds the bundled decoder in
libSystem.IO.Compression.Native.soandsinglefilehost. After the change, these files importlibbrotlidec.soof nixpkgs.After the change, the scanner shows two files as copies with an unknown version.
System.IO.Compression.Brotli.dllis a .NET assembly with no native code: it has only the names of the native functions.libSystem.IO.Compression.Native.aof NativeAOT has onlypal_zlib.c.oandentrypoints.c.o.nmshows references to thebrotlifunctions, but no definition.Things done
./result/bin/.nixpkgs-reviewon this PR. See nixpkgs-review usage.passthru.tests.