mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-01 05:39:34 +02:00
fix(android): avoid blocked statx probes on legacy ARM32 devices
Vendor the pinned Rustix package with an Android-only weak libc lookup so missing statx returns ENOSYS and uses the existing stat64 fallback. Add an isolated Android smoke test with a hidden symbol and a seccomp filter that kills raw statx probes. Verified 177 workspace tests, host Clippy, and ARM64 Android sandbox smoke test. ARM32 cross-target Clippy passes with the existing needless_return warning in binary.rs exempted; physical Android 10 ARM32 validation remains required.
This commit is contained in:
1 parent
9d530cea9e
commit
1d53609b51
339 files changed
+75413
-2
No files matched your search
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# Exercise statx fallback without requiring an old Android system image.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
case "${1:-arm64-v8a}" in
|
||||
arm64-v8a) target=aarch64-linux-android; compiler=aarch64-linux-android24-clang ;;
|
||||
armeabi-v7a) target=armv7-linux-androideabi; compiler=armv7a-linux-androideabi24-clang ;;
|
||||
*) echo "Usage: $0 [arm64-v8a|armeabi-v7a]" >&2; exit 2 ;;
|
||||
esac
|
||||
: "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME}"
|
||||
case "$(uname -s)" in
|
||||
Darwin) ndk_host=darwin-x86_64 ;;
|
||||
Linux) ndk_host=linux-x86_64 ;;
|
||||
*) exit 2 ;;
|
||||
esac
|
||||
ndk_bin="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$ndk_host/bin"
|
||||
target_env="${target//-/_}"
|
||||
linker_env="$(printf '%s' "$target_env" | tr '[:lower:]' '[:upper:]')"
|
||||
export "CARGO_TARGET_${linker_env}_LINKER=$ndk_bin/$compiler"
|
||||
export "CC_${target_env}=$ndk_bin/$compiler"
|
||||
export "AR_${target_env}=$ndk_bin/llvm-ar"
|
||||
export "BINDGEN_EXTRA_CLANG_ARGS_${target_env}=--sysroot=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$ndk_host/sysroot --target=${compiler%-clang}"
|
||||
export RUSTFLAGS="${RUSTFLAGS:-} -C link-arg=-Wl,-z,max-page-size=16384"
|
||||
|
||||
cd "$PROJECT_DIR/rust_backend"
|
||||
cargo rustc --locked --release -p spotiflac-extensions --example android_statx_smoke \
|
||||
--target "$target" -- -C link-arg=-Wl,--wrap=dlsym
|
||||
remote="/data/local/tmp/spotiflac-statx-smoke-$$"
|
||||
trap 'adb shell rm -f "$remote" >/dev/null 2>&1 || true' EXIT
|
||||
adb push "target/$target/release/examples/android_statx_smoke" "$remote"
|
||||
adb shell chmod 700 "$remote"
|
||||
adb shell "$remote"
|
||||
adb shell "$remote --legacy"
|
||||
set +e
|
||||
adb shell "$remote --probe-blocked-syscall"
|
||||
status=$?
|
||||
set -e
|
||||
if [[ "$status" != 159 ]]; then
|
||||
echo "Expected SIGSYS (159) from the isolated filter probe, got $status" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Android statx compatibility smoke test passed."
|
||||
Reference in new issue
Block a user