From: linuxtestproject.agent@gmail.com
To: Pavithra <pavrampu@linux.ibm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] hugemmap/hugemmap41: Migrate ptrace-write-hugepage from libhugetlbfs
Date: Fri, 17 Jul 2026 11:28:28 +0000 [thread overview]
Message-ID: <20260717112829.4056-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260717110234.1070268-1-pavrampu@linux.ibm.com>
Hi Pavithra,
On Fri, 17 Jul 2026 16:32:34 +0530, Pavithra wrote:
> hugemmap/hugemmap41: Migrate ptrace-write-hugepage from libhugetlbfs
> This test verifies that ptrace POKEDATA and PEEKDATA operations work
> correctly on hugepage-backed memory regions.
The commit body describes what the test does but does not say why the
migration from libhugetlbfs is happening. What is the motivation?
(e.g. libhugetlbfs is deprecated and tests are being consolidated into
LTP.) The rule requires the body to state the motivation or the problem
being solved.
> + err = ptrace(PTRACE_ATTACH, cpid, NULL, NULL);
> + if (err)
> + tst_brk(TFAIL | TERRNO, "ptrace(ATTACH) failed");
PTRACE_ATTACH is a setup step, not the operation under test. A failure
here means the test could not be set up, which should be TBROK, not
TFAIL. TFAIL implies the hugepage ptrace feature is broken, which is
misleading when the real cause is, for example, a restrictive
ptrace_scope.
The doc block already notes: "for ptrace(PTRACE_ATTACH) to work across
processes when ptrace_scope is restrictive." At ptrace_scope=3, even
root gets EPERM, and the correct response is TCONF, not TFAIL.
Consider:
SAFE_PTRACE(PTRACE_ATTACH, cpid, NULL, NULL);
or, to handle the ptrace_scope case explicitly:
if (ptrace(PTRACE_ATTACH, cpid, NULL, NULL)) {
if (errno == EPERM)
tst_brk(TCONF | TERRNO, "ptrace(ATTACH) not permitted");
tst_brk(TBROK | TERRNO, "ptrace(ATTACH) failed");
}
> + err = ptrace(PTRACE_POKEDATA, pid, p, (void *)CONST);
> + if (err)
> + tst_brk(TFAIL | TERRNO, "ptrace(POKEDATA) failed");
> +
> + tst_res(TINFO, "Peeking at %p...", p);
> + errno = 0;
> + err = ptrace(PTRACE_PEEKDATA, pid, p, NULL);
> + if (err == -1 && errno)
> + tst_brk(TFAIL | TERRNO, "ptrace(PEEKDATA) failed");
PTRACE_POKEDATA and PTRACE_PEEKDATA are the syscalls under test and
must not be called bare. The rule requires subject syscalls to be
wrapped in TEST() or TST_EXP_*. SAFE_PTRACE cannot be used for
PEEKDATA (it treats any non-zero return as error, but PEEKDATA returns
arbitrary data), so TEST() is the right wrapper for both. Example:
TEST(ptrace(PTRACE_POKEDATA, pid, p, (void *)CONST));
if (TST_RET != 0)
tst_brk(TFAIL | TTERRNO, "ptrace(POKEDATA) failed");
errno = 0;
TEST(ptrace(PTRACE_PEEKDATA, pid, p, NULL));
if (TST_RET == -1 && TST_ERR)
tst_brk(TFAIL | TTERRNO, "ptrace(PEEKDATA) failed");
> + pause();
> + /* Child is killed by parent via PTRACE_KILL, so cleanup is not reached */
The comment says PTRACE_KILL, but the parent uses SAFE_KILL(cpid,
SIGKILL). PTRACE_KILL is a deprecated ptrace request, not what is
used here. The comment is factually wrong.
> + * This test verifies that ptrace POKEDATA and PEEKDATA work correctly
> + * on hugepage-backed memory regions. A child process maps a hugepage,
> + * and the parent uses ptrace to write and read data from the child's
> + * hugepage memory, ensuring that ptrace operations function properly
> + * with hugepage mappings.
The doc block references the ptrace syscall without the required
manpage RST role. Use :manpage:`ptrace(2)` when referring to a syscall
in a /*\ ... */ block.
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
next prev parent reply other threads:[~2026-07-17 11:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 11:02 [LTP] [PATCH] hugemmap/hugemmap41: Migrate ptrace-write-hugepage from libhugetlbfs Pavithra
2026-07-17 11:28 ` linuxtestproject.agent [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-07-17 18:05 Pavithra
2026-07-17 19:13 ` [LTP] " linuxtestproject.agent
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=20260717112829.4056-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.