Skip to contentSkip to conversation

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

PATCH Superseded Pavithra 2 participants 2 messages Aug 8

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Pavithra

author
#0 lore raw

PATCH v6 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.

---
v5 -> v6:
- Use TST_EXP_EQ_LU((unsigned long)TST_RET, CONST) instead of TST_EXP_EQ_LI() to preserve unsigned long semantics and prevent sign-extension failure on 32-bit targets. link to v5: 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,

Quoted 3 lines · Pavithra

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

+/hugetlb/hugemmap/hugemmap41

Could this entry be placed in testcases/kernel/mem/hugetlb/hugemmap/.gitignore as /hugemmap41 instead? New test binaries should be ignored in their leaf test directory rather than extending the legacy testcases/kernel/mem/.gitignore list.

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

Quoted 1 line
testcases/kernel/mem/hugetlb/hugemmap/hugemmap41.c new file +1 -0
+	p = SAFE_MMAP(NULL, hpage_size, PROT_READ|PROT_WRITE, MAP_SHARED,

Could spaces be added around the "|" operator? make check-hugemmap41 reports this line as a kernel style violation.

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

Quoted 10 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap41.c new file +8 -0
+	TST_EXP_EQ_LU((unsigned long)TST_RET, CONST);
+}
+
+static void run_test(void)
+{
[...]
+	do_poke(cpid, p);
+	do_poke(cpid, p + getpagesize());
[...]
+	tst_res(TPASS, "ptrace write to hugepage succeeded");

Could the unconditional TPASS be removed? If either equality check reports a mismatch, this line still claims that the operation succeeded. The two TST_EXP_EQ_LU() calls already report their own pass results.

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

Quoted 4 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap41.c new file +4 -0
+	.tags = (struct tst_tag[]) {
+		{"linux-git", "ebed4bfc8da8"},
+		{}
+	},

Which ptrace regression is this tag intended to identify? ebed4bfc8da8 is "hugetlb: fix absurd HugePages_Rsvd", which fixes reservation accounting after truncating a mapped hugetlbfs file. This test neither truncates the file nor checks HugePages_Rsvd, so a failure would print an unrelated missing-fix hint.

Could the tag be removed, or replaced with the full 40-character hash of the actual ptrace/hugetlb fix?

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