Skip to content

Instantly share code, notes, and snippets.

@LunNova
Created September 22, 2025 20:44
Show Gist options
  • Save LunNova/219767a842bdbda4e43d3766db199d4d to your computer and use it in GitHub Desktop.
Save LunNova/219767a842bdbda4e43d3766db199d4d to your computer and use it in GitHub Desktop.
Commit ID: 91450254dba4c03cc51dbcb18cd9be9395fc7a90
Change ID: xvomkvwpnurxzlnsozlxvtzvrmxxqnms
Author : Luna Nova <[email protected]> (59m)
Committer: Luna Nova <[email protected]> (<=1m)
chromium: pin LLVM to 20 to work around compile error
chromium's histogram_macros_internal contains a UB static cast
return static_cast<Enum>(base::to_underlying(Enum::kMaxValue) + 1);
resulting in
integer value 4 is outside the valid range of values [0, 3] for the enumeration type 'LandlockState'
resulting in
error: static assertion expression is not an integral constant expression
UMA_HISTOGRAM_ENUMERATION("Security.Sandbox.LandlockState", landlock_state);
pinning an older LLVM is the easiest solution, there's not a one-liner
patch to apply as chromium relies on these invalid enum values to
represent histogram data
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index f4de63a0bb..9893e13719 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -183,7 +183,7 @@
# https://github.com/NixOS/nixpkgs/issues/142901
buildPlatformLlvmStdenv =
let
- llvmPackages = pkgsBuildBuild.rustc.llvmPackages;
+ llvmPackages = pkgsBuildBuild.llvmPackages_20;
in
overrideCC llvmPackages.stdenv (
llvmPackages.stdenv.cc.override {
@@ -298,7 +298,7 @@
python3WithPackages
perl
which
- buildPackages.rustc.llvmPackages.bintools
+ buildPackages.llvmPackages.bintools
bison
gperf
]
@@ -687,8 +687,8 @@
llvmCcAndBintools = symlinkJoin {
name = "llvmCcAndBintools";
paths = [
- buildPackages.rustc.llvmPackages.llvm
- buildPackages.rustc.llvmPackages.stdenv.cc
+ buildPackages.llvmPackages_20.llvm
+ buildPackages.llvmPackages_20.stdenv.cc
];
};
electron-unwrapped is unhappy with https://github.com/chromium/chromium/blob/9884b603fb8ab257afb3d2a9a43ee2b79834d7db/base/metrics/histogram_macros_internal.h#L36
Seems likely that LLVM bump broke it
electron-unwrapped> ../../sandbox/policy/linux/sandbox_linux.cc:694:3: error: static assertion expression is not an integral constant expression
electron-unwrapped> 694 | UMA_HISTOGRAM_ENUMERATION("Security.Sandbox.LandlockState", landlock_state);
electron-unwrapped> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> ../../base/metrics/histogram_macros.h:82:7: note: expanded from macro 'UMA_HISTOGRAM_ENUMERATION'
electron-unwrapped> 80 | INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 81 | __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 82 | INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \
electron-unwrapped> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 83 | (name, __VA_ARGS__, base::HistogramBase::kUmaTargetedHistogramFlag)
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> ../../base/metrics/histogram_macros_internal.h:171:73: note: expanded from macro 'INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO'
electron-unwrapped> 171 | #define INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO(_1, _2, NAME, ...) NAME
electron-unwrapped> | ^
electron-unwrapped> ../../base/metrics/histogram_macros_internal.h:175:3: note: expanded from macro 'INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY'
electron-unwrapped> 175 | INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG( \
electron-unwrapped> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 176 | name, sample, \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 177 | base::internal::EnumSizeTraits<std::decay_t<decltype(sample)>>::Count(), \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 178 | flags)
electron-unwrapped> | ~~~~~~
electron-unwrapped> ../../base/metrics/histogram_macros_internal.h:207:9: note: expanded from macro 'INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG'
electron-unwrapped> 207 | static_cast<uintmax_t>(boundary) < \
electron-unwrapped> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 208 | static_cast<uintmax_t>( \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 209 | std::numeric_limits<base::HistogramBase::Sample32>::max()), \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> ../../base/metrics/histogram_macros_internal.h:35:14: note: integer value 4 is outside the valid range of values [0, 3] for the enumeration type 'LandlockState'
electron-unwrapped> 35 | return static_cast<Enum>(base::to_underlying(Enum::kMaxValue) + 1);
electron-unwrapped> | ^
electron-unwrapped> ../../sandbox/policy/linux/sandbox_linux.cc:694:3: note: in call to 'Count()'
electron-unwrapped> 694 | UMA_HISTOGRAM_ENUMERATION("Security.Sandbox.LandlockState", landlock_state);
electron-unwrapped> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> ../../base/metrics/histogram_macros.h:82:7: note: expanded from macro 'UMA_HISTOGRAM_ENUMERATION'
electron-unwrapped> 80 | INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 81 | __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 82 | INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \
electron-unwrapped> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 83 | (name, __VA_ARGS__, base::HistogramBase::kUmaTargetedHistogramFlag)
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> ../../base/metrics/histogram_macros_internal.h:171:73: note: expanded from macro 'INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO'
electron-unwrapped> 171 | #define INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO(_1, _2, NAME, ...) NAME
electron-unwrapped> | ^
electron-unwrapped> ../../base/metrics/histogram_macros_internal.h:177:7: note: expanded from macro 'INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY'
electron-unwrapped> 175 | INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG( \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 176 | name, sample, \
electron-unwrapped> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 177 | base::internal::EnumSizeTraits<std::decay_t<decltype(sample)>>::Count(), \
electron-unwrapped> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
electron-unwrapped> 178 | flags)
electron-unwrapped> | ~~~~~~
electron-unwrapped> ../../base/metrics/histogram_macros_internal.h:207:32: note: expanded from macro 'INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG'
electron-unwrapped> 207 | static_cast<uintmax_t>(boundary) < \
electron-unwrapped> | ^~~~~~~~
electron-unwrapped> 1 error generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment