From nobody Thu Jul 25 23:00:58 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 4WVRFR0ZRvz5RV7q; Thu, 25 Jul 2024 23:00:59 +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 4WVRFR05ytz4WJX; Thu, 25 Jul 2024 23:00:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721948459; 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=+VGF13rSDZ+jZsjqm6zhyS7fldoQ6KRoMn5Owvf4PMs=; b=wrljoKyef1PfWaJ1v7rktfUHfm7mIyPnqvJOKi1znjwVCocoR5zsB/DeJ1mulma7GIvaMp 7xSe7NzGcIe/AVmsmjSbcT/QbvMivGgU68oXhe+JM+Y25HtpGL2pqFEOso/vX0FEKGReC7 oxS49H6axx6empO7FKKTIKujG0CYj7c9LsVFfjelGsV72JBCy30yJhtiO0fMRsbJR+za8x mruw0pJdBV0DlTBTDFovubiaM8/a1py1xK77WwlWHOXdJY+jbOP8BCNYIAjTazAqfzmxb3 5e0BzwjO8a6LS6ua6gAdbv3LZSw0NmX9AhRJS19KU0xhptDMbE9EdDn1ZmqcLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721948459; a=rsa-sha256; cv=none; b=u0uQjvXRp/XR4FA7OSfz1weP/PxXVC7TQrCdigjeqdilxv72hVxzjSnkq2+UiMEWeS5ZI+ yydBuvxPHThrIJQJWHiK0rH9+nX9/uRnjlM+FP2U1y+k3DZkzynMBOR1X4yBxdY4yj71gt 8bxru8Til9h6gRXi4Ji+QLhbBVZSC7FJp8Qz6KUpIfrmiAM1HI2izjzSVwOK3E7xd53NKk foHEILFJ6DlLnzMrrTQfZ7a+ba8Tvh/08EcEp86GsdIZlYlUWglVLchnwKXVENWqDgN1wR kYrOkWfa1u/KfJ31MBFBT24R8wpTciHpmMvtyFzPcnzJb9z0hMxuY8uX5d1mbQ== 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=1721948459; 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=+VGF13rSDZ+jZsjqm6zhyS7fldoQ6KRoMn5Owvf4PMs=; b=p3cPaoowiNA8h3UGZMRxtOiZGu4SH0Onbu+2oahKzLGbWVhGbwWbF9br9ubWwXLzURlgWP /CfHqadpucbJPKDDpvXrwAjx28Ca8yv49wA9bsdfu3a1kCWMPXBgXHlPk0K3gbTLUGbI6L 0OWR5bgvTsxYw1v9UZJBKCDqTTZfnn86ApKl5wImGgbUf/TYWwIIOB81vJO3zUX9b1Ndgl jEvxwcBbJPsJYvqsIsDKwFQD20d/z2OfuL3DCiLYDf455MRPAMVgpK9wBMWpYB5stSo59n oU1olCCRecW9V/Dwjl/bBPOSdrCluLYOUPUDEO+n1hmpgEQ8Wd9ZNWNFOFUfEg== 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 4WVRFQ6jYZz1CyS; Thu, 25 Jul 2024 23:00:58 +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 46PN0wW7091131; Thu, 25 Jul 2024 23:00:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46PN0wZr091128; Thu, 25 Jul 2024 23:00:58 GMT (envelope-from git) Date: Thu, 25 Jul 2024 23:00:58 GMT Message-Id: <202407252300.46PN0wZr091128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 2b229739e7ca - main - Avoid division in round_up. 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: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b229739e7ca43b36e53f47147ac05a91333f7b9 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=2b229739e7ca43b36e53f47147ac05a91333f7b9 commit 2b229739e7ca43b36e53f47147ac05a91333f7b9 Author: John F. Carr AuthorDate: 2024-07-25 23:00:28 +0000 Commit: Brooks Davis 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