git: f1cf1447e56a - stable/15 - exec: Avoid overflow when computing the size of the exec map
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 06 Aug 2026 15:01:26 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=f1cf1447e56a5998c7e6db1b9668c4da77911be4
commit f1cf1447e56a5998c7e6db1b9668c4da77911be4
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-21 22:30:53 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-08-06 12:52:27 +0000
exec: Avoid overflow when computing the size of the exec map
On a test system with 1024 cores the size of exec map exceeds 4GB, and
all of the operands in the size calculation are 32-bit integers.
Tested by: Jim Huang Chen <jim.chen.1827@gmail.com>
MFC after: 1 week
Sponsored by: AMD (hardware)
(cherry picked from commit 2efe148a2a321d4c9ed46bdb166f710b2cb21529)
---
sys/vm/vm_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/vm/vm_init.c b/sys/vm/vm_init.c
index 99eb3b4a57af..d81fab854199 100644
--- a/sys/vm/vm_init.c
+++ b/sys/vm/vm_init.c
@@ -276,7 +276,7 @@ again:
exec_map_entry_size = round_page(PATH_MAX + ARG_MAX);
exec_map_guard_pages = 1;
TUNABLE_INT_FETCH("vm.exec_map_guard_pages", &exec_map_guard_pages);
- size = exec_map_entries *
+ size = (vm_size_t)exec_map_entries *
(exec_map_entry_size + 2 * ptoa(exec_map_guard_pages)) +
64 * PAGE_SIZE;
kmem_subinit(exec_map, kernel_map, &minaddr, &maxaddr, size, false);