From: Sun Yuechi Date: Sun, 21 Jun 2026 08:42:54 +0000 (+0800) Subject: test/encoding: probe `setarch -R` and drop the arch argument X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ba08f88ade0cff63783ffcdfc238cbe7d91f16d;p=ceph.git test/encoding: probe `setarch -R` and drop the arch argument readable.sh wraps ceph-dencoder with `setarch $(uname -m) -R` to disable ASLR on ASan builds, but the arch-qualified form also sets the personality to that arch, which fails where setarch can't (e.g. riscv64). Use bare `setarch -R` to only clear ASLR, and probe it first so the script falls back to running ceph-dencoder unwrapped. Signed-off-by: Sun Yuechi --- diff --git a/src/test/encoding/readable.sh b/src/test/encoding/readable.sh index 115d6d7b6f1..dcf53d2c8ae 100755 --- a/src/test/encoding/readable.sh +++ b/src/test/encoding/readable.sh @@ -24,9 +24,16 @@ fi # ASAN builds need setarch -R to disable ASLR so each process can find a # contiguous 16+ TB shadow memory region. See https://clang.llvm.org/docs/AddressSanitizer.html +# Use bare `setarch -R` (no arch): the arch-qualified form also sets the +# personality, which fails where setarch can't (e.g. riscv64). Check it works +# before wrapping, and just run ceph-dencoder unwrapped if it doesn't. if ldd $(command -v $CEPH_DENCODER) 2>/dev/null | grep -q libasan; then - echo "ASAN build detected: wrapping ceph-dencoder with 'setarch \$(uname -m) -R'" - CEPH_DENCODER="setarch $(uname -m) -R $CEPH_DENCODER" + if setarch -R true >/dev/null 2>&1; then + echo "ASAN build detected: wrapping ceph-dencoder with 'setarch -R'" + CEPH_DENCODER="setarch -R $CEPH_DENCODER" + else + echo "ASAN build detected but 'setarch -R' is unavailable; running ceph-dencoder without ASLR disable" + fi fi myversion=$($CEPH_DENCODER version)