git: 15ee14d0f7d0 - stable/14 - rtld: avoid division in __thr_map_stacks_exec()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 05 Aug 2024 00:32:43 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=15ee14d0f7d0d8af7e12f16be7fe5b3fa5b2e5de

commit 15ee14d0f7d0d8af7e12f16be7fe5b3fa5b2e5de
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-07-24 10:17:55 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-08-05 00:32:11 +0000

    rtld: avoid division in __thr_map_stacks_exec()
    
    (cherry picked from commit 31f688a26d82ce00d1ec7ca9ed17b9914bf5176f)
---
 lib/libthr/thread/thr_stack.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/libthr/thread/thr_stack.c b/lib/libthr/thread/thr_stack.c
index 5e888bbfe9b6..68a658a1ddfd 100644
--- a/lib/libthr/thread/thr_stack.c
+++ b/lib/libthr/thread/thr_stack.c
@@ -127,10 +127,7 @@ static char *last_stack = NULL;
 static inline size_t
 round_up(size_t size)
 {
-	if (size % _thr_page_size != 0)
-		size = ((size / _thr_page_size) + 1) *
-		    _thr_page_size;
-	return size;
+	return (roundup2(size, _thr_page_size));
 }
 
 void