This is a minimal sample showing a bizzare crash condition on Linux aarch64 caused by a build doing 3 things together:
- creating a cdylib (hook) depending on, but not using, frida-gum.
- having that cdylib be a build-dependency of a standard executable (cli)
- having that executable depending on, but not using, tokio.
To repro, you need a Linux VM running on aarch64. For this I use Orbstack on a Macbook M4 Pro, running a Plucky Puffin 25.04 VM.
Then you need to:
$ cargo build
$ LD_PRELOAD=./target/debug/libswala_hook.so cat ian
Segmentation fault
To make the segfault go away, you can:
- remove tokio as a dependency of cli
- remove frida as a dependency of hook
- remove hook as a build-depenency of cli
- most curiously, switch hook to instead be a artifact = "cdylib" build-dependency of cli, i.e. switch swala/cli/Cargo.toml to:
[package]
name = "swala"
edition = "2024"
[dependencies]
tokio = { version = "1" }
[build-dependencies]
swala-hook = { artifact = "cdylib", path = "../hook" }