[LTP] Migrating the libhugetlbfs/testcases/alloc-instantiate-race.c test

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Mon May 4 16:07:41 CEST 2026


Hi Samir,

On 2026-05-04, Samir <samir@linux.ibm.com> wrote:
> Migrating the libhugetlbfs/testcases/alloc-instantiate-race.c test

> Signed-off-by: Samir <samir@linux.ibm.com>
> v3: https://lore.kernel.org/all/20250928030721.3537869-1-samir@linux.ibm.com/
> v4: https://lore.kernel.org/ltp/20260317095559.5766-1-samir@linux.ibm.com/
>
> LTP Github CI link: https://github.com/linux-test-project/ltp/pull/1313
> All the checks are passed

Version history references should use the `Link:` tag:

  Link: https://lore.kernel.org/ltp/20260317095559.5766-1-samir@linux.ibm.com/

The `LTP Github CI link:` line and `All the checks are passed` are
free text appearing after `Signed-off-by:` and must be removed.

[...]

> +/*
> + * Copyright (C) 2005-2006 IBM Corporation
> + * Author: David Gibson & Adam Litke
> + */

New file must include the year it was added. Add 2026 to the copyright
range.

> +/*
> + * This test is designed to detect a kernel allocation race introduced

The doc block must open with `/*\` (not `/*`) for LTP's RST toolchain.

[...]

> +#include "tst_safe_pthread.h"
> +#include "hugetlb.h"

Add `#include "tst_test.h"` explicitly, as done in the rest of this
directory.

[...]

> +static int child1, child2, race_type, fd_sync;

`fd_sync` zero-initializes to 0 (stdin). `cleanup()` checks
`if (fd_sync >= 0)` and would close stdin if called before `run_test()`.
Also, after `run_test()` calls `SAFE_CLOSE(fd_sync)` without resetting
it to -1, `cleanup()` double-closes the same fd on the normal exit path.
Initialize `fd_sync = -1` and reset it to -1 after each close.

[...]

Pre-existing issues noticed in the surrounding code (not introduced
by this patch):

- run_test(): local `p_sync` (MMAP) is not reachable from cleanup(); leaks if tst_brk() fires inside run_race().
- run_race(): local `fd` and `p` are not reachable from cleanup(); same concern.

---
Note:

Our agent completed the review of the patch. 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