Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strace cross-testing

Continuous cross-architecture testing of strace on rarely-tested CPU architectures.

GitHub Actions build a cross toolchain and a minimal root filesystem with Buildroot, cross-compile strace and its test suite against that toolchain, then boot the target architecture under QEMU system emulation and run make check inside the guest. The point is to exercise strace's per-architecture support -- syscall decoders, register/ABI handling, struct layouts -- on platforms that rarely get tested elsewhere.

Architectures

Arch QEMU machine Notes
m68k virt no dedicated TP register, 2-byte int alignment
s390x (default) z15 target
sparc64 sun4u 64-bit, VA hole in the address space
mips64el malta 64-bit little-endian, n64 ABI

Per-architecture QEMU and guest settings (machine, emulator binary, memory, kernel image, virtio transport, console) live in ci/lib.sh. Each architecture has a Buildroot defconfig under ci/buildroot-config-<arch>.

Status

Patches m68k s390x sparc64 mips64el
strace -- (4) -- -- (1) 2
gcc 1 -- -- --
elfutils -- -- -- 1

A plain number is patches currently carried; a number in parentheses is patches since accepted upstream and no longer carried. These are bugs found by the cross-testing itself -- in the strace tests on these architectures, and one m68k compiler miscompile -- and are reported upstream.

How it works

The workflow (.github/workflows/cross.yml) has two jobs, run as a matrix over the architectures:

  1. build

    • ci/build-buildroot <arch> -- runs Buildroot with the per-arch config to produce the cross toolchain, kernel, and an initramfs (busybox + the host QEMU build).
    • ci/build-strace <arch> -- checks out upstream strace, applies the patches in ci/strace-patches/, and cross-compiles strace plus every tests*/ directory with the toolchain.
    • The Buildroot output and the strace build tree are cached (and uploaded as artifacts) keyed on the Buildroot version, arch config, strace commit, and patch set, so the test job reuses them without rebuilding.
  2. test (sharded across many parallel jobs per architecture)

    • ci/run-qemu <arch> packs the freshly built strace tree into an ext2 image, boots the guest kernel under QEMU, and shares the source tree and toolchain over virtio-9p.
    • On boot the guest runs ci/rootfs-overlay/etc/init.d/S99strace-check, which runs make check for this shard's tests, records the exit status, and powers off.
    • ci/shard-tests splits each test directory's $(TESTS) list into shards so the suite runs in parallel across many jobs per arch.

Patches

Failures uncovered on these architectures are tracked as patches and reported upstream.

strace (ci/strace-patches/, applied by ci/build-strace):

  • mips64el -- ioctl_pidfd_get_info: the test hardcoded the SIGABRT name for coredump_signal, but MIPS names signal 6 SIGIOT; decode it through signal2name() so the expected output matches.
  • mips64el -- restart_syscall-p: on MIPS the syscall number shares the v0 register with the syscall return value, so on attach strace misread an interrupted syscall's return value as a syscall number; skip v0 when PTRACE_GET_SYSCALL_INFO reports no syscall entry.

GCC (ci/patches/gcc/):

  • m68k -- fold-mem-offsets: the pass folds a constant offset into a base register still used by a memory-to-memory move, miscompiling code at -O2.

elfutils (ci/patches/elfutils/):

  • mips64el -- MIPS unwinding: the MIPS backend omits a same_value default rule for the return-address register ra (r31), so libdwfl stops after one frame and strace -k at a syscall site shows only the libc entry; add the missing rule.

Upstreamed

These strace test fixes were found by the cross-testing and have since been accepted upstream, so they are no longer carried in ci/strace-patches/:

  • m68k -- restart_syscall-p (824c818b0), prctl-seccomp-filter-v, seccomp-filter-v (both folded into c9ea4e35c): on m68k libc reads the thread pointer via get_thread_area, which polluted attach traces and tripped the seccomp filters.
  • m68k -- net-sockaddr (090b1be72): struct sockaddr_ax25 is 14 bytes on m68k (2-byte int alignment) vs 16 elsewhere.
  • sparc64 -- mmap (bc4934e36): the hardcoded mmap hint address the test passes fell inside the sparc64 VA hole.

Running locally

The ci/ scripts are plain POSIX shell and can be run outside CI, given a host with Buildroot's dependencies and the right paths. For example:

export STRACE_SRC=$PWD/strace BUILDROOT_SRC=$PWD/buildroot OUTPUT_BASE=$PWD/output
./ci/build-buildroot s390x      # toolchain, kernel, rootfs (slow, first time)
./ci/build-strace    s390x      # cross-compile strace + tests
./ci/run-qemu        s390x      # boot under QEMU and run make check

Honored environment variables are documented at the top of each script (STRACE_TESTS, STRACE_SHARD/STRACE_SHARDS, QEMU_TIMEOUT, QEMU_SMP, ...).

License

GPL-2.0-or-later. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages