Re: hugemmap36: Migrating the libhugetlbfs/testcases/truncate_above_4GB.c test v6

[email protected]
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
Hi Pavithra,

On Sat, 04 Apr 2026, Pavithra <[email protected]> wrote:
> hugemmap36: Migrating the libhugetlbfs/testcases/truncate_above_4GB.c test v6

The "v6" revision tag belongs in the email subject only, not in the
committed subject line. The subject should also use imperative mood:

  hugemmap36: Migrate the libhugetlbfs/testcases/truncate_above_4GB.c test

> +static void sigbus_handler_fail(int signum LTP_ATTRIBUTE_UNUSED,
> +				siginfo_t *si LTP_ATTRIBUTE_UNUSED,
> +				void *uc LTP_ATTRIBUTE_UNUSED)
> +{
> +	siglongjmp(sig_escape, 17);
> +}

This handler does not record the unexpected SIGBUS in any way. The
caller uses it here:

> +	SAFE_SIGACTION(SIGBUS, &sa_fail, NULL);
> +	if (sigsetjmp(sig_escape, 1) == 0)
> +		if (*pi != 1) {
> +			tst_res(TFAIL, "Data 1 has changed!");
> +			goto cleanup;
> +		}

If SIGBUS fires on `*pi` - which is exactly the kernel bug being tested
(the low-offset page was incorrectly truncated) - siglongjmp returns 17,
so `sigsetjmp(...) == 0` is false, the TFAIL block is skipped entirely,
and execution falls through.

The code then reaches the sa_pass / `*qi` block, `*qi` triggers SIGBUS,
test_pass is set to 1, and the test reports TPASS. The test passes when
the kernel bug is present.

sigbus_handler_fail needs to set a flag (e.g. test_pass = -1) so that
after the first sigsetjmp block the caller can detect the unexpected
SIGBUS and report TFAIL before proceeding.

> + * Test for a bug where truncating hugepage files at offsets >= 4GB on
> + * 32-bit systems could incorrectly truncate lower pages due to a
> + * misconversion of hugetlb_vmtruncate_list to a prio_tree.
...
> +	.needs_root = 1,

The doc-comment block does not explain why root is required. Ground
Rule 4 requires that the reason be stated there.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.