Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C7E5C31AA83 for ; Wed, 24 Dec 2025 10:57:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766573831; cv=none; b=JvBibKw1pEKAHpIdZTe/59uDdO/2P9l2/6J+e5sTlTyJZAWmB+b7PjEj73LdE7wj0NVfEO+9UtsuTOAMdl+ljw4hA7zw8GIw92MCrP2+O/4H+70za/RCvIe3G7Mk+SCQt93QIj6plPNzhbK4UO0SfYbRxchKoP2Dk137RTkjra0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766573831; c=relaxed/simple; bh=JQLZWo7GFBBI9uTxmvShEF1Uxi1CzE7TGv6Fv9WrKyk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=D3ROGVszirl3JsbOeRPZqVlOMyQhBjog0SFeo16w/VkX7Y/gEyJyfuBcbnUs22g+VOzhdj2Kpvsb+Dz2Ksom9GGxfdu9WMPZhi8F7i5G6LFyAUSmDHwPZw4QSB5p22zv5jT+zYf85aos0dSgJ5Bajupv/AJtOPpgFD4oSKLCDFU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1Z//Mbdv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1Z//Mbdv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA3AFC4CEFB; Wed, 24 Dec 2025 10:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1766573831; bh=JQLZWo7GFBBI9uTxmvShEF1Uxi1CzE7TGv6Fv9WrKyk=; h=From:To:Cc:Subject:Date:Reply-To:From; b=1Z//MbdvT/Vw9gGjsErsm8UYXdj3I8AmKKthc74fQ4j0Iz9l9ukKlhegqup5Rev/w i6te4YVLGcvFosJbwUsKxXm8g6LvgWofcZIWel8DuJpHeq+LGsQKvyco5hjJVqAOUr DXnim2CB1y9lsXkQBvQuc6d1E4cGa4BujDYR52Kg= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50699: selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context() Date: Wed, 24 Dec 2025 11:56:16 +0100 Message-ID: <2025122417-CVE-2022-50699-ddde@gregkh> X-Mailer: git-send-email 2.52.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=4381; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=t9M4Z2AR9R/gvjTRZeGFTC2OlUvd+quSXCXDgpqjSIA=; b=owGbwMvMwCRo6H6F97bub03G02pJDJnexy413kw/7Zl68kL0pajEY5VyL4/Z180Xa5ptZMlr4 fz/iOTRjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIKT2GBTtLIliU/XoXsqqv XnT8zOW301L0vBgWTMnallq7pPakxKHiRjuZ/oPnaj9UAgA= 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: selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context() The following warning was triggered on a hardware environment: SELinux: Converting 162 SID table entries... BUG: sleeping function called from invalid context at __might_sleep+0x60/0x74 0x0 in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 5943, name: tar CPU: 7 PID: 5943 Comm: tar Tainted: P O 5.10.0 #1 Call trace: dump_backtrace+0x0/0x1c8 show_stack+0x18/0x28 dump_stack+0xe8/0x15c ___might_sleep+0x168/0x17c __might_sleep+0x60/0x74 __kmalloc_track_caller+0xa0/0x7dc kstrdup+0x54/0xac convert_context+0x48/0x2e4 sidtab_context_to_sid+0x1c4/0x36c security_context_to_sid_core+0x168/0x238 security_context_to_sid_default+0x14/0x24 inode_doinit_use_xattr+0x164/0x1e4 inode_doinit_with_dentry+0x1c0/0x488 selinux_d_instantiate+0x20/0x34 security_d_instantiate+0x70/0xbc d_splice_alias+0x4c/0x3c0 ext4_lookup+0x1d8/0x200 [ext4] __lookup_slow+0x12c/0x1e4 walk_component+0x100/0x200 path_lookupat+0x88/0x118 filename_lookup+0x98/0x130 user_path_at_empty+0x48/0x60 vfs_statx+0x84/0x140 vfs_fstatat+0x20/0x30 __se_sys_newfstatat+0x30/0x74 __arm64_sys_newfstatat+0x1c/0x2c el0_svc_common.constprop.0+0x100/0x184 do_el0_svc+0x1c/0x2c el0_svc+0x20/0x34 el0_sync_handler+0x80/0x17c el0_sync+0x13c/0x140 SELinux: Context system_u:object_r:pssp_rsyslog_log_t:s0:c0 is not valid (left unmapped). It was found that within a critical section of spin_lock_irqsave in sidtab_context_to_sid(), convert_context() (hooked by sidtab_convert_params.func) might cause the process to sleep via allocating memory with GFP_KERNEL, which is problematic. As Ondrej pointed out [1], convert_context()/sidtab_convert_params.func has another caller sidtab_convert_tree(), which is okay with GFP_KERNEL. Therefore, fix this problem by adding a gfp_t argument for convert_context()/sidtab_convert_params.func and pass GFP_KERNEL/_ATOMIC properly in individual callers. [PM: wrap long BUG() output lines, tweak subject line] The Linux kernel CVE team has assigned CVE-2022-50699 to this issue. Affected and fixed versions =========================== Issue introduced in 5.0 with commit ee1a84fdfeedfd7362e9a8a8f15fedc3482ade2d and fixed in 5.10.152 with commit 2723875e9d677401d775a03a72abab7e9538c20c Issue introduced in 5.0 with commit ee1a84fdfeedfd7362e9a8a8f15fedc3482ade2d and fixed in 5.15.76 with commit 3006766d247bc93a25b34e92fff2f75bda597e2e Issue introduced in 5.0 with commit ee1a84fdfeedfd7362e9a8a8f15fedc3482ade2d and fixed in 6.0.6 with commit 277378631d26477451424cc73982b977961f3d8b Issue introduced in 5.0 with commit ee1a84fdfeedfd7362e9a8a8f15fedc3482ade2d and fixed in 6.1 with commit abe3c631447dcd1ba7af972fe6f054bee6f136fa 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-2022-50699 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/selinux/ss/services.c security/selinux/ss/sidtab.c security/selinux/ss/sidtab.h 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/2723875e9d677401d775a03a72abab7e9538c20c https://git.kernel.org/stable/c/3006766d247bc93a25b34e92fff2f75bda597e2e https://git.kernel.org/stable/c/277378631d26477451424cc73982b977961f3d8b https://git.kernel.org/stable/c/abe3c631447dcd1ba7af972fe6f054bee6f136fa