git: 2efe148a2a32 - main - exec: Avoid overflow when computing the size of the exec map
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Jul 2026 00:15:50 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=2efe148a2a321d4c9ed46bdb166f710b2cb21529
commit 2efe148a2a321d4c9ed46bdb166f710b2cb21529
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-21 22:30:53 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-22 00:10:04 +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)
---
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 316b43c1c240..85c425455ddb 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);