]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/encoding: probe `setarch -R` and drop the arch argument
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Sun, 21 Jun 2026 08:42:54 +0000 (16:42 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Mon, 22 Jun 2026 02:57:27 +0000 (10:57 +0800)
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 <sunyuechi@iscas.ac.cn>
src/test/encoding/readable.sh

index 115d6d7b6f15edec986627466673a7c5f6cad125..dcf53d2c8aea53261148e2d0547cf6daf00ed4e5 100755 (executable)
@@ -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)