The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=2b229739e7ca43b36e53f47147ac05a91333f7b9
commit 2b229739e7ca43b36e53f47147ac05a91333f7b9 Author: John F. Carr <[email protected]> AuthorDate: 2024-07-25 23:00:28 +0000 Commit: Brooks Davis <[email protected]> CommitDate: 2024-07-25 23:00:28 +0000 Avoid division in round_up. Division may require a function call, leading to dynamic function lookup, leading to deadlock in rtld. Pull Request: https://github.com/freebsd/freebsd-src/pull/1343 --- 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 f576a2c04104..ab3b73085bb5 100644 --- a/lib/libthr/thread/thr_stack.c +++ b/lib/libthr/thread/thr_stack.c @@ -126,10 +126,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 - 1)); } void
