diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-07-21 22:30:53 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-07-22 00:10:04 +0000 |
| commit | 2efe148a2a321d4c9ed46bdb166f710b2cb21529 (patch) | |
| tree | ffb77758e50a85edc29227f86296e0d2678801d0 | |
| parent | f42c68291d6803abc404fa8d6915a9f5de3a3448 (diff) | |
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)
| -rw-r--r-- | sys/vm/vm_init.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |
