test: add timens-abs-timer regression test

Add a regression test that exercises the two ABS timer paths in
io_uring with the submitter inside a CLONE_NEWTIME time namespace
that has a -10s monotonic offset:

  - IORING_OP_TIMEOUT with IORING_TIMEOUT_ABS, parsed via
    io_parse_user_time() in io_uring/timeout.c.
  - io_uring_enter with IORING_ENTER_ABS_TIMER, parsed inline in
    io_cqring_wait() in io_uring/wait.c.

The test forks once to enter the new userns, sets up uid_map
and gid_map for unprivileged root, writes the -10s monotonic
offset to /proc/self/timens_offsets, then forks again. The
grandchild is the first process actually inside the new time
namespace (unshare(CLONE_NEWTIME) does not move the caller in,
only its future children). On both ABS timer paths the
grandchild submits an absolute deadline of now + 1s and asserts
the call returns after at least 0.9s.

The test fails on a kernel without commits 9cc6bac1bebf
("io_uring/timeout: honour caller's time namespace for
IORING_TIMEOUT_ABS") and 45d2b37a37ab ("io_uring/wait: honour
caller's time namespace for IORING_ENTER_ABS_TIMER"), where
the deadline is interpreted in host view and the timer fires
after ~1ms.

The test is skipped if the kernel lacks CLONE_NEWTIME support
or the caller cannot create an unprivileged user namespace.

Signed-off-by: Maoyi Xie <maoyi.xie@ntu.edu.sg>
Link: https://patch.msgid.link/20260506135935.2420124-1-maoyixie.tju@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 files changed