meson: Segfault on Linux aarch64 before executing subproject

Describe the bug When running build on aarch64 Linux I’m getting an interesting segfault:

The Meson build system
Version: 0.60.2
Source dir: /test
Build dir: /test/build
Build type: native build
Project name: test
Project version: undefined
C compiler for the host machine: cc (gcc 9.3.0 "cc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0")
C linker for the host machine: cc ld.bfd 2.34
Host machine cpu family: aarch64
Host machine cpu: aarch64
Downloading libuv source from https://dist.libuv.org/dist/v1.42.0/libuv-v1.42.0.tar.gz
Download size: 1284534
Downloading: ..........
Downloading libuv patch from https://wrapdb.mesonbuild.com/v2/libuv_1.42.0-1/get_patch
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)

^ is under arm64 Ubuntu container on x86-64 system with binfmt support (hence QEMU), but happens identically on native aarch64 platform as well.

To Reproduce

# meson.build
project('test', 'c')

executable('main', 'main.c',
  dependencies: [
    subproject('libuv').get_variable('libuv_dep')
  ]
)
// main.c
int main(int argc, char **argv) {
    return 0;
}
# subprojects/libuv.wrap
[wrap-file]
directory = libuv-v1.42.0
source_url = https://dist.libuv.org/dist/v1.42.0/libuv-v1.42.0.tar.gz
source_filename = libuv-v1.42.0.tar.gz
source_hash = 43129625155a8aed796ebe90b8d4c990a73985ec717de2b2d5d3a23cfe4deb72
patch_filename = libuv_1.42.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/libuv_1.42.0-1/get_patch
patch_hash = 891698d781bc68379b799e47bc7e100698f03985b6db5d1ddc4eaa9be42a8f35

[provide]
libuv = libuv_dep

Easy to reproduce on macOS with M1 chip under Docker too since Linux there is aarch64 natively.

Expected behavior No segfaults.

system parameters

  • Plain native build
  • Ubuntu 20.04
  • Python 3.8.10
  • Meson 0.60.2
  • Ninja 1.10.2.git.kitware.jobserver-1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

I talked to our crypto experts at Red Hat. They suspect that the crash is related to ARM assembly code. The server negotiates TLS 1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305, which is a bit unusual, too.

  • curl https://wrapdb.mesonbuild.com/v2/libuv_1.42.0-1/get_patch crashes with Ubuntu’s OpenSSL 1.1.1f build.
  • The same command works with OpenSSL 1.1.1i on 21.10
  • OPENSSL_armcap=0:0 curl https://wrapdb.mesonbuild.com/v2/libuv_1.42.0-1/get_patch works, too. The extra env var disables CPU capability detection.
  • curl --ciphers ECDHE-RSA-AES128-GCM-SHA256 https://wrapdb.mesonbuild.com/v2/libuv_1.42.0-1/get_patch also works.

This points to an issue with ChaCha20 or Poly1305 NEON assembly code on ARMv8 / aarch64 platform in OpenSSL 1.1.1f. https://github.com/openssl/openssl/pull/13256 or https://github.com/openssl/openssl/pull/13218 could be the culprit.