From nobody Sat Nov 07 17:21:45 2026 X-Original-To: dev-commits-src-all@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 4jMNBl09vzz705mj for ; Sat, 07 Nov 2026 17:21:51 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jMNBk65whz4h51 for ; Sat, 07 Nov 2026 17:21:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794072110; 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=ciyDzX4RBlrqkWMEkjlq4OWOJK33+OSbg+VQ+Co1WnY=; b=BIqJHuaFdcSaFefUwPm//qZdgaVzs8DGsneDKMJir5zRp2yZeEAyRdrEkZy+SDq/CRcjTM R+9VrYYaejkmjyOllOY+eDK9dwUkvyBisD4fA9Qk/sHR9qM+3HlpZ87KXbxBQKYeqwgVBX 2soiUANDgjMoaq7BcPQ/+ItDoJk+f3DxXe3z8sbQ6s3asokdB0Gebv1f3pDxJTapVkmjde r2PQb2idgWJhZDarIBh9LG6ZEen+cnrpSAf8DsOA/RE9gu94B6+z84Q/hKB9jgTMfrlN/0 2W+xpinEc/qArNcTbSvM7IBXvbM1AQh5uBniMsidP1zYWyI8vOi03NoxfXKtug== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794072110; b=FWtIuCMmOqgf03jcXuY5HsQsH24guugq98n0G5OLr7CLHqe6Dmnh7P6bnyyLzcml789QJc +TlG9ZmNKMUU/NdxjO9l+qZK4MoE9/EhqmyOlJDGKN4jW+VehYLPRStbhCzYbgBKdUWBaJ uoyAj3krnRmsc9khPweWex56xejYjGJkbfyl7t+4pk96AuI9Wpl9d6i14F8Z+jxWpVjNSc 7EmYaz+Ig132rGay/JN/mv/41Fa+t8byKI3cS96Gxr+5TwQ92FruHAgkl1UFY1+b6ebMhz fKDLz6jMWEROKVtQhNWgA55C1T7D/FWfrjMoBm3TumaqUnZVOCB9cmJIACtsuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794072110; 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=ciyDzX4RBlrqkWMEkjlq4OWOJK33+OSbg+VQ+Co1WnY=; b=sPFDdUCw+dXLHs+bO5hEhJ5g0S2aB9KYqvMUKjIEIMmQ/UgN07+6WtYB5c66TSXD7A4hIL kkWFdrLljzCLNyAq+DFmnXOJhH8r4O+7oRu87fzbek9z9T8oOsl3GBFv8KF1dXEKzXzdSl ry3XhJbSQtvFNvmNMIGkHmo7EJ/8O9+SZIgcjX0ow1N1AgVf+Rq1GbgtRJ3cTALT0wlOXl ITF3he+8T36pt5SXdTNdJmPzF1FiaXsg4D0ueA/ZF6Ms/eBXsazUZMcC3GQcht0ZVuXpLx uGHwtol6R7XgrCE5Z6RVlxuZHJ7queV1uinCMsXbNoVVaZgv6jDo8gcnaG/qjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jMNBk5ZBszW1k for ; Sat, 07 Nov 2026 17:21:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fd41 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 07 Nov 2026 17:21:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 04db6f654c4f - main - acpi_apple: Fix sleep with non-sleepable lock held List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04db6f654c4fb908b94265eb392db3e56cb7da8c Auto-Submitted: auto-generated Date: Sat, 07 Nov 2026 17:21:45 +0000 Message-Id: <6aef5e29.3fd41.54b48aea@gitrepo.freebsd.org> The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=04db6f654c4fb908b94265eb392db3e56cb7da8c commit 04db6f654c4fb908b94265eb392db3e56cb7da8c Author: Vladimir Kondratyev AuthorDate: 2026-11-07 17:20:50 +0000 Commit: Vladimir Kondratyev CommitDate: 2026-11-07 17:20:50 +0000 acpi_apple: Fix sleep with non-sleepable lock held Apple platform attach and detach functions are serialized with ordinary mutex and contain code that executes malloc() that leads to INVARIANTS warnings. Fix it through replacement of mutex with sx lock. Fixes: d7d237ce731f ("acpi_apple: Apple platform ACPI driver") Reviewed by: seuros Differential Revision: https://reviews.freebsd.org/D61295 --- sys/dev/acpi_apple/acpi_apple.h | 1 + sys/dev/acpi_apple/acpi_apple_platform.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/dev/acpi_apple/acpi_apple.h b/sys/dev/acpi_apple/acpi_apple.h index 4e02b43559de..790c6a544457 100644 --- a/sys/dev/acpi_apple/acpi_apple.h +++ b/sys/dev/acpi_apple/acpi_apple.h @@ -15,6 +15,7 @@ #include #include #include +#include #include diff --git a/sys/dev/acpi_apple/acpi_apple_platform.c b/sys/dev/acpi_apple/acpi_apple_platform.c index df690402f8f7..e993cfdbd9c7 100644 --- a/sys/dev/acpi_apple/acpi_apple_platform.c +++ b/sys/dev/acpi_apple/acpi_apple_platform.c @@ -22,9 +22,9 @@ * the second instance's attach/detach doesn't reinstall or rip out the * first instance's hooks. */ -static struct mtx acpi_apple_platform_mtx; -MTX_SYSINIT(acpi_apple_platform_mtx_init, &acpi_apple_platform_mtx, - "acpi_apple_platform", MTX_DEF); +static struct sx acpi_apple_platform_sx; +SX_SYSINIT(acpi_apple_platform_sx_init, &acpi_apple_platform_sx, + "acpi_apple_platform"); static int acpi_apple_platform_refs; static eventhandler_tag acpi_apple_shutdown_tag; static eventhandler_tag acpi_apple_lid_tag; @@ -88,7 +88,7 @@ acpi_apple_lid_event(void *arg __unused, int lid_open) int acpi_apple_platform_attach(struct acpi_apple_softc *sc __unused) { - mtx_lock(&acpi_apple_platform_mtx); + sx_xlock(&acpi_apple_platform_sx); if (acpi_apple_platform_refs++ == 0) { acpi_apple_shutdown_tag = EVENTHANDLER_REGISTER( shutdown_final, acpi_apple_arm_wol, NULL, @@ -96,7 +96,7 @@ acpi_apple_platform_attach(struct acpi_apple_softc *sc __unused) acpi_apple_lid_tag = EVENTHANDLER_REGISTER(acpi_lid_event, acpi_apple_lid_event, NULL, EVENTHANDLER_PRI_ANY); } - mtx_unlock(&acpi_apple_platform_mtx); + sx_unlock(&acpi_apple_platform_sx); return (0); } @@ -104,7 +104,7 @@ acpi_apple_platform_attach(struct acpi_apple_softc *sc __unused) void acpi_apple_platform_detach(struct acpi_apple_softc *sc __unused) { - mtx_lock(&acpi_apple_platform_mtx); + sx_xlock(&acpi_apple_platform_sx); KASSERT(acpi_apple_platform_refs > 0, ("acpi_apple: platform refcount underflow")); if (acpi_apple_platform_refs > 0 && --acpi_apple_platform_refs == 0) { @@ -119,5 +119,5 @@ acpi_apple_platform_detach(struct acpi_apple_softc *sc __unused) acpi_apple_shutdown_tag = NULL; } } - mtx_unlock(&acpi_apple_platform_mtx); + sx_unlock(&acpi_apple_platform_sx); }