Skip to content

Add syscall coverage audit and direct-syscall smoke suite#32

Merged
jserv merged 1 commit into
mainfrom
refine
May 14, 2026
Merged

Add syscall coverage audit and direct-syscall smoke suite#32
jserv merged 1 commit into
mainfrom
refine

Conversation

@jserv
Copy link
Copy Markdown
Contributor

@jserv jserv commented May 14, 2026

scripts/check-syscall-coverage.py parses src/syscall/dispatch.tbl and scans tests/ for direct or aliased references to every entry. C sources are matched on call-shape (name followed by an opening paren) or the SYS_/_NR macro forms; non-C sources require the explicit macro form so that coreutils applet invocations in the shell suites (run sync 0, run kill ..., run chroot ...) cannot falsely cover the like-named syscalls. ALIASES maps the pread64/pwrite64 dispatch names to the pread/pwrite libc wrappers; INDIRECT_COVERAGE documents the xattr family, rt_sig{return,suspend,pending}, ptrace, chroot, truncate, exit_group, and get_robust_list, which are exercised only through structural or out-of-band paths. mk/tests.mk runs the script as a check-syscall-coverage target that make check depends on.

src/syscall/syscall.c::sc_memfd_create rejects a NULL name pointer with EFAULT, probes the first byte of the guest pointer to surface EFAULT before the temp file is created, and reads the flag bits through named LINUX_MFD_CLOEXEC and LINUX_MFD_ALLOW_SEALING constants in src/syscall/abi.h instead of the prior raw bitmask arithmetic. Unknown MFD_* bits continue to be accepted silently to match the behavior the existing fd-lifecycle tests expect.


Summary by cubic

Adds a syscall coverage audit and a direct-syscall smoke suite, and wires both into the test workflow. Also tightens memfd_create error handling and flags, and streamlines the coreutils tests.

  • New Features

    • scripts/check-syscall-coverage.py audits src/syscall/dispatch.tbl against tests and runs via make check (check-syscall-coverage).
    • New tests/test-syscall-smoke.c covers less-common syscalls (e.g., pwrite64/preadv2, splice/vmsplice, close_range, execveat, waitid, accept4, SysV semaphores) plus expected stub errnos.
    • Low-base ET_EXEC memory regression tests (test-lowbase-mem-200000, -300000); Makefile builds non-PIE binaries to exercise old guard windows.
    • Coreutils suite modularized into tests/lib/coreutils-suite.sh with smoke/full profiles; unified static and dynamic runners; removed tests/test-coreutils-smoke.sh.
    • Test driver now auto-detects when to fail on missing binaries (default in-repo) or skip (external bins), and adds host-side assertion helpers; new coreutils_* asserts for file checks.
    • fd-lifecycle suite extended to verify memfd_create accepts valid Linux flags (e.g., MFD_HUGETLB).
  • Bug Fixes

    • sc_memfd_create rejects NULL name with EFAULT, validates the first byte of the guest pointer before creating the temp file, and reads flags via LINUX_MFD_CLOEXEC/LINUX_MFD_ALLOW_SEALING (unknown bits remain accepted to preserve existing test expectations).

Written for commit 684654f. Summary will update on new commits.

cubic-dev-ai[bot]

This comment was marked as resolved.

scripts/check-syscall-coverage.py parses src/syscall/dispatch.tbl and
scans tests/ for direct or aliased references to every entry. C
sources are matched on call-shape (name followed by an opening paren)
or the SYS_/__NR_ macro forms; non-C sources require the explicit
macro form so that coreutils applet invocations in the shell suites
(run sync 0, run kill ..., run chroot ...) cannot falsely cover the
like-named syscalls. ALIASES maps the pread64/pwrite64 dispatch names
to the pread/pwrite libc wrappers; INDIRECT_COVERAGE documents the
xattr family, rt_sig{return,suspend,pending}, ptrace, chroot,
truncate, exit_group, and get_robust_list, which are exercised only
through structural or out-of-band paths. mk/tests.mk runs the script
as a check-syscall-coverage target that make check depends on.

src/syscall/syscall.c::sc_memfd_create rejects a NULL name pointer
with EFAULT, probes the first byte of the guest pointer to surface
EFAULT before the temp file is created, and reads the flag bits
through named LINUX_MFD_CLOEXEC and LINUX_MFD_ALLOW_SEALING constants
in src/syscall/abi.h instead of the prior raw bitmask arithmetic.
Unknown MFD_* bits continue to be accepted silently to match the
behavior the existing fd-lifecycle tests expect.
@jserv jserv merged commit 0bc192d into main May 14, 2026
4 checks passed
@jserv jserv deleted the refine branch May 14, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant