Skip to contentSkip to conversation

+ proc-fix-proc-empty-vm-test-with-vsyscall.patch added to mm-nonmm-unstable branch

DISCUSSION swarup 1 participant 1 message Oct 30, 2023 1 message not in the archive

lore
Share & tools
lore

swarup

author Tested-by Swarup Laxman Kotikalapudi
#1 lore raw
In reply to a message not in the archive
Quoted 101 lines · Andrew Morton

The patch titled
Subject: proc: fix proc-empty-vm test with vsyscall
has been added to the -mm mm-nonmm-unstable branch. Its filename is
proc-fix-proc-empty-vm-test-with-vsyscall.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/proc-fix-proc-empty-vm-test-with-vsyscall.patch

This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Alexey Dobriyan <[email protected]>
Subject: proc: fix proc-empty-vm test with vsyscall
Date: Fri, 27 Oct 2023 17:21:03 +0300

* fix embarassing /proc/*/smaps test bug due to a typo in variable name it tested only the first line of the output if vsyscall is enabled:

ffffffffff600000-ffffffffff601000 r-xp ...

so test passed but tested only VMA location and permissions.

* add "KSM" entry, unnoticed because (1)

* swap "r-xp" and "--xp" vsyscall test strings,
also unnoticed because (1)

---

 tools/testing/selftests/proc/proc-empty-vm.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
tools/testing/selftests/proc/proc-empty-vm.c renamed from tools/testing/selftests/proc/proc-empty-vm.c~proc-fix-proc-empty-vm-test-with-vsyscall +6 -4
@@ -60,7 +60,7 @@ static const char proc_pid_maps_vsyscall
 static const char proc_pid_smaps_vsyscall_0[] = "";
 
 static const char proc_pid_smaps_vsyscall_1[] =
-"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]\n"
+"ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0                  [vsyscall]\n"
 "Size:                  4 kB\n"
 "KernelPageSize:        4 kB\n"
 "MMUPageSize:           4 kB\n"
@@ -73,6 +73,7 @@ static const char proc_pid_smaps_vsyscal
 "Private_Dirty:         0 kB\n"
 "Referenced:            0 kB\n"
 "Anonymous:             0 kB\n"
+"KSM:                   0 kB\n"
 "LazyFree:              0 kB\n"
 "AnonHugePages:         0 kB\n"
 "ShmemPmdMapped:        0 kB\n"
@@ -90,7 +91,7 @@ static const char proc_pid_smaps_vsyscal
 ;
 
 static const char proc_pid_smaps_vsyscall_2[] =
-"ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0                  [vsyscall]\n"
+"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]\n"
 "Size:                  4 kB\n"
 "KernelPageSize:        4 kB\n"
 "MMUPageSize:           4 kB\n"
@@ -103,6 +104,7 @@ static const char proc_pid_smaps_vsyscal
 "Private_Dirty:         0 kB\n"
 "Referenced:            0 kB\n"
 "Anonymous:             0 kB\n"
+"KSM:                   0 kB\n"
 "LazyFree:              0 kB\n"
 "AnonHugePages:         0 kB\n"
 "ShmemPmdMapped:        0 kB\n"
@@ -244,10 +246,10 @@ static int test_proc_pid_smaps(pid_t pid
 		if (g_vsyscall == 0) {
 			assert(rv == 0);
 		} else {
-			size_t len = strlen(g_proc_pid_maps_vsyscall);
+			size_t len = strlen(g_proc_pid_smaps_vsyscall);
 			/* TODO "ProtectionKey:" */
 			assert(rv > len);
-			assert(memcmp(buf, g_proc_pid_maps_vsyscall, len) == 0);
+			assert(memcmp(buf, g_proc_pid_smaps_vsyscall, len) == 0);
 		}
 		return EXIT_SUCCESS;
 	}

_

Quoted 4 lines

Patches currently in -mm which might be from [email protected] are

proc-fix-proc-empty-vm-test-with-vsyscall.patch

Hi Alexey Dobriyan,
I reviewed and tested it seems to working fine.
Thanks,
Swarup