Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag-mismatch (HWAsan) on build from source #24

Closed
n-bes opened this issue Jul 9, 2024 · 1 comment
Closed

tag-mismatch (HWAsan) on build from source #24

n-bes opened this issue Jul 9, 2024 · 1 comment

Comments

@n-bes
Copy link

n-bes commented Jul 9, 2024

Dockerfile:

FROM ubuntu:24.04
RUN apt-get update -y && \
    apt-get install -y \
        autoconf \
        clang \
        clang-tools \
        curl \
        gcc \
        lld \
        libssl-dev \
        pkg-config \
        python3-dbg \
        python3-dev \
        python3-pip \
        python3-venv
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly -y
ENV PATH=/root/.cargo/bin:$PATH \
    CC=clang \
    CXX=clang++ \
    CFLAGS="-g -O0 -fsanitize=hwaddress -fuse-ld=lld -g" \
    CCFLAGS="-g -O0 -fsanitize=hwaddress -fuse-ld=lld -g" \
    CXXFLAGS="-g -O0 -fsanitize=hwaddress -fuse-ld=lld -g" \
    CPPFLAGS="-g -O0 -fsanitize=hwaddress -fuse-ld=lld -g" \
    LDFLAGS="-fsanitize=hwaddress -fuse-ld=lld" \
    LD_PRELOAD="/usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.hwasan-aarch64.so" \
    ASAN_OPTIONS="detect_leaks=0" \
    HWASAN_OPTIONS="detect_leaks=0"
$ docker build .
$ docker run --rm -it <name>
$ python3 -m venv venv
$ source venv/bin/activate
$ python3 --version
Python 3.12.3
$ pip3 install xkbcommon --no-binary ":all:"
Collecting xkbcommon
  Downloading xkbcommon-1.5.1.tar.gz (80 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 80.2/80.2 kB 1.3 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 99
  ╰─> [104 lines of output]
      ==173==ERROR: HWAddressSanitizer: tag-mismatch on address 0xffffb1688560 at pc 0xffffb156640c
      READ of size 8 at 0xffffb1688560 tags: b0/00 (ptr/mem) in thread T0
          #0 0xffffb156640c in PyInit__cffi_backend /tmp/pip-install-iycvqhbt/cffi_90ebfd0ff8434d5ab44e8f3435752cb7/src/c/_cffi_backend.c:8038:9
          #1 0x66def0 in _PyImport_LoadDynamicModuleWithSpec /usr/src/python3.12-3.12.3-1/build-static/../Python/importdl.c:169:9
          #2 0x66d338 in _imp_create_dynamic_impl /usr/src/python3.12-3.12.3-1/build-static/../Python/import.c:3775:11
          #3 0x66d338 in _imp_create_dynamic /usr/src/python3.12-3.12.3-1/build-static/../Python/clinic/import.c.h:506:20
          #4 0x502d4c in cfunction_vectorcall_FASTCALL /usr/src/python3.12-3.12.3-1/build-static/../Objects/methodobject.c:422:24
          #5 0x5652ac in _PyEval_EvalFrameDefault /usr/src/python3.12-3.12.3-1/build-static/Python/bytecodes.c:3254:26
          #6 0x4c2f00 in _PyObject_VectorcallTstate /usr/src/python3.12-3.12.3-1/build-static/../Include/internal/pycore_call.h:92:11
          #7 0x4c2f00 in object_vacall /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:850:14
          #8 0x4c4ae4 in PyObject_CallMethodObjArgs /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:911:24
          #9 0x58bee8 in import_find_and_load /usr/src/python3.12-3.12.3-1/build-static/../Python/import.c:2779:11
          #10 0x58bee8 in PyImport_ImportModuleLevelObject /usr/src/python3.12-3.12.3-1/build-static/../Python/import.c:2862:15
          #11 0x565f6c in import_name /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:2482:15
          #12 0x565f6c in _PyEval_EvalFrameDefault /usr/src/python3.12-3.12.3-1/build-static/Python/bytecodes.c:2135:19
          #13 0x4c3ba0 in _PyFunction_Vectorcall /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:419:16
          #14 0x4c3ba0 in _PyObject_FastCallDictTstate /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:133:15
          #15 0x4c3ba0 in _PyObject_Call_Prepend /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:508:24
          #16 0x521060 in slot_tp_init /usr/src/python3.12-3.12.3-1/build-static/../Objects/typeobject.c:9014:15
          #17 0x51c7a0 in type_call /usr/src/python3.12-3.12.3-1/build-static/../Objects/typeobject.c:1673:19
          #18 0x4c20c4 in _PyObject_MakeTpCall /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:240:18
          #19 0x561d20 in _PyEval_EvalFrameDefault /usr/src/python3.12-3.12.3-1/build-static/Python/bytecodes.c:2706:19
          #20 0x560070 in _PyEval_EvalFrame /usr/src/python3.12-3.12.3-1/build-static/../Include/internal/pycore_ceval.h:89:16
          #21 0x560070 in _PyEval_Vector /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:1683:12
          #22 0x560070 in PyEval_EvalCode /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:578:21
          #23 0x55d264 in builtin_exec_impl /usr/src/python3.12-3.12.3-1/build-static/../Python/bltinmodule.c:1096:17
          #24 0x55d264 in builtin_exec /usr/src/python3.12-3.12.3-1/build-static/../Python/clinic/bltinmodule.c.h:586:20
          #25 0x502a38 in cfunction_vectorcall_FASTCALL_KEYWORDS /usr/src/python3.12-3.12.3-1/build-static/../Objects/methodobject.c:438:24
          #26 0x4c2c78 in _PyObject_VectorcallTstate /usr/src/python3.12-3.12.3-1/build-static/../Include/internal/pycore_call.h:92:11
          #27 0x4c2c78 in PyObject_Vectorcall /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:325:12
          #28 0x561d20 in _PyEval_EvalFrameDefault /usr/src/python3.12-3.12.3-1/build-static/Python/bytecodes.c:2706:19
          #29 0x4c3ba0 in _PyFunction_Vectorcall /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:419:16
          #30 0x4c3ba0 in _PyObject_FastCallDictTstate /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:133:15
          #31 0x4c3ba0 in _PyObject_Call_Prepend /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:508:24
          #32 0x521060 in slot_tp_init /usr/src/python3.12-3.12.3-1/build-static/../Objects/typeobject.c:9014:15
          #33 0x51c7a0 in type_call /usr/src/python3.12-3.12.3-1/build-static/../Objects/typeobject.c:1673:19
          #34 0x4c20c4 in _PyObject_MakeTpCall /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:240:18
          #35 0x561d20 in _PyEval_EvalFrameDefault /usr/src/python3.12-3.12.3-1/build-static/Python/bytecodes.c:2706:19
          #36 0x560070 in _PyEval_EvalFrame /usr/src/python3.12-3.12.3-1/build-static/../Include/internal/pycore_ceval.h:89:16
          #37 0x560070 in _PyEval_Vector /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:1683:12
          #38 0x560070 in PyEval_EvalCode /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:578:21
          #39 0x598ddc in run_eval_code_obj /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1722:9
          #40 0x598ddc in run_mod /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1743:19
          #41 0x598ddc in PyRun_StringFlags /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1618:15
          #42 0x55d318 in builtin_exec_impl /usr/src/python3.12-3.12.3-1/build-static/../Python/bltinmodule.c:1121:17
          #43 0x55d318 in builtin_exec /usr/src/python3.12-3.12.3-1/build-static/../Python/clinic/bltinmodule.c.h:586:20
          #44 0x502a38 in cfunction_vectorcall_FASTCALL_KEYWORDS /usr/src/python3.12-3.12.3-1/build-static/../Objects/methodobject.c:438:24
          #45 0x4c2c78 in _PyObject_VectorcallTstate /usr/src/python3.12-3.12.3-1/build-static/../Include/internal/pycore_call.h:92:11
          #46 0x4c2c78 in PyObject_Vectorcall /usr/src/python3.12-3.12.3-1/build-static/../Objects/call.c:325:12
          #47 0x561d20 in _PyEval_EvalFrameDefault /usr/src/python3.12-3.12.3-1/build-static/Python/bytecodes.c:2706:19
          #48 0x560070 in _PyEval_EvalFrame /usr/src/python3.12-3.12.3-1/build-static/../Include/internal/pycore_ceval.h:89:16
          #49 0x560070 in _PyEval_Vector /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:1683:12
          #50 0x560070 in PyEval_EvalCode /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:578:21
          #51 0x598f70 in run_eval_code_obj /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1722:9
          #52 0x598f70 in run_mod /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1743:19
          #53 0x67e6f0 in pyrun_file /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1643:15
          #54 0x67e2c4 in _PyRun_SimpleFileObject /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:433:13
          #55 0x67e090 in _PyRun_AnyFileObject /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:78:15
          #56 0x6890e8 in pymain_run_file_obj /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:360:15
          #57 0x6890e8 in pymain_run_file /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:379:15
          #58 0x6890e8 in pymain_run_python /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:629:21
          #59 0x6890e8 in Py_RunMain /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:709:5
          #60 0x688ca4 in Py_BytesMain /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:763:12
          #61 0xffffb43384c0 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #62 0xffffb4338594 in __libc_start_main csu/../csu/libc-start.c:360:3
          #63 0x5f24ec in _start (/usr/bin/python3.12+0x5f24ec) (BuildId: 18160fe6beb052a7e6830ecc99e313a3498c377d)


      Thread: T0 0xeffe00002000 stack: [0xfffffbf7e000,0xfffffc77e000) sz: 8388608 tls: [0xffffb50ed460,0xffffb50ee320)

      Memory tags around the buggy address (one tag corresponds to 16 bytes):
        0xffffb1687d00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1687e00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1687f00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688000: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688100: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688200: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688300: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688400: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
      =>0xffffb1688500: 00  00  00  00  00  00 [00] 00  00  00  00  00  00  00  00  00
        0xffffb1688600: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688700: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688800: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688900: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688a00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688b00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688c00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        0xffffb1688d00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
      Tags for short granules around the buggy address (one tag corresponds to 16 bytes):
        0xffffb1688400: ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
      =>0xffffb1688500: ..  ..  ..  ..  ..  .. [..] ..  ..  ..  ..  ..  ..  ..  ..  ..
        0xffffb1688600: ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
      See https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html#short-granules for a description of short granule tags

      Registers where the failure occurred (pc 0xffffb156640c):
          x0  b000ffffb1688560  x1  0000000000000000  x2  0000000000000000  x3  0000000000000001
          x4  0000000000000002  x5  5300ed5e000b4100  x6  0000000000000006  x7  00000000000001d0
          x8  00000000000000b0  x9  0000000000000000  x10 00000ffffb168856  x11 0000000000000000
          x12 0000000000000000  x13 0000000000000000  x14 0000000000000000  x15 fffffffffffff000
          x16 0000ffffb463b7f0  x17 0000000000000007  x18 0000000000000004  x19 0000ffffb1760070
          x20 0200efff00000000  x21 0000ffffb16afa20  x22 0000ffffb17729a0  x23 0000000000000000
          x24 0000ffffb1772a50  x25 000000000070f5b8  x26 0000ffffb1565fb4  x27 0000ffffb17729c0
          x28 0000000000b8a278  x29 0000fffffc77afa0  x30 0000ffffb1566410   sp 0000fffffc77ae20
      SUMMARY: HWAddressSanitizer: tag-mismatch /tmp/pip-install-iycvqhbt/cffi_90ebfd0ff8434d5ab44e8f3435752cb7/src/c/_cffi_backend.c:8038:9 in PyInit__cffi_backend
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Originally found similar in cryptography pyca/cryptography#11217 and I tried another project (xkbcommon).

@n-bes n-bes changed the title undefined symbol: const_str_plain_split tag-mismatch (HWAsan) on build from source Jul 9, 2024
@sde1000
Copy link
Owner

sde1000 commented Jul 10, 2024

Closing here because it looks like the underlying issue is in cffi

@sde1000 sde1000 closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants