[LTP] thp04: group runtime state and skip when /proc/self/mem writes are blocked

Jan Polensky japo@linux.ibm.com
Mon Sep 14 13:03:44 CEST 2026


On Tue, Sep 08, 2026 at 06:26:29PM +0000, linuxtestproject.agent@gmail.com wrote:
> Hi Jan,
>
> On Tue Sep 8 18:54:28 2026 +0200, Jan Polensky <japo@linux.ibm.com> wrote:
> > thp04: group runtime state and skip when /proc/self/mem writes are blocked
>
> --- [PATCH 3/3] ---
>
> > +	for (i = 0; i < TEST_ITERATIONS; i++) {
> > +		if (*shared->test_ptr != shared->expected_val) {
> > +			tst_res(TFAIL,
> > +				"Iteration %d: expected 0x%x, got 0x%x",
> > +				i, shared->expected_val, *shared->test_ptr);
> > +			exit(1);
> > +		}
> > +
> > +		if (i < TEST_ITERATIONS - 1)
> > +			raise(SIGSTOP);
> > +	}
>
> The condition i < TEST_ITERATIONS - 1 prevents the tracee from stopping on
> the last iteration, causing it to exit immediately. The parent's waitpid
> sees WIFEXITED and aborts with tst_brk(TBROK). Call raise(SIGSTOP)
> unconditionally on all iterations.
>
> > +static void run(void)
> > +{
> > +	char path[64];
>
> Do not use a custom buffer size for filesystem paths. Use PATH_MAX from
> <limits.h>.
>
> Verdict - Needs revision
>
> ---
> Note:
>
> The agent can sometimes produce false positives although often its
> findings are genuine. If you find issues with the review, please
> comment this email or ignore the suggestions.
>
> Regards,
> LTP AI Reviewer

Hi there,

Finding 1 — raise(SIGSTOP) on last iteration: false positive
The condition if (i < TEST_ITERATIONS - 1) raise(SIGSTOP) in ptrace13.c
is intentional and correct. The parent's waitpid after PTRACE_CONT on
the last iteration explicitly handles WIFEXITED as a valid terminal
condition, the child exits via exit(0) and the parent falls through to
TPASS. Making the stop unconditional would cause the child to stop on the
last iteration, at which point the parent would send PTRACE_DETACH +
SIGTERM to a stopped tracee, which is the actual bug, not the fix.

Finding 2 — PATH_MAX: accepted and applied
The char path[64] suggestion is valid.

Best Regards
Jan


More information about the ltp mailing list