From nobody Mon Jul 29 23:59:00 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WXwLY0gRZz5SFLc; Mon, 29 Jul 2024 23:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WXwLX4dMSz4DHp; Mon, 29 Jul 2024 23:59:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722297540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rHBRm36qwmdeWd6Rs9D8zd4Z57qUqUVUQbEpczZ4ECw=; b=X/k6VNx4Cp85qws8MGWvQNPpShctIAH9wVjkYL4mrtBMROqhOJLxu6TtuQOz/pSL4/E67v l7m3mbct+jnCGZaTdydMGUTMOqgbXeJ0pLzKpUs/F622sKaEd7fSy7KtP58ywUEJRnCFm5 c94a0o2BfkQKx/w4nMfIR5SDZlqZM1fzkw/9aUKSoWXZo6tyjfLl6MooCplDkuODVjQiG1 Ut9g3Gbdb6exAos8zA8N9sLF5ykNRTC9dI1DKbei6nPL6Xzo9SMNbKFilLDOtBOB/j+3D3 Ji2vD6kZvKxiaEGBw9BndWxrlFBS871/cLmOSU+91Mm4a5f4K7QeBNw2jKRdHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722297540; a=rsa-sha256; cv=none; b=k92DMBm6AC30/uYDvM3/E+RriEZ1L//Xb+3JGd7oaZqZ49oYMUknk6OWrP9uMD6RgeBKgP 9nVKBTZH1xAB3nrsZ1lQ44r06z57IhCukZsO02WEj2lgexBQCvbvBO+kdPXhrH7ErvWxuO fkx7qitR36+7G9URvVeT362xjTFsOrUEj/FVVpsXK+3P+Ahp9JnkpUixzn1FeZPFTtCmzg cnTfuNYuCa2bEkCBIBevZoxesh8vCG76Iiwc8FVgJVlEfBc8folYnKsoK6yk73YPgDB6M0 LxF6JAffuGmhOZCJPAHIZdru1bHo0hDNOwRQm2PpsTu069dxY1TkFpX07D6+zg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722297540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rHBRm36qwmdeWd6Rs9D8zd4Z57qUqUVUQbEpczZ4ECw=; b=r5RcOYdeSeJ16FW4vAVX9A3Lbnrw/Yg/d1hTKL7feuOzHOtgoY2U1xS1oO1ZmCBLX2DtcN /LDmvKUjQKNG+QLpMusTIlO7VIwsyRnCaUH17VNUqQZWcoeysdJx6A+13Gi7DPwnzhv/5K S60D2vXV+ZH+1qhk9ykju7rB+2eLl0CZ2mjDn/LOR1wAvHe8Gd/vjbQ5NlJywzDBT3syaP P1qPZCqg19MTJBE10xOaIpziRhYLR9goox3WDD/PyrKHA09nIKndQAzXLZfmKNv2sTwkHK +vsO/dh+45cR/wfNYI1B/Urqo5lYek8Jcs3n+hwvbGdK5iFJyUdF5FJVi+ZzFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WXwLX4FsPzvC9; Mon, 29 Jul 2024 23:59:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46TNx0jg051763; Mon, 29 Jul 2024 23:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46TNx0Ol051760; Mon, 29 Jul 2024 23:59:00 GMT (envelope-from git) Date: Mon, 29 Jul 2024 23:59:00 GMT Message-Id: <202407292359.46TNx0Ol051760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 31f688a26d82 - main - rtld: avoid division in __thr_map_stacks_exec() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31f688a26d82ce00d1ec7ca9ed17b9914bf5176f Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=31f688a26d82ce00d1ec7ca9ed17b9914bf5176f commit 31f688a26d82ce00d1ec7ca9ed17b9914bf5176f Author: Konstantin Belousov AuthorDate: 2024-07-24 10:17:55 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-29 23:57:33 +0000 rtld: avoid division in __thr_map_stacks_exec() The function is called by rtld with the rtld bind lock write-locked, when fixing the stack permission during dso load. Not every ARMv7 CPU supports the div, which causes the recursive entry into rtld to resolve the __aeabi_uidiv symbol, causing self-lock. Workaround the problem by using roundup2() instead of open-coding less efficient formula. Diagnosed by: mmel Based on submission by: John F Carr Sponsored by: The FreeBSD Foundation MFC after: 1 week --- 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..d249bb5606fd 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)); } void