Skip to contentSkip to conversation

cve/cve-2015-3290: Correct the length parameter for perf munmap

PATCH In review Tengda Wu 2 participants 2 messages Sep 8, 2025

lore
Share & tools
lore

Tengda Wu

author
#0 lore raw

PATCH 1/1 cve/cve-2015-3290: Correct the length parameter for perf munmap

Since commit b024d7b56c77 in the Linux kernel, the perf munmap operation no longer allows VMA splits. However, in the cve-2015-3290 test case, the length parameters passed to mmap and munmap were different:

* The length for mmap was event_mlock_kb * 1024, where event_mlock_kb is typically 516.
* The length for munmap was hardcoded to 512 * 1024.

This discrepancy caused the munmap operation to attempt to split a VMA due to unaligned range boundaries, which resulted in it returning -EINVAL and consequently caused the test case to fail.

Fix this by correcting the length parameter for the perf munmap call to event_mlock_kb * 1024.

---
 testcases/cve/cve-2015-3290.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/cve/cve-2015-3290.c +1 -1
index e70742acc..cb60582b4 100644
@@ -415,7 +415,7 @@ static void *child_thread(void *arg)
 
 	for (i = 0; i < ARRAY_SIZE(perf_events); i++)
 		if (perf_mmaps[i] != MAP_FAILED)
-			SAFE_MUNMAP(perf_mmaps[i], 512 * 1024);
+			SAFE_MUNMAP(perf_mmaps[i], event_mlock_kb * 1024);
 
 	return (void *)niter;
 }
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp