Skip to content

various: fix Scudo allocator due to LLVM update#444605

Merged
emilazy merged 2 commits intoNixOS:masterfrom
lxp:fix-scudo
Sep 20, 2025
Merged

various: fix Scudo allocator due to LLVM update#444605
emilazy merged 2 commits intoNixOS:masterfrom
lxp:fix-scudo

Conversation

@lxp
Copy link
Contributor

@lxp lxp commented Sep 20, 2025

The commit 01e8f57 unpinned the LLVM version of the Scudo allocator. When running with the hardened profile this led to building errors due to the changed path of the Scudo library and runtime errors due to changed spelling of the options.

This MR adjusts the library path (thanks to @CUB3D) and updates the spelling of all existing Scudo options according to the Scudo documentation [1]. For more details see the commit messages.
I built and tested these changes on my system with imports = [(modulesPath + "/profiles/hardened.nix")];.

Closes #437368

[1] https://llvm.org/docs/ScudoHardenedAllocator.html

@emilazy I hope it is fine to ping you for this MR.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

lxp and others added 2 commits September 20, 2025 12:56
The commit 01e8f57 unpinned the
LLVM version, which led to building errors similar to this when
Scudo is used:

building the system configuration...
error: builder for '/nix/store/1f9z73haq6avvv19glifalfnmpw3gsbx-malloc-provider-scudo.drv' failed with exit code 1;
       last 1 log lines:
       > cp: cannot stat '/nix/store/s43991isxhvknqmk53q7pqmkdrfvj1p4-compiler-rt-libc-19.1.7/lib/linux/libclang_rt.scudo-x86_64.so': No such file or directory
       For full logs, run:
         nix log /nix/store/1f9z73haq6avvv19glifalfnmpw3gsbx-malloc-provider-scudo.drv

It seems in the new LLVM version the Scudo library was moved:

$ ls /nix/store/*-compiler-rt-libc-20.1.8/lib/linux/libclang_rt.scudo*
/nix/store/z98mwyi0w8f4kgk3rw6av946azh28hc9-compiler-rt-libc-20.1.8/lib/linux/libclang_rt.scudo_standalone_cxx-x86_64.a
/nix/store/z98mwyi0w8f4kgk3rw6av946azh28hc9-compiler-rt-libc-20.1.8/lib/linux/libclang_rt.scudo_standalone-x86_64.a
/nix/store/z98mwyi0w8f4kgk3rw6av946azh28hc9-compiler-rt-libc-20.1.8/lib/linux/libclang_rt.scudo_standalone-x86_64.so

This commit adjusts the library path.

Co-authored-by: CUB3D <callumthom11@gmail.com>
The commit 01e8f57 unpinned the
LLVM version, which led to the following warnings whenever Scudo
is loaded (basically whenever a command is started when used
system-wide):

Scudo WARNING: found 3 unrecognized flag(s):
    DeleteSizeMismatch=0:DeallocationTypeMismatch=0
    DeallocationTypeMismatch=0
    ZeroContents=1

According to the current Scudo documentation [1] the options are
now spelled differently. This commit keeps all existing options
and only updates the spelling.

[1] https://llvm.org/docs/ScudoHardenedAllocator.html

Reported-by: CUB3D <callumthom11@gmail.com>
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.first-time contribution This PR is the author's first one; please be gentle! 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related labels Sep 20, 2025
Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Sorry for not checking more thoroughly on the unpin. It was pinned to a specific version to stop it using the _latest alias so I figured the default LLVM version would be fine, but didn't check for upstream churn.

@emilazy emilazy added this pull request to the merge queue Sep 20, 2025
Merged via the queue into NixOS:master with commit 597c7a9 Sep 20, 2025
37 of 40 checks passed
@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Sep 20, 2025
@K900
Copy link
Contributor

K900 commented Sep 20, 2025

This turned out to be a mass rebuild and should land in staging instead.

@emilazy
Copy link
Member

emilazy commented Sep 20, 2025

Sorry about that, will re‐apply on staging.

@emilazy
Copy link
Member

emilazy commented Sep 20, 2025

Reapplied in #444670 to batch up the mass rebuild from the LLVM change. It should reach master in a couple of weeks. The NixOS parts could be cherry‐picked to master to get the fix out sooner; I’ll happily merge a PR to do that, or if you want me to handle it let me know and I’ll try to get to it.

@lxp
Copy link
Contributor Author

lxp commented Sep 20, 2025

Reapplied in #444670 to batch up the mass rebuild from the LLVM change. It should reach master in a couple of weeks. The NixOS parts could be cherry‐picked to master to get the fix out sooner; I’ll happily merge a PR to do that, or if you want me to handle it let me know and I’ll try to get to it.

Thank you! I am not sure that the NixOS parts make a lot of sense on its own since it would still lead to runtime warnings all over the place. Best would be to merge everything together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nixos/environment.memoryAllocator.provider: Building with scudo is broken

3 participants