Skip to contentSkip to conversation

hugemmap/hugemmap41: Migrate ptrace-write-hugepage from libhugetlbfs

PATCH Superseded Pavithra 2 participants 2 messages Aug 8

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Pavithra

author
#0 lore raw

PATCH v5 1/1 hugemmap/hugemmap41: Migrate ptrace-write-hugepage from libhugetlbfs

This test verifies that ptrace POKEDATA and PEEKDATA operations work correctly on hugepage-backed memory regions. Migrating it to LTP as libhugetlbfs is not actively maintained.

---
v4 -> v5:
- Replace ptrace PTRACE_POKEDATA and PTRACE_ATTACH calls with SAFE_PTRACE().
- Use TST_EXP_EQ_LI() to verify peeked memory values.
- Replace TST_PROCESS_STATE_WAIT() with SAFE_WAITPID() and WIFSTOPPED() check.
- Simplify SAFE_CLOSE() cleanup logic and remove redundant comments.
- Reduce required hugepages from 4 to 1.
link to v1: https://lore.kernel.org/ltp/[email protected]/

---
 runtest/hugetlb                               |   1 +
 testcases/kernel/mem/.gitignore               |   1 +
 .../kernel/mem/hugetlb/hugemmap/hugemmap41.c  | 136 ++++++++++++++++++
 3 files changed, 138 insertions(+)
 create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap41.c
runtest/hugetlb +1 -0
index 6b35c1f42..621c9718a 100644
@@ -40,6 +40,7 @@ hugemmap35 hugemmap35
 hugemmap36 hugemmap36
 hugemmap37 hugemmap37
 hugemmap38 hugemmap38
+hugemmap41 hugemmap41
 hugemmap05_1 hugemmap05 -m
 hugemmap05_2 hugemmap05 -s
 hugemmap05_3 hugemmap05 -s -m
testcases/kernel/mem/.gitignore +1 -0
index e63a6dde7..9e706e1c8 100644
@@ -40,6 +40,7 @@
 /hugetlb/hugemmap/hugemmap36
 /hugetlb/hugemmap/hugemmap37
 /hugetlb/hugemmap/hugemmap38
+/hugetlb/hugemmap/hugemmap41
 /hugetlb/hugeshmat/hugeshmat01
 /hugetlb/hugeshmat/hugeshmat02
 /hugetlb/hugeshmat/hugeshmat03
testcases/kernel/mem/hugetlb/hugemmap/hugemmap41.c new file +136 -0

136 lines not on this page · raw message

Signature · 5 lines
2.55.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Pavithra,

testcases/kernel/mem/hugetlb/hugemmap/hugemmap41.c line 68

Quoted 5 lines · Pavithra

hugemmap/hugemmap41: Migrate ptrace-write-hugepage from libhugetlbfs

testcases/kernel/mem/hugetlb/hugemmap/hugemmap41.c new file +2 -0
+#define CONST	0xdeadbeefL
[...]
+	TST_EXP_EQ_LI(TST_RET, CONST);

Could this comparison preserve unsigned-long semantics? On 32-bit targets, CONST is an unsigned long, while PTRACE_PEEKDATA returns the same bit pattern as a negative signed long. TST_EXP_EQ_LI() converts them separately to signed long long, producing -559038737 and 3735928559, so every successful peek is reported as TFAIL.

Quoted 1 line

+/hugetlb/hugemmap/hugemmap41

Could this entry be placed in a .gitignore under testcases/kernel/mem/hugetlb/hugemmap/? New test binaries should be ignored in their own test directory rather than in a parent .gitignore.

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

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp