Skip to content

Undefined Behavior testing zstd in Gentoo #4776

Open

Description

@ChaseKnowlden

Describe the bug
A clear and concise description of what the bug is.

I was enabling UBSan in Gentoo, and it of course failed with UBSan errors.

To Reproduce
Steps to reproduce the behavior:

  1. Turn on UBSan flags
  2. emerge -av1 app-arch/zstd
  3. Tests failed

Expected behavior
A clear and concise description of what you expected to happen.

Tests pass

Screenshots and charts
If applicable, add screenshots and charts to help explain your problem.

meson test --print-errorlogs --num-processes 16 --timeout-multiplier=2
ninja: Entering directory `/var/tmp/portage/app-arch/zstd-1.5.7-r1/work/zstd-1.5.7/build/meson-abi_x86_64.amd64'
ninja: no work to do.
 1/10 zstd:test-invalidDictionaries OK                0.02s
 2/10 zstd:test-poolTests           OK                0.43s
 3/10 zstd:test-longmatch           OK                1.83s
 4/10 zstd:test-fullbench-2         FAIL             27.53s   exit status 1
>>> MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=224 MESON_TEST_ITERATION=1 /var/tmp/portage/app-arch/zstd-1.5.7-r1/work/zstd-1.5.7/build/meson-abi_x86_64.amd64/tests/fullbench -i1 -P0
――――――――――――――――――――――――――――――――――――― ✀  ―――――――――――――――――――――――――――――――――――――
stderr:
*** Zstandard speed analyzer 1.5.7 64-bits, by Yann Collet (Sep 10 2026) ***
 Sample 10000000 bytes :
 0#compress                       :  2741.4 MB/s  (10000241)
 1#decompress                     :  5532.4 MB/s  (10000000)
 2#compress_freshCCtx             :  2398.5 MB/s  (10000241)
 3#decompressDCtx                 :  3717.3 MB/s  (10000000)
 4#compressContinue               :  2201.5 MB/s  (10000241)
 5#compressContinue_extDict       :  1992.8 MB/s  (10000223)
 6#decompressContinue             :  3029.8 MB/s  (10000000)
 7#compressStream                 :  2109.1 MB/s  (10000237)
 8#compressStream_freshCCtx       :  1778.6 MB/s  (10000237)
 9#decompressStream               :  3988.0 MB/s  (10000000)
10#compress2                      :  2042.0 MB/s  (10000241)
11#compressStream2, end           :  1892.9 MB/s  (10000241)
12#compressStream2, end & short   :  1772.1 MB/s  (10000241)
13#compressStream2, continue      :  2227.2 MB/s  (10000237)
14#compressStream2, -T2, continue :  1653.3 MB/s  (10000237)
15#compressStream2, -T2, end      :  1417.4 MB/s  (10000241)
16#compressSequences              :  2650.6 MB/s  (10000241)
ERROR: Scenario 17: This mode cannot generate an uncompressed block
../../programs/benchfn.c:116:13: runtime error: null pointer passed as argument 1, which is declared to never be null
    #0 0x6350b8cd51be in BMK_benchFunction ../../programs/benchfn.c:116
    #1 0x6350b8cfc9b7 in BMK_benchTimedFn ../../programs/benchfn.c:220
    #2 0x6350b8cf3157 in benchMem ../../tests/fullbench.c:888
    #3 0x6350b8cef061 in benchSample ../../tests/fullbench.c:957
    #4 0x6350b8cef061 in main ../../tests/fullbench.c:1202
    #5 0x714bafe8d3bd in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:59
    #6 0x714bafe8d4da in __libc_start_main_impl ../csu/libc-start.c:360
    #7 0x6350b8cef964 in _start (/var/tmp/portage/app-arch/zstd-1.5.7-r1/work/zstd-1.5.7/build/meson-abi_x86_64.amd64/tests/fullbench+0x22964) (BuildId: 086f15e8ca2807af53ef92323b30bad2c495e8f7)

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

 5/10 zstd:test-fullbench-1         FAIL             27.97s   exit status 1
>>> MALLOC_PERTURB_=153 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MESON_TEST_ITERATION=1 /var/tmp/portage/app-arch/zstd-1.5.7-r1/work/zstd-1.5.7/build/meson-abi_x86_64.amd64/tests/fullbench -i1
――――――――――――――――――――――――――――――――――――― ✀  ―――――――――――――――――――――――――――――――――――――
stderr:
*** Zstandard speed analyzer 1.5.7 64-bits, by Yann Collet (Sep 10 2026) ***
 Sample 10000000 bytes :
 0#compress                       :   137.2 MB/s  ( 3239077)
 1#decompress                     :   757.8 MB/s  (10000000)
 2#compress_freshCCtx             :   148.4 MB/s  ( 3239077)
 3#decompressDCtx                 :   844.6 MB/s  (10000000)
 4#compressContinue               :   139.3 MB/s  ( 3239077)
 5#compressContinue_extDict       :   134.4 MB/s  ( 3239062)
 6#decompressContinue             :   597.1 MB/s  (10000000)
 7#compressStream                 :   120.5 MB/s  ( 3239075)
 8#compressStream_freshCCtx       :   133.2 MB/s  ( 3239075)
 9#decompressStream               :   704.9 MB/s  (10000000)
10#compress2                      :   137.4 MB/s  ( 3239077)
11#compressStream2, end           :   137.3 MB/s  ( 3239077)
12#compressStream2, end & short   :   121.9 MB/s  ( 3239077)
13#compressStream2, continue      :   146.8 MB/s  ( 3239075)
14#compressStream2, -T2, continue :   243.5 MB/s  ( 3240235)
15#compressStream2, -T2, end      :   205.9 MB/s  ( 3240239)
16#compressSequences              :   211.4 MB/s  ( 3239695)
17#compressSequencesAndLiterals   :   208.1 MB/s  ( 3239695)
../../programs/benchfn.c:116:13: runtime error: null pointer passed as argument 1, which is declared to never be null
    #0 0x60e0e86161be in BMK_benchFunction ../../programs/benchfn.c:116
    #1 0x60e0e863d9b7 in BMK_benchTimedFn ../../programs/benchfn.c:220
    #2 0x60e0e8634157 in benchMem ../../tests/fullbench.c:888
    #3 0x60e0e8630061 in benchSample ../../tests/fullbench.c:957
    #4 0x60e0e8630061 in main ../../tests/fullbench.c:1202
    #5 0x7280b09473bd in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:59
    #6 0x7280b09474da in __libc_start_main_impl ../csu/libc-start.c:360
    #7 0x60e0e8630964 in _start (/var/tmp/portage/app-arch/zstd-1.5.7-r1/work/zstd-1.5.7/build/meson-abi_x86_64.amd64/tests/fullbench+0x22964) (BuildId: 086f15e8ca2807af53ef92323b30bad2c495e8f7)

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

 6/10 zstd:test-decodecorpus        OK               30.04s
 7/10 fast - zstd:test-zstd-fast    OK               41.01s
 8/10 zstd:test-zstream-3           OK               90.06s
 9/10 zstd:test-zstream-1           OK              102.78s
10/10 zstd:test-fuzzer              OK              218.94s

Summary of Failures:

 4/10 zstd:test-fullbench-2         FAIL             27.53s   exit status 1
 5/10 zstd:test-fullbench-1         FAIL             27.97s   exit status 1

Ok:                8
Fail:              2

Full log written to /var/tmp/portage/app-arch/zstd-1.5.7-r1/work/zstd-1.5.7/build/meson-abi_x86_64.amd64/meson-logs/testlog.txt

Desktop (please complete the following information):

  • OS: Gentoo Linux
  • Version: 2.18
  • Compiler: gcc
  • Flags: -O2 -pipe -ggdb3 -fsanitize=undefined
  • Other relevant hardware specs: 32GB RAM
  • Build system: Meson

Additional context
Add any other context about the problem here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions