Re: hugemmap43: Migrate truncate_sigbus_versus_oom from libhugetlbfs

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

On Thu, Aug 20, 2026, Samir Mulani wrote:
> hugemmap43: Migrate truncate_sigbus_versus_oom from libhugetlbfs

> 	/* SIGBUS is what *should* happen */
> 	SAFE_FTRUNCATE(fdx, 0);
> 	if (sigsetjmp(sig_escape, 1) == 0)
> 		*((volatile unsigned int *)p);

Why is fdx truncated before faulting p? The original test keeps q
instantiated so that the hugepage pool remains exhausted. On a kernel
without ebed4bfc8da8, exhausting the pool makes allocation fail before the
missing i_size check, causing SIGKILL instead of SIGBUS.

Could this truncate be removed or moved after the fault? As written, it
releases the pages and no longer exercises the SIGBUS-versus-OOM regression
described by the commit message and test documentation.

> /*\
>  * Some kernels have a bug in the positioning of the test against
>  * i_size. This bug means that attempting to instantiate a page
>  * beyond the end of a hugepage file can result in an OOM and SIGKILL
>  * instead of the correct SIGBUS.
>  */
> [...]
> 	.needs_root = 1,

Could the description explain why root is required? LTP requires tests with
.needs_root to document the reason for the privilege requirement.

> +/hugetlb/hugemmap/hugemmap43

Could the binary instead be added to a .gitignore in the hugemmap directory?
LTP requires new test binaries to be ignored in their leaf test directory.

> 	SAFE_CLOSE(fd);
> 	SAFE_CLOSE(fdx);
> 	fd = -1;
> 	fdx = -1;

Could the explicit assignments be removed? SAFE_CLOSE() already sets each
descriptor argument to -1, and LTP's C test rules prohibit resetting it
manually.

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.