From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4254F4E5332 for ; Thu, 17 Sep 2026 16:18:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789661914; cv=none; b=jipatwvxujLEw5kTvK5pL0x/dnJhiLALCqaERM8AA4DLHDsmJauHZzZoi0xX6yg8DOvX0AsNGBLinf5abiAg84xL9z3pcL0bNtq4Be1HpioSq0CSW67FCmUzZTpwk0jgoppQo0V8VsHZBeXBybDTqNUDOYR3ts1OSrAAjPbp0vU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789661914; c=relaxed/simple; bh=VX74l2mWwqBVGSAkd7TNyKG+ps7kwiteCsswAN7fbAc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EinBVCZFarxIRrMuA9tWbsW6FxtQAtNBPnujhtHZyX9RcaWSQvDSKhv422QEf0R4IFlHpCcilQRiFy8qK91p6+1HHI60Z996tX+Ho4nrRXKKe7YSBTEAoJO7skyqrIqyLs1a/gYu5//LB1wq0ojPSBV5eNwn9GLtmEV7QPZoiGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=U0LTJA6O; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="U0LTJA6O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BB091F00893; Thu, 17 Sep 2026 16:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789661912; bh=zVxYxcmid+LsfL29UC64/E2J+Zo0w9ABdDKClDRVFsU=; h=From:To:Cc:Subject:Date:Reply-To; b=U0LTJA6OnO2QCoAxkGglHJMubamkAp768a1cfGmJRTddlthF6emgfxhD2lXeZgEN+ M8PAPhjpTHwdhgRc4ekKea9AJOcyrzRkI6KSD3lg4fbi0JxX+WsfCCZXKFRUAYIXme n146E9My7vCk5WiM+QLJLaYY5Z23qfmj3Nq02ihY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-90179: apparmor: fix deadlock in complain-mode change_hat Date: Thu, 17 Sep 2026 17:10:09 +0100 Message-ID: <2026091729-CVE-2026-90179-55ea@gregkh> X-Mailer: git-send-email 2.55.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7128; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=H7ghmzpQh276MuNPnwuEzZtf47btIkyfcLgzbUhdGpY=; b=owGbwMvMwCRo6H6F97bub03G02pJDFlrBGrTsgIftCWddA3bJ2y0nOGZqaHO49w0y0i+b14xE tWLj7/uiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIkcXsmw4Mb+KU2X3nO5y59M i9q+36bN99v8YIb54WXWNqsK6uoi0xICr0Q/fsvJoyIAAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: apparmor: fix deadlock in complain-mode change_hat The use of change_hat when in complain mode can cause a deadlock when the hat doesn't exist and a new learning profile is created for the missing profile. This is because change_hat() has taken the lock to search the hat list and creating the new learning profile needs to take the lock to add it to the list. >>From the bug report: Originally found in 7.0.0 in LTS ubuntu 26.04 with pam_apparmor + su in complain mode set to change hats. Then verified in newest available vanilla kernel I've compiled to see if still present: 7.2-rc7 vanilla -> affected checked also some other kernels: 6.18.44 vanilla -> affected 6.12.95 with debian patches -> unaffected On systems without bug (for example 6.12.95 debian) it just prints: aa_change_hat rc=0 On systems with bug, the executable always hangs, prints nothing and becomes unkillable. (And once stuck this way, it will cause any further hat changes to also cause the changing process to get stuck) Then in syslog you can find hint about cause: kernel: INFO: task hat:3409 blocked for more than 483 seconds. kernel: Not tainted 7.2.0-rc7 #1 kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. kernel: task:hat state:D stack:0 pid:3409 tgid:3409 ppid:2605 task_flags:0x400000 flags:0x00080800 kernel: Call Trace: kernel: kernel: __schedule+0x48f/0xfe0 kernel: schedule+0x27/0xa0 kernel: schedule_preempt_disabled+0x15/0x30 kernel: __mutex_lock.constprop.0+0x569/0xa10 kernel: aa_new_learning_profile+0x15f/0x210 kernel: build_change_hat+0x19f/0x3b0 kernel: change_hat.isra.0+0x5dd/0xd60 kernel: aa_change_hat+0x2f3/0x710 kernel: aa_setprocattr_changehat+0x121/0x1f0 kernel: do_setattr+0x28c/0x340 kernel: apparmor_setselfattr+0x20/0x50 kernel: security_setselfattr+0xf6/0x110 kernel: __x64_sys_lsm_set_self_attr+0x53/0x90 kernel: do_syscall_64+0xdd/0x5e0 kernel: ? __mod_memcg_lruvec_state+0xfd/0x260 kernel: ? lruvec_stat_mod_folio+0x8d/0xd0 kernel: ? __folio_mod_stat+0x2d/0x90 kernel: ? map_anon_folio_pte_nopf+0xd1/0x1f0 kernel: ? do_anonymous_page+0x184/0xa10 kernel: ? __handle_mm_fault+0x805/0x870 kernel: ? count_memcg_events+0xef/0x230 kernel: ? handle_mm_fault+0x1f0/0x2f0 kernel: ? do_user_addr_fault+0x2bb/0x7b0 kernel: ? do_syscall_64+0x94/0x5e0 kernel: ? exc_page_fault+0x75/0x160 kernel: entry_SYSCALL_64_after_hwframe+0x76/0x7e kernel: RIP: 0033:0x7f815e134c8d kernel: RSP: 002b:00007fff6df94ea8 EFLAGS: 00000246 ORIG_RAX: 00000000000001cc kernel: RAX: ffffffffffffffda RBX: 0000556d8c81d040 RCX: 00007f815e134c8d kernel: RDX: 0000000000000046 RSI: 0000556d8c81d040 RDI: 0000000000000064 kernel: RBP: 00007fff6df94ef0 R08: 00007f815e212ac8 R09: 000000000000000c kernel: R10: 0000000000000000 R11: 0000000000000246 R12: 0000556d8c81d010 kernel: R13: 0000000000000026 R14: 0000000000000046 R15: 0000000000000064 kernel: kernel: INFO: task hat:3409 is blocked on a mutex likely owned by task hat:3409. To fix the issue, lift the locking out of the core of aa_new_learning_profile(), introduce a wrapper function that takes the lock where needed, and have build_change_hat() call the core function that no longer takes the lock. In addition fix 4 other issues introduced by commit 32e92764d6f8d ("apparmor: grab ns lock and refresh when looking up changehat child profiles") - aa_get_profile_rcu() was replaced-by: aa_get_profile without the accompanying rcu_dereference_protected() - an extra aa_get_label(label) was introduced at the start of change_hat() without an accompanying aa_put_label() causing a reference count leak. - a reference count leak was introduced in the label_is_stale(label) case, where the newest profile would be leaked instead of the label passed to the function. - a potential UAF when the lookup walks up the tree with new_ns != ns the new label reference is put, and then used for the next lookup. The mutex_lock, will block replacement, and removal in the locked ns. However there are two cases where putting the reference can result in the label being freed even with the lock held. 1. the label does not have a list reference (possible for temporary or special profiles) in which case the put can trigger the cleanup. 2. the new label reference is in a different namespace, which does not have a lock held on it. This extends case 1 to also include replacement, and removal that could be occurring in the namespace new is in. The Linux kernel CVE team has assigned CVE-2026-90179 to this issue. Affected and fixed versions =========================== Issue introduced in 6.18.40 with commit b427061ca498309bf581bb6f8df4ffcfe4c772cd and fixed in 6.18.52 with commit 00cce5e457cb690a3b3b3d334e76e71049ec8ae5 Issue introduced in 7.2 with commit 32e92764d6f8d251c1bca62be33793287b453a81 and fixed in 7.2.6 with commit 072fb5aeec2eac7d445bf28c7119a1d6f6a2e333 Issue introduced in 7.2 with commit 32e92764d6f8d251c1bca62be33793287b453a81 and fixed in 7.3-rc1 with commit 4ec11f14d1d6fdda787d991b142537be7841d395 Issue introduced in 5.10.261 with commit 862ae1fcc78aea9acab2ac87cccf6431f4682b8e Issue introduced in 5.15.212 with commit 65f95c1e7ce70bf339504e22473879e02026cfc4 Issue introduced in 6.1.178 with commit 9735e300a1c9259bfe4dc5ecdba472bb25574e8a Issue introduced in 6.6.145 with commit 5acb878db41328dae4d3249bc87b9ee4f290a663 Issue introduced in 6.12.97 with commit 6446dbe02f4a3592bf062b4d12105927993086af Issue introduced in 7.1.5 with commit 67ee65ec1a3eebdde76ccaa664d20dcf5b125a2f Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-90179 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: security/apparmor/domain.c security/apparmor/include/policy.h security/apparmor/policy.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/00cce5e457cb690a3b3b3d334e76e71049ec8ae5 https://git.kernel.org/stable/c/072fb5aeec2eac7d445bf28c7119a1d6f6a2e333 https://git.kernel.org/stable/c/4ec11f14d1d6fdda787d991b142537be7841d395