Date: Thu, 25 Jul 2024 23:00:58 GMT From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 2b229739e7ca - main - Avoid division in round_up. Message-ID: <202407252300.46PN0wZr091128@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=2b229739e7ca43b36e53f47147ac05a91333f7b9 commit 2b229739e7ca43b36e53f47147ac05a91333f7b9 Author: John F. Carr <jfc@mit.edu> AuthorDate: 2024-07-25 23:00:28 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407252300.46PN0wZr091128>