[LTP] ima: rewrite ima_mmap auxiliary with TST_NO_DEFAULT_MAIN

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Thu May 7 13:58:03 CEST 2026


Hi Li,

On 2026-05-07, Li Wang wrote:
> ima: rewrite ima_mmap auxiliary with TST_NO_DEFAULT_MAIN

> +#define TST_NO_DEFAULT_MAIN
>  #include "tst_test.h"

> +	tst_reinit();
> +	if (argc != 2)
> +		tst_brk(TBROK, "usage: ima_mmap <filename>");
> +
> +	fd = SAFE_OPEN(argv[1], O_CREAT | O_RDWR, S_IRWXU);
>  	file = SAFE_MMAP(NULL, MMAPSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
>  	SAFE_CLOSE(fd);
> +	/* Waiting until ima_violations.sh open and close file */
>  	TST_CHECKPOINT_WAKE_AND_WAIT(0);
> +	SAFE_MUNMAP(file, MMAPSIZE);
>  	tst_res(TPASS, "test completed");

Correct pattern. Moving tst_reinit() before any framework use and
switching to TST_NO_DEFAULT_MAIN properly fixes the IPC corruption.
The checkpoint handshake inversion between the helper and the shell
script is consistent.

Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>

---
Note:

Our agent completed the review of the patch. The full review can be
found at: (not available)

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