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 #11217

Closed
n-bes opened this issue Jul 8, 2024 · 7 comments
Closed

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

n-bes opened this issue Jul 8, 2024 · 7 comments

Comments

@n-bes
Copy link

n-bes commented Jul 8, 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"
# ENV RUSTFLAGS="-g"
# ENV RUSTFLAGS="-g"

Steps:

$ docker build .
$ docker run --rm -it <name>
$ python3 -m venv venv
$ source venv/bin/activate
$ python3 --version
Python 3.12.3
$ pip3 install cryptography --no-binary ":all:"
Collecting cryptography
  Downloading cryptography-42.0.8.tar.gz (671 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 671.2/671.2 kB 5.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting cffi>=1.12 (from cryptography)
  Using cached cffi-1.16.0-cp312-cp312-linux_aarch64.whl
Collecting pycparser (from cffi>=1.12->cryptography)
  Using cached pycparser-2.22-py3-none-any.whl
Building wheels for collected packages: cryptography
  Building wheel for cryptography (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for cryptography (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [389 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-312
      creating build/lib.linux-aarch64-cpython-312/cryptography
      copying src/cryptography/utils.py -> build/lib.linux-aarch64-cpython-312/cryptography
      copying src/cryptography/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography
      copying src/cryptography/__about__.py -> build/lib.linux-aarch64-cpython-312/cryptography
      copying src/cryptography/fernet.py -> build/lib.linux-aarch64-cpython-312/cryptography
      copying src/cryptography/exceptions.py -> build/lib.linux-aarch64-cpython-312/cryptography
      creating build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/base.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/general_name.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/extensions.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/name.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/ocsp.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/verification.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/certificate_transparency.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      copying src/cryptography/x509/oid.py -> build/lib.linux-aarch64-cpython-312/cryptography/x509
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat
      copying src/cryptography/hazmat/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat
      copying src/cryptography/hazmat/_oid.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings
      copying src/cryptography/hazmat/bindings/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/_asymmetric.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/_cipheralgorithm.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/padding.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/_serialization.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/poly1305.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/backends
      copying src/cryptography/hazmat/backends/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/backends
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/openssl
      copying src/cryptography/hazmat/bindings/openssl/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/openssl
      copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/openssl
      copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/openssl
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/base.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/pkcs7.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/pkcs12.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/ssh.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/serialization
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/kbkdf.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/scrypt.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/kdf
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/aead.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/ciphers
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/twofactor
      copying src/cryptography/hazmat/primitives/twofactor/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/twofactor
      copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/twofactor
      copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/twofactor
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/ed25519.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/types.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/x448.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/x25519.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/ed448.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/primitives/asymmetric
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/__init__.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/aead.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/backends/openssl
      running egg_info
      writing src/cryptography.egg-info/PKG-INFO
      writing dependency_links to src/cryptography.egg-info/dependency_links.txt
      writing requirements to src/cryptography.egg-info/requires.txt
      writing top-level names to src/cryptography.egg-info/top_level.txt
      reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.c' under directory 'src/_cffi_src'
      warning: no files found matching '*.h' under directory 'src/_cffi_src'
      no previously-included directories found matching 'docs/_build'
      warning: no previously-included files found matching 'vectors'
      warning: no previously-included files matching '*' found under directory 'vectors'
      warning: no previously-included files found matching 'src/rust/target'
      warning: no previously-included files matching '*' found under directory 'src/rust/target'
      warning: no previously-included files matching '*' found under directory '.github'
      warning: no previously-included files found matching 'release.py'
      warning: no previously-included files found matching '.readthedocs.yml'
      warning: no previously-included files found matching 'ci-constraints-requirements.txt'
      warning: no previously-included files found matching 'mypy.ini'
      adding license file 'LICENSE'
      adding license file 'LICENSE.APACHE'
      adding license file 'LICENSE.BSD'
      writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
      copying src/cryptography/py.typed -> build/lib.linux-aarch64-cpython-312/cryptography
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust
      copying src/cryptography/hazmat/bindings/_rust/__init__.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust
      copying src/cryptography/hazmat/bindings/_rust/_openssl.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust
      copying src/cryptography/hazmat/bindings/_rust/asn1.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust
      copying src/cryptography/hazmat/bindings/_rust/exceptions.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust
      copying src/cryptography/hazmat/bindings/_rust/ocsp.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust
      copying src/cryptography/hazmat/bindings/_rust/pkcs7.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust
      copying src/cryptography/hazmat/bindings/_rust/x509.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust
      creating build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/aead.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/cmac.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/dh.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/ec.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/keys.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/rsa.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      copying src/cryptography/hazmat/bindings/_rust/openssl/x448.pyi -> build/lib.linux-aarch64-cpython-312/cryptography/hazmat/bindings/_rust/openssl
      running build_ext
      running build_rust
          Updating crates.io index
       Downloading crates ...
        Downloaded autocfg v1.1.0
        Downloaded bitflags v1.3.2
        Downloaded windows-targets v0.48.5
        Downloaded foreign-types v0.3.2
        Downloaded asn1_derive v0.15.5
        Downloaded openssl-macros v0.1.1
        Downloaded unindent v0.2.3
        Downloaded foreign-types-shared v0.1.1
        Downloaded indoc v2.0.4
        Downloaded cfg-if v1.0.0
        Downloaded memoffset v0.9.0
        Downloaded scopeguard v1.2.0
        Downloaded heck v0.4.1
        Downloaded self_cell v1.0.3
        Downloaded pyo3-macros v0.20.3
        Downloaded target-lexicon v0.12.13
        Downloaded smallvec v1.13.1
        Downloaded quote v1.0.35
        Downloaded proc-macro2 v1.0.78
        Downloaded pyo3-macros-backend v0.20.3
        Downloaded bitflags v2.4.2
        Downloaded pyo3-build-config v0.20.3
        Downloaded once_cell v1.19.0
        Downloaded unicode-ident v1.0.12
        Downloaded lock_api v0.4.11
        Downloaded redox_syscall v0.4.1
        Downloaded pyo3-ffi v0.20.3
        Downloaded parking_lot v0.12.1
        Downloaded cc v1.0.83
        Downloaded base64 v0.21.7
        Downloaded openssl-sys v0.9.102
        Downloaded parking_lot_core v0.9.9
        Downloaded pkg-config v0.3.29
        Downloaded pem v3.0.3
        Downloaded asn1 v0.15.5
        Downloaded portable-atomic v1.6.0
        Downloaded vcpkg v0.2.15
        Downloaded syn v2.0.48
        Downloaded openssl v0.10.64
        Downloaded windows_aarch64_gnullvm v0.48.5
        Downloaded windows_x86_64_gnullvm v0.48.5
        Downloaded pyo3 v0.20.3
        Downloaded libc v0.2.152
        Downloaded windows_x86_64_msvc v0.48.5
        Downloaded windows_x86_64_gnu v0.48.5
        Downloaded windows_aarch64_msvc v0.48.5
        Downloaded windows_i686_msvc v0.48.5
        Downloaded windows_i686_gnu v0.48.5
      cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/rust/Cargo.toml --release -v --features pyo3/extension-module --crate-type cdylib --
         Compiling libc v0.2.152
         Compiling proc-macro2 v1.0.78
         Compiling unicode-ident v1.0.12
         Compiling target-lexicon v0.12.13
         Compiling vcpkg v0.2.15
         Compiling pkg-config v0.3.29
         Compiling once_cell v1.19.0
         Compiling autocfg v1.1.0
         Compiling cfg-if v1.0.0
         Compiling parking_lot_core v0.9.9
         Compiling scopeguard v1.2.0
         Compiling heck v0.4.1
         Compiling foreign-types-shared v0.1.1
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.152/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=34b43233384b7296 -C extra-filename=-34b43233384b7296 --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/build/libc-34b43233384b7296 -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name unicode_ident --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.12/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=55f166950d8d4b8d -C extra-filename=-55f166950d8d4b8d --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/target-lexicon-0.12.13/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --cfg 'feature="default"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("arch_zkasm", "default", "serde", "serde_support", "std"))' -C metadata=f70c2b3d23d23240 -C extra-filename=-f70c2b3d23d23240 --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/build/target-lexicon-f70c2b3d23d23240 -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.78/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --cfg 'feature="default"' --cfg 'feature="proc-macro"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "nightly", "proc-macro", "span-locations"))' -C metadata=3b258af4e6dba20e -C extra-filename=-3b258af4e6dba20e --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/build/proc-macro2-3b258af4e6dba20e -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name pkg_config --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkg-config-0.3.29/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=fee08ca833b1ce4a -C extra-filename=-fee08ca833b1ce4a --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name vcpkg --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/vcpkg-0.2.15/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=f3803849b63d1022 -C extra-filename=-f3803849b63d1022 --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name autocfg --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/autocfg-1.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=0c302a7329813528 -C extra-filename=-0c302a7329813528 --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name cfg_if --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C overflow-checks=on --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("compiler_builtins", "core", "rustc-dep-of-std"))' -C metadata=091d3ebab6a850f4 -C extra-filename=-091d3ebab6a850f4 --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2015 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.152/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --cfg 'feature="default"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=629a34669e331c9c -C extra-filename=-629a34669e331c9c --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/build/libc-629a34669e331c9c -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name once_cell --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="race"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("alloc", "atomic-polyfill", "critical-section", "default", "parking_lot", "portable-atomic", "race", "std", "unstable"))' -C metadata=73722effac96ca21 -C extra-filename=-73722effac96ca21 --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --cap-lints allow`

.......

           Running `/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/build/cryptography-rust-e9d91d70fe3ba8ff/build-script-build`
           Running `/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/bin/rustc --crate-name openssl_sys --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.102/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C overflow-checks=on --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("bindgen", "bssl-sys", "openssl-src", "unstable_boringssl", "vendored"))' -C metadata=928df625d074d588 -C extra-filename=-928df625d074d588 --out-dir /tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps -C strip=debuginfo -L dependency=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps --extern libc=/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/deps/liblibc-05e7a8042348528f.rmeta --cap-lints allow -l ssl -l crypto --cfg 'osslconf="OPENSSL_NO_IDEA"' --cfg 'osslconf="OPENSSL_NO_SSL3_METHOD"' --cfg openssl --cfg ossl300 --cfg ossl101 --cfg ossl102 --cfg ossl102f --cfg ossl102h --cfg ossl110 --cfg ossl110f --cfg ossl110g --cfg ossl110h --cfg ossl111 --cfg ossl111b --cfg ossl111c --cfg ossl111d`
      error: failed to run custom build command for `cryptography-cffi v0.1.0 (/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/cryptography-cffi)`

      Caused by:
        process didn't exit successfully: `/tmp/pip-install-qfxusz7_/cryptography_9ec9d7565ea0463594adbeace79f1945/src/rust/target/release/build/cryptography-cffi-57fa8934d5ab8e13/build-script-build` (exit status: 101)
        --- stdout
        cargo:rustc-check-cfg=cfg(python_implementation, values("CPython", "PyPy"))
        cargo:rerun-if-env-changed=PYO3_PYTHON
        cargo:rerun-if-changed=../../_cffi_src/
        cargo:rerun-if-changed=../../cryptography/__about__.py

        --- stderr
        thread 'main' panicked at cryptography-cffi/build.rs:39:9:
        failed to run build_openssl.py, stdout:

        stderr:
        ==812==ERROR: HWAddressSanitizer: tag-mismatch on address 0xffff8f6f8560 at pc 0xffff8f5d640c
        READ of size 8 at 0xffff8f6f8560 tags: b0/00 (ptr/mem) in thread T0
            #0 0xffff8f5d640c in PyInit__cffi_backend /tmp/pip-install-8sug4l_z/cffi_e6192635c0584d6b977276e852c6165a/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 0x598f70 in run_eval_code_obj /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1722:9
            #24 0x598f70 in run_mod /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1743:19
            #25 0x67e6f0 in pyrun_file /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1643:15
            #26 0x67e2c4 in _PyRun_SimpleFileObject /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:433:13
            #27 0x67e090 in _PyRun_AnyFileObject /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:78:15
            #28 0x6890e8 in pymain_run_file_obj /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:360:15
            #29 0x6890e8 in pymain_run_file /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:379:15
            #30 0x6890e8 in pymain_run_python /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:629:21
            #31 0x6890e8 in Py_RunMain /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:709:5
            #32 0x688ca4 in Py_BytesMain /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:763:12
            #33 0xffff915a84c0 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
            #34 0xffff915a8594 in __libc_start_main csu/../csu/libc-start.c:360:3
            #35 0x5f24ec in _start (/usr/bin/python3.12+0x5f24ec) (BuildId: 18160fe6beb052a7e6830ecc99e313a3498c377d)


        Thread: T0 0xeffe00002000 stack: [0xffffeb515000,0xffffebd15000) sz: 8388608 tls: [0xffff92358cc0,0xffff92359b80)

        Memory tags around the buggy address (one tag corresponds to 16 bytes):
          0xffff8f6f7d00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f7e00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f7f00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8000: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8100: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8200: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8300: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8400: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
        =>0xffff8f6f8500: 00  00  00  00  00  00 [00] 00  00  00  00  00  00  00  00  00
          0xffff8f6f8600: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8700: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8800: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8900: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8a00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8b00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8c00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
          0xffff8f6f8d00: 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):
          0xffff8f6f8400: ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
        =>0xffff8f6f8500: ..  ..  ..  ..  ..  .. [..] ..  ..  ..  ..  ..  ..  ..  ..  ..
          0xffff8f6f8600: ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
        See https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html#short-granules for a description of short granule tags

        Registers where the failure occurred (pc 0xffff8f5d640c):
            x0  b000ffff8f6f8560  x1  0000000000000000  x2  0000000000000000  x3  0000000000000001
            x4  0000000000000002  x5  e100ed5e0000f100  x6  0000000000000006  x7  0000000000000070
            x8  00000000000000b0  x9  0000000000000000  x10 00000ffff8f6f856  x11 0000000000000000
            x12 0000000000000000  x13 0000000000000000  x14 0000000000000000  x15 0000ecebfffe0024
            x16 0000ffff918ab7f0  x17 0000000000000007  x18 0000000000000004  x19 0000ffff8f76e930
            x20 0200efff00000000  x21 0000ffff8f705e90  x22 0000ffff8f7aa9a0  x23 0000000000000000
            x24 0000ffff8f7aaab0  x25 000000000070f5b8  x26 0000ffff8f5d5fb4  x27 0000ffff8f7aa9c0
            x28 0000000000b8a278  x29 0000ffffebd11950  x30 0000ffff8f5d6410   sp 0000ffffebd117d0
        SUMMARY: HWAddressSanitizer: tag-mismatch /tmp/pip-install-8sug4l_z/cffi_e6192635c0584d6b977276e852c6165a/src/c/_cffi_backend.c:8038:9 in PyInit__cffi_backend


        note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
      warning: build failed, waiting for other jobs to finish...
      error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/rust/Cargo.toml --release -v --features pyo3/extension-module --crate-type cdylib --` failed with code 101
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects
@alex
Copy link
Member

alex commented Jul 8, 2024 via email

@n-bes
Copy link
Author

n-bes commented Jul 8, 2024

(is this MTE or TBI?

MTE, MacBook Pro M3

Is there a way to get the allocating stack trace?

Any ideas? valgrind?

From the stack it looks like this is happening in cffi, not our own code. Does this reproduce with other cffi modules?

Yes, I tried with 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.

@alex
Copy link
Member

alex commented Jul 8, 2024

I'm not sure M3 supports MTE, but it doesn't particularly matter, that was just curiosity.

Does this reproduce with simply pip install cffi && python -c "import cffi"? I think it will, and therefore think this should be reported to the cffi devs.

Assuming I have the version of the code right and this is cffi 0.16.0, this appears to point to this line of code, which is confusing to me https://github.com/python-cffi/cffi/blob/v1.16.0/src/c/_cffi_backend.c#L8038

@n-bes
Copy link
Author

n-bes commented Jul 9, 2024

I'm not sure M3 supports MTE, but it doesn't particularly matter, that was just curiosity.

It does.

Does this reproduce with simply pip install cffi && python -c "import cffi"?

No

$ docker run --rm -it <image>
$ python3 -m venv venv
$ source venv/bin/activate
$ pip3 install cffi --no-binary ":all:"
Collecting cffi
  Downloading cffi-1.16.0.tar.gz (512 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 512.9/512.9 kB 3.8 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pycparser (from cffi)
  Downloading pycparser-2.22.tar.gz (172 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 172.7/172.7 kB 3.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: cffi, pycparser
  Building wheel for cffi (pyproject.toml) ... done
  Created wheel for cffi: filename=cffi-1.16.0-cp312-cp312-linux_aarch64.whl size=558605 sha256=d5de52ecea6ee72de6e7e20bd7b849d76bcf86118e2ee2c67033af63113171d2
  Stored in directory: /root/.cache/pip/wheels/9f/20/b5/43b003d703a3519a9adbe40423a752dd0c7618afb763739963
  Building wheel for pycparser (pyproject.toml) ... done
  Created wheel for pycparser: filename=pycparser-2.22-py3-none-any.whl size=117551 sha256=928b6834e3a24b5a187d162685fcbf733ebc027a462b4061a4444ffb90d4242c
  Stored in directory: /root/.cache/pip/wheels/36/53/17/c0ae2e096d359a9a8faf47fd7ded8f4c878af41a3c66cb5199
Successfully built cffi pycparser
Installing collected packages: pycparser, cffi
Successfully installed cffi-1.16.0 pycparser-2.22

$ python3
Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cffi
>>>

@alex
Copy link
Member

alex commented Jul 9, 2024

Hmm, what about import _cffi_backend?

@n-bes
Copy link
Author

n-bes commented Jul 9, 2024

What about import _cffi_backend?

Good catch:

>>> import _cffi_backend
==6891==ERROR: HWAddressSanitizer: tag-mismatch on address 0xffffaf138560 at pc 0xffffaf01640c
READ of size 8 at 0xffffaf138560 tags: b0/00 (ptr/mem) in thread T0
    #0 0xffffaf01640c in PyInit__cffi_backend /tmp/pip-install-4y800q_w/cffi_719689ca36314da393f7dd5e1ef29011/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 0x560070 in _PyEval_EvalFrame /usr/src/python3.12-3.12.3-1/build-static/../Include/internal/pycore_ceval.h:89:16
    #14 0x560070 in _PyEval_Vector /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:1683:12
    #15 0x560070 in PyEval_EvalCode /usr/src/python3.12-3.12.3-1/build-static/../Python/ceval.c:578:21
    #16 0x598f70 in run_eval_code_obj /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1722:9
    #17 0x598f70 in run_mod /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:1743:19
    #18 0x451460 in PyRun_InteractiveOneObjectEx /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:260:9
    #19 0x4511a8 in _PyRun_InteractiveLoopObject /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:137:15
    #20 0x67e0e4 in _PyRun_AnyFileObject /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:72:15
    #21 0x451078 in PyRun_AnyFileExFlags /usr/src/python3.12-3.12.3-1/build-static/../Python/pythonrun.c:104:15
    #22 0x689500 in pymain_run_stdin /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:520:15
    #23 0x689500 in pymain_run_python /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:632:21
    #24 0x689500 in Py_RunMain /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:709:5
    #25 0x688ca4 in Py_BytesMain /usr/src/python3.12-3.12.3-1/build-static/../Modules/main.c:763:12
    #26 0xffffb10c84c0 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #27 0xffffb10c8594 in __libc_start_main csu/../csu/libc-start.c:360:3
    #28 0x5f24ec in _start (/usr/bin/python3.12+0x5f24ec) (BuildId: 18160fe6beb052a7e6830ecc99e313a3498c377d)


Thread: T0 0xeffe00002000 stack: [0xffffcbbbd000,0xffffcc3bd000) sz: 8388608 tls: [0xffffb1e79460,0xffffb1e7a320)

Memory tags around the buggy address (one tag corresponds to 16 bytes):
  0xffffaf137d00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf137e00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf137f00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138000: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138100: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138200: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138300: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138400: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
=>0xffffaf138500: 00  00  00  00  00  00 [00] 00  00  00  00  00  00  00  00  00
  0xffffaf138600: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138700: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138800: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138900: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138a00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138b00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138c00: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xffffaf138d00: 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):
  0xffffaf138400: ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
=>0xffffaf138500: ..  ..  ..  ..  ..  .. [..] ..  ..  ..  ..  ..  ..  ..  ..  ..
  0xffffaf138600: ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
See https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html#short-granules for a description of short granule tags

Registers where the failure occurred (pc 0xffffaf01640c):
    x0  b000ffffaf138560  x1  0000000000000000  x2  0000000000000000  x3  0000000000000001
    x4  0000000000000002  x5  a900ed5e0000bb00  x6  0000000000000006  x7  0000000000000020
    x8  00000000000000b0  x9  0000000000000000  x10 00000ffffaf13856  x11 0000000000000000
    x12 0000000000000000  x13 00000000000000a9  x14 0000000000000000  x15 0000ecebfffe0024
    x16 0000ffffb13cb7f0  x17 0000000000000007  x18 0000000000000004  x19 0000ffffaf30b9b0
    x20 0200efff00000000  x21 0000ffffaf176eb0  x22 0000ffffaf1b3a20  x23 0000000000000000
    x24 0000ffffaf1b3650  x25 000000000070f5b8  x26 0000ffffaf015fb4  x27 0000ffffaf1b3a40
    x28 0000000000b8a278  x29 0000ffffcc3bb0c0  x30 0000ffffaf016410   sp 0000ffffcc3baf40
SUMMARY: HWAddressSanitizer: tag-mismatch /tmp/pip-install-4y800q_w/cffi_719689ca36314da393f7dd5e1ef29011/src/c/_cffi_backend.c:8038:9 in PyInit__cffi_backend

@alex
Copy link
Member

alex commented Jul 9, 2024

Great. Based on this, I'm going to close this in favor of the cffi bug, since that's where the fix needs to be. Thanks for digging in here!

@alex alex closed this as completed Jul 9, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants