From nobody Thu May 1 16:46:11 2025 X-Original-To: threads@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 4ZpKgl5pgNz5vQ8k for ; Thu, 01 May 2025 16:46:11 +0000 (UTC) (envelope-from bugzilla-noreply@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 4ZpKgl570Zz3FTR for ; Thu, 01 May 2025 16:46:11 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746117971; 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=O1qLdcCajFxvJ41oA7CpvoYgRQDY8iefkpo1HTE/DC8=; b=bC6yjcUGq1qHwId+Wu8QmJ1U+W9s+6Mfi1akO+6U3ZB7/VAr6nzpJc1ml+Z267wQopxabX wvfU+LBzx/MwnOXkJ1ADyZqWl/in0ZTxJr/JAmo0s5S+R5kvMi2IV97V7YEKza+i1LF9Rm 4v4Y4HN+H0QOPbjUncT2iELo/sUFg3OajrrXmOn6CQhpAHuHAfdHmdXPum5+NSsS8g4F3D BGBU3QfrcwMj8hpEm/wDKb8mVXa6sjbDQtGjCwpdRgHLqUrWBhru/nsdWwJjhD5JZVS7ry 7kde4pKyO84qSW4f29Qd1pm/O2crNBMyoxexbI1k0ghtNbmD4DHonxQGmEEfdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746117971; 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=O1qLdcCajFxvJ41oA7CpvoYgRQDY8iefkpo1HTE/DC8=; b=wDXDyI0KXaL8/nZXLxwkoEtIsI0Isu2qFyfYd5c6g9GbtXK16gq+8q7Sq+3E502fSJSAEu fJFhUyAYTKezzJvQODE96r/5jAcl44yMV8nGFOQ93OB2HMWURFzJExQQSwX2h+fLHAoGRz 6ch2B5dv+Z+st4yIWp6zMk+ccl2xVxeteiu/BemZZp0GH0U2H2riUQLI52fEP2he7aGUif D5Y57eSEgaBE/m1iqD56/ptBfYemYh0xIRSQedW/FRTocAmMxCi7/hzP8QCmr3bE+Zbyrq d9ZofYP/NX2q5qnH9brjgsymsoY4AjMGYEuUijhgfGi9vUgVgvguoOWVSorf5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746117971; a=rsa-sha256; cv=none; b=SLww4ghGVkO7tSApVjy4rm4Z+uILcc1H1TyhPlhlsKaKM/F2MlvvUG48KLH6/HaXVbzmpr bqf5n7GXsXV3E00jx6EdPxpBHsho5zG6r+TZwzmUq1z9MNl5cj/67Af7AueTjhn8q/veLm /x2ZvhVHhK5Dt//1aDR6g8zQ5YYgx4aV9REy7G+EWNLyMw7rdCL87i1Kzww26Ecxo25BKY WSEMZry+sN343LzKZ3rihLYeoZa1/VNvkgD1Juzeen4EkTNxW+JDT8vygiN07Ja5O+bfys eAFxlHD6oXrdoSjUYFsSUmxvZ60PVZkaOpzEm+CmwNfeRrZSCF2EuO2d0z10fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4ZpKgl4JvwzcJt for ; Thu, 01 May 2025 16:46:11 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 541GkBcw054784 for ; Thu, 1 May 2025 16:46:11 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 541GkBJJ054783 for threads@FreeBSD.org; Thu, 1 May 2025 16:46:11 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: threads@FreeBSD.org Subject: [Bug 286505] dlopen deadlocks when target library contains IFUNC Date: Thu, 01 May 2025 16:46:11 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dapeng.gao@cl.cam.ac.uk X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-threads@freebsd.org Sender: owner-freebsd-threads@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D286505 Bug ID: 286505 Summary: dlopen deadlocks when target library contains IFUNC Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: threads Assignee: threads@FreeBSD.org Reporter: dapeng.gao@cl.cam.ac.uk CC: kib@FreeBSD.org An ifunc resolver enters _rtld_bind, which attempts to acquire _rtld_bind_l= ock. But since we are in the middle of dlopen, the lock has been acquired alread= y, hence deadlocking. This is similar to bug #286502 but does not involve filter libraries. Tested on AArch64 but should be reproducible on AMD64. pthread required. Commands: cc main.c -lthr -Wl,-rpath=3D. -o main cc foo.c -shared -o foo.so ./main Setup: $ cat main.c #include int main() { dlopen("foo.so", RTLD_LAZY); } $ cat foo.c #include static void foo_impl() { } static void *foo_resolver() { puts("foo_resolver()"); return &foo_impl; } void foo() __attribute__((ifunc("foo_resolver"))); void (*foo_ptr)() =3D &foo; --=20 You are receiving this mail because: You are the assignee for the bug.=