]> git.ipfire.org Git - thirdparty/rsync.git/commit
t_stub.c: raise max_alloc default so test helpers can allocate
authorAndrew Tridgell <tridge60@gmail.com>
Wed, 20 May 2026 21:11:30 +0000 (07:11 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Wed, 20 May 2026 21:40:30 +0000 (07:40 +1000)
commitcfdc27c613d74fb981ef1e80d858f7fa61838e9a
treefc173fab132c66d764a5a55212d360989019747a
parent7e7372a0c537d785d1c9d7ef0d87f2a622d488d3
t_stub.c: raise max_alloc default so test helpers can allocate

The t_stub.c shim defined max_alloc = 0 as a placeholder to satisfy
the link against util2.o.  This was harmless when the test helpers
made no allocations, but the secure_relative_open() implementation
in 3.4.0+ calls my_strdup() in its per-component O_NOFOLLOW
fallback (syscall.c around line 1857), and the 3.4.3 do_*_at()
hardening series added more such calls.  With max_alloc=0, every
allocation in that path trips the 'exceeded --max-alloc=0' check in
util2.c's my_alloc(), and t_chmod_secure (which exercises
do_chmod_at via secure_relative_open) fails on the very first
my_strdup.

The failure is invisible on Linux 5.6+ / FreeBSD 13+ / macOS 15+ /
recent Cygwin because those platforms take the kernel-enforced
openat2(RESOLVE_BENEATH) or openat(O_RESOLVE_BENEATH) branch and
never reach the per-component fallback.  It also goes unobserved
on the SunOS/OpenBSD/NetBSD/CYGWIN* CI runners because the
chmod-symlink-race.test script case-skips on those platforms (the
legitimate dir-symlink scenario the test exercises can't pass on
the per-component fallback).  HPE NonStop is the first platform
that lacks RESOLVE_BENEATH support AND isn't in the skip list AND
has someone actually running the test suite, so it surfaced the
latent bug.

Raise max_alloc to SIZE_MAX so the helpers can allocate freely.
A follow-up patch makes t_chmod_secure adapt at runtime so the
skip list can be removed and the per-component fallback gets real
CI coverage.
t_stub.c