nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

[staging-next] chromium: fails to launch due to out of range read (SIGILL)

Open whispersofthedawn opened this issue 8 months ago • 5 comments

Nixpkgs version

  • Unstable (26.05)

Describe the bug

When running the latest chromium (v146.0.7680.80) on staging-next, it is immediately terminated with a SIGILL due to an illegal instruction. When running chromium, I see the error:

~> /nix/store/2l63ab2zw6b0sypah47wm4zhyjyg78pf-chromium-146.0.7680.80/bin/chromium
[0315/002917.167711:ERROR:third_party/crashpad/crashpad/util/process/process_memory_range.cc:75] read out of range
fish: Job 1, '/nix/store/2l63ab2zw6b0sypah47w…' terminated by signal SIGILL (Illegal instruction)

No other context is obviously provided, though there is a coredump (see info from coredumpctl below). If there's any other information I can provide, please let me know.

The same error happens with ungoogled-chromium, though I can't test the latest version (only 146.0.7680.75-1) because that's the latest one built by Hydra and I don't have the compute to build Chromium.

Steps to reproduce

On a regular NixOS system:

  1. Build chromium on staging-next (I am using commit 521d05a303dcd44e66f27ad94cc244adaabace12) with nix-build -A chromium.
  2. Run chromium on the command line with ./result/bin/chromium.
  3. Observe that it terminates with SIGILL.

Alternatively, this is visible in a NixOS test:

  1. On staging-next (521d05a303dcd44e66f27ad94cc244adaabace12), run nix-build -A nixosTests.chromium to run the chromium NixOS VM test.
  2. See that chromium fails to start in the test logs, with a similar error in the crashpad as seen above.
  3. The VM test does not finish, and seems to just hang.

Expected behaviour

Chromium should successfully start, and the NixOS test should succeed.

Screenshots

No response

Relevant log output

The most relevant log output I was able to find was from coredumpctl. This is the result of coredumpctl info on the entry corresponding to running chromium in the terminal on our system:

~> coredumpctl info 345908
           PID: 345908 (chromium)
           UID: 1000 (whispers)
           GID: 100 (users)
        Signal: 4 (ILL)
     Timestamp: Sat 2026-03-14 23:50:59 EDT (19s ago)
  Command Line: $'/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.7680.80/libexec/chromium/chromium --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland>
    Executable: /nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.7680.80/libexec/chromium/chromium
 Control Group: /user.slice/user-1000.slice/[email protected]/app.slice/app-ghostty-surface-transient-336418.scope
          Unit: [email protected]
     User Unit: app-ghostty-surface-transient-336418.scope
         Slice: user-1000.slice
     Owner UID: 1000 (whispers)
       Boot ID: e3f50120806d4f45b6414187d4563198
    Machine ID: 69dad7a99e644b32a125cd37f88c5e3f
      Hostname: moonrise
       Storage: /var/lib/systemd/coredump/core.chromium.1000.e3f50120806d4f45b6414187d4563198.345908.1773546659000000.zst (present)
  Size on Disk: 2.4M
       Message: Process 345908 (chromium) of user 1000 dumped core.

                Module libmp3lame.so.0 without build-id.
                Module libmpg123.so.0 without build-id.
                Module libopus.so.0 without build-id.
                Module libvorbisenc.so.2 without build-id.
                Module libvorbis.so.0 without build-id.
                Module libbrotlicommon.so.1 without build-id.
                Module libsndfile.so.1 without build-id.
                Module libgraphite2.so.3 without build-id.
                Module libdatrie.so.1 without build-id.
                Module libbrotlidec.so.1 without build-id.
                Module libbz2.so.1 without build-id.
                Module libgmp.so.10 without build-id.
                Module libnettle.so.8 without build-id.
                Module libhogweed.so.6 without build-id.
                Module libtasn1.so.6 without build-id.
                Module libunistring.so.5 without build-id.
                Module libidn2.so.0 without build-id.
                Module libp11-kit.so.0 without build-id.
                Module libssp.so.0 without build-id.
                Module libogg.so.0 without build-id.
                Module libpulsecommon-17.0.so without build-id.
                Module libharfbuzz.so.0 without build-id.
                Module libthai.so.0 without build-id.
                Module libfribidi.so.0 without build-id.
                Module libxcb-shm.so.0 without build-id.
                Module libxcb-render.so.0 without build-id.
                Module libfreetype.so.6 without build-id.
                Module libfontconfig.so.1 without build-id.
                Module libpng16.so.16 without build-id.
                Module libdrm.so.2 without build-id.
                Module libXrender.so.1 without build-id.
                Module libXi.so.6 without build-id.
                Module libXdmcp.so.6 without build-id.
                Module libXau.so.6 without build-id.
                Module libz.so.1 without build-id.
                Module libgnutls.so.30 without build-id.
                Module libavahi-client.so.3 without build-id.
                Module libavahi-common.so.3 without build-id.
                Module libselinux.so.1 without build-id.
                Module libplc4.so without build-id.
                Module libplds4.so without build-id.
                Module libpcre2-8.so.0 without build-id.
                Module libgcc_s.so.1 without build-id.
                Module libxslt.so.1 without build-id.
                Module libFLAC.so.14 without build-id.
                Module libpulse.so.0 without build-id.
                Module libasound.so.2 without build-id.
                Module libpango-1.0.so.0 without build-id.
                Module libffi.so.8 without build-id.
                Module libgbm.so.1 without build-id.
                Module libXrandr.so.2 without build-id.
                Module libXfixes.so.3 without build-id.
                Module libXext.so.6 without build-id.
                Module libXdamage.so.1 without build-id.
                Module libXcomposite.so.1 without build-id.
                Module libX11.so.6 without build-id.
                Module libxkbcommon.so.0 without build-id.
                Module libxcb.so.1 without build-id.
                Module libxml2.so.16 without build-id.
                Module libjpeg.so.62 without build-id.
                Module libexpat.so.1 without build-id.
                Module libcups.so.2 without build-id.
                Module libsmime3.so without build-id.
                Module libnssutil3.so without build-id.
                Module libnss3.so without build-id.
                Module libnspr4.so without build-id.
                Stack trace of thread 345908:
                #0  0x000056201b2c2e40 _ZN4base28PersistentHistogramAllocator17AllocateHistogramENS_13HistogramTypeENSt4__Cr17basic_string_viewIcNS2_11char_traitsIcEEEEmiiPKNS_12BucketRangesEiPj (/nix/store/>
                #1  0x000056201b2b9914 _ZN4base9Histogram7Factory5BuildEv (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.7680.80/libexec/chromium/chromium + 0x9e8a914)
                #2  0x000056201b2b9cf1 _ZN4base9Histogram18FactoryGetInternalENSt4__Cr17basic_string_viewIcNS1_11char_traitsIcEEEEiimi (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.76>
                #3  0x000056201b2c34b3 _ZN4base24GlobalHistogramAllocator3SetEPS0_ (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.7680.80/libexec/chromium/chromium + 0x9e944b3)
                #4  0x000056201b2c38b1 _ZN4base24GlobalHistogramAllocator14CreateWithFileERKNS_8FilePathEmmNSt4__Cr17basic_string_viewIcNS4_11char_traitsIcEEEEb (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-c>
                #5  0x000056201d0c5b17 _Z31InstantiatePersistentHistogramsRKN4base8FilePathEbNSt4__Cr17basic_string_viewIcNS3_11char_traitsIcEEEE (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapp>
                #6  0x00005620146a1a8f _ZN18ChromeMainDelegate18SandboxInitializedERKNSt4__Cr12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-un>
                #7  0x0000562019c3bf6c _ZN7content21ContentMainRunnerImpl10InitializeENS_17ContentMainParamsE (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.7680.80/libexec/chromium/ch>
                #8  0x0000562019c395e9 _ZN7content11ContentMainENS_17ContentMainParamsE (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.7680.80/libexec/chromium/chromium + 0x880a5e9)
                #9  0x000056201469e33a ChromeMain (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.7680.80/libexec/chromium/chromium + 0x326f33a)
                #10 0x00007f0e8a22b285 __libc_start_call_main (libc.so.6 + 0x2b285)
                #11 0x00007f0e8a22b338 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x2b338)
                #12 0x00005620140a4025 _start (/nix/store/83qxj6klnqghsbi6y4vbscl6m2qmiqyk-chromium-unwrapped-146.0.7680.80/libexec/chromium/chromium + 0x2c75025)
                ELF object binary architecture: AMD x86-64

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.19.8, NixOS, 26.05 (Yarara), 26.05pre-git
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Lix, like Nix) 2.96.0-devpre-c452341b System type: x86_64-linux Additional system types: aarch64-linux, i686-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/whispers/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/whispers/.local/share/flatpak/exports/etc/xdg/nix/nix.conf:/var/lib/flatpak/exports/etc/xdg/nix/nix.conf:/home/whispers/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/whispers/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/whispers/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/1bnf1xdgqh9mhc4xrsi4vwhx19vc1nk3-lix-2.96.0-devpre-c452341b/share
  • nixpkgs: /nix/store/2dq7fygjqxv4k5173kr1b6vimi38jjsb-source

Notify maintainers

@networkException @emilylange


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a :+1: reaction to issues you find important.

whispersofthedawn avatar Mar 15 '26 04:03 whispersofthedawn

(Discussed on Matrix #staging:nixos.org)

This is a false(-ish) positive out of bounds due to Chromium being ~~(willfully?)~~ (edit: blame shows that this is likely not an intentional change) not even -fstrict-flex-array=1 clean. Breakage introduced in #473648 when that's enabled by default.

https://source.chromium.org/chromium/chromium/src/+/main:base/metrics/persistent_histogram_allocator.cc;l=269-272;drc=854512ccb0f2d89203be1ec15dbea3fb4e31a326

  // Space for the histogram name will be added during the actual allocation
  // request. This must be the last field of the structure. A zero-size array
  // or a "flexible" array would be preferred but is not (yet) valid C++.
  char name[sizeof(uint64_t)];  // Force 64-bit alignment on 32-bit builds.

Which blames to https://codereview.chromium.org/2490303002/patch/260001/270006

Further access trips the bounds check due to the compiler thinking the size is 8 instead of the actual allocated size https://source.chromium.org/chromium/chromium/src/+/main:base/metrics/persistent_histogram_allocator.cc;l=365-366;drc=854512ccb0f2d89203be1ec15dbea3fb4e31a326

  PersistentHistogramData* histogram_data =
      memory_allocator_->New<PersistentHistogramData>(
          offsetof(PersistentHistogramData, name) + name.size() + 1);
  if (histogram_data) {
    UNSAFE_TODO(memcpy(histogram_data->name, name.data(), name.size()));
    UNSAFE_TODO(histogram_data->name[name.size()]) = '\0';

Given that the symptoms of this kind of problem is random crashes, disabling this hardening for chromium seems to be the right choice.

dramforever avatar Mar 15 '26 06:03 dramforever

Closed by #500004.

Thanks for testing this on staging-next and reporting it (both on Matrix and here)!

emilylange avatar Mar 15 '26 22:03 emilylange

@emilylange has this been raised upstream? I would appreciate if this could be eventually fixed on chromium's side. It looks like this one was an unintentional violation, and the codebase looks like it at least intends to be -fstrict-flex-array=1 clean, so I think there's a good chance that upstream is willing to fix this and possibly even eventually enforce it.

dramforever avatar Mar 24 '26 03:03 dramforever

@emilylange has this been raised upstream? I would appreciate if this could be eventually fixed on chromium's side. It looks like this one was an unintentional violation, and the codebase looks like it at least intends to be -fstrict-flex-array=1 clean, so I think there's a good chance that upstream is willing to fix this and possibly even eventually enforce it.

Both me and @networkException had no time for this yet, so no, not yet, unfortunately.

emilylange avatar Mar 24 '26 12:03 emilylange

Understandable! I just wanted to make a note.

dramforever avatar Mar 24 '26 12:03 dramforever