Linux Test Project
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Pavithra <pavrampu@linux.ibm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] hugemmap37: migrated task-size-overrun.c from libhugetlbfs v4
Date: Thu,  2 Jul 2026 12:39:31 +0000	[thread overview]
Message-ID: <20260702123931.4104-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260404152742.1664783-1-pavrampu@linux.ibm.com>

Hi Pavithra,

On Sat Apr 4 2026, Pavithra wrote:
> hugemmap37: migrated task-size-overrun.c from libhugetlbfs v4

> +static unsigned long find_last_mapped(void)
> +{
> +	char line[MAPS_BUF_SZ];
> +	...
> +	/* Read all lines and keep the last non-special mapping */
> +	while (fgets(line, MAPS_BUF_SZ, f)) {
> +		/* Skip special mappings like [vsyscall], [vdso], [vvar] */
> +		if (strstr(line, "[vsyscall]") || strstr(line, "[vdso]") ||
> +		    strstr(line, "[vvar]"))
> +			continue;
> +
> +		found = 1;
> +	}
> +	...
> +	tst_res(TINFO, "Last map: %s", line);
> +	if (sscanf(line, "%lx-%lx %*s %lx %*s %ld", &start, &end, &off, &ino) != 4)

The comment says "keep the last non-special mapping" but the code does
not do that.  fgets() overwrites `line` on every iteration, including
iterations that immediately hit the `continue`.  After the loop, `line`
holds the last line read overall, not the last non-special line.

On x86_64 with vsyscall support, [vsyscall] appears as the final entry
in /proc/self/maps at address 0xffffffffff600000.  In that case sscanf
parses that address and find_last_mapped() returns 0xffffffffff601000.
find_task_size() then starts its binary search with a low-PFN value
already above TASK_SIZE, all probe mmaps fail, and an incorrect
TASK_SIZE is returned -- making straddle_addr wrong and the test
results unreliable.

The fix is to copy `line` into a separate buffer when a non-special
line is encountered, and use that saved buffer after the loop.

> +// SPDX-License-Identifier: LGPL-2.1-or-later

Other tests in this directory that were migrated from the same
libhugetlbfs upstream (e.g. hugemmap34.c, which credits the same
original authors) carry GPL-2.0-or-later.  LTP relicenses migrated
code under GPL-2.0-or-later for consistency.

> +/*
> + * Origin: https://github.com/libhugetlbfs/...
> + *
> + * This test verifies the behavior of mmap across the TASK_SIZE boundary.

The high-level description block must open with /*\ (backslash after
the slash-star) so that the LTP documentation build recognises it as
an RST-formatted block and includes it in the test catalog.  A plain
/* comment is silently ignored by the doc toolchain.

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

      reply	other threads:[~2026-07-02 12:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-04 15:27 [LTP] [PATCH] hugemmap37: migrated task-size-overrun.c from libhugetlbfs v4 Pavithra
2026-07-02 12:39 ` linuxtestproject.agent [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260702123931.4104-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=pavrampu@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox