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

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Wed Aug 12 17:01:16 CEST 2026


Hi Jan,

On Aug 12, 2026, Jan Polensky wrote:
> thp04: group runtime state and skip when /proc/self/mem writes are blocked

--- [PATCH 1/3] ---

> +	SAFE_MPROTECT((void *)state->write_thp, state->thp_size, PROT_READ);
> [...]
> +	*state->write_ptr = 0;

Could the mapping be made writable again before this direct store, or could
the value be reset through /proc/self/mem? At this point write_ptr points
inside a PROT_READ mapping, so a successful probe is followed by SIGSEGV in
setup() and the test never runs.

--- [PATCH 2/3] ---

> +	if (TST_RET == sizeof(test_val)) {
> +		tst_res(TFAIL,
> +			"Write to /proc/self/mem succeeded under CONFIG_PROC_MEM_FORCE_PTRACE=y");

Could this successful write report TCONF, as described in the commit
message? The proc_mem.force_override=always boot parameter overrides the
Kconfig default, so .needs_kconfigs does not prove that the ptrace policy is
active at runtime. A successful write is therefore valid on that boot and
must not produce TFAIL.

--- [PATCH 3/3] ---

> +	TST_CHECKPOINT_WAKE(1);
> +	SAFE_PTRACE(PTRACE_INTERRUPT, tracee_pid, NULL, NULL);
> +	SAFE_WAITPID(tracee_pid, &status, 0);

Could checkpoint 1 remain blocked until after PTRACE_INTERRUPT has produced
the initial stop? The child can currently check the initial zero value and
raise(SIGSTOP) before the interrupt takes effect. If the wait observes that
stop, every write is checked one iteration late; after the final write the
child reaches pause() without checking or stopping, and the parent hangs in
SAFE_WAITPID().

> +		SAFE_WRITE(SAFE_WRITE_ALL, memfd, &write_val, sizeof(write_val));

Could this write be probed explicitly and EIO handled as TCONF? The released
kernel permits proc_mem.force_override=never to override
CONFIG_PROC_MEM_FORCE_PTRACE. On that valid boot, FOLL_FORCE remains disabled
even for an active tracer and SAFE_WRITE() aborts the test as TBROK.

> +			tracee_pid = 0;

Could the trailing whitespace on the following blank line be removed? It
causes git diff --check to fail.

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


More information about the ltp mailing list