From mboxrd@z Thu Jan 1 00:00:00 1970 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 1D9AD132804 for ; Fri, 5 Jul 2024 06:55:25 +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=1720162526; cv=none; b=AKyx4SYs6o70/vdjMlZf94lO36EYFa9Nq0z0cnKcnHcYn0PZ8FNH87pbvL41zZXKkAhxRzNu1zmtuIsD5Q3tn/K7LhzpQ8zqxlpwIoVDI/fvdw9ruPRmhN0TN4DIZTjXdHTmFsa5zskQZSIvHevAlIDH+nT6BDdrV4JvSwFwhqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720162526; c=relaxed/simple; bh=1azcvAXBjAj2/KN7ZTAGZNBOsRdz1jjMmg9cNx4r1gM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LJWwYsSD3RuYCb8Nt7xAPUNdB98lgMez95M/zsI4gV+f19wevMtguvbmtcNxUQo8rtgeYBVRVB0XF5P4aiw7fMeJbQiu33lIWiq3IK9nhgpCjL1TYzuBCZrhNdWeXCCCj3dS19rmqD+/UddvQJjuidQtNqgly8gZmHJXydKydrc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mbiT9zkS; 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="mbiT9zkS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54E2EC116B1; Fri, 5 Jul 2024 06:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720162525; bh=1azcvAXBjAj2/KN7ZTAGZNBOsRdz1jjMmg9cNx4r1gM=; h=From:To:Cc:Subject:Date:Reply-to:From; b=mbiT9zkS5thP/ZRJ3jWbtmvWVnIwZfPFsIKoCw95MFr0yDrYUj/HoI3dEpVaBmuxc bgQvr/ktsYSA8ggp/mzUA5L6BccEEkkU+DmXrhBnuBr89KS1R6Rdb3opsKtqePxER9 JJ5hbzilq09OEJnzyW1KUMD3EY9MixhNed0U4QyI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-39474: mm/vmalloc: fix vmalloc which may return null if called with __GFP_NOFAIL Date: Fri, 5 Jul 2024 08:55:18 +0200 Message-ID: <2024070518-CVE-2024-39474-97cf@gregkh> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4671; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=1azcvAXBjAj2/KN7ZTAGZNBOsRdz1jjMmg9cNx4r1gM=; b=owGbwMvMwCRo6H6F97bub03G02pJDGntM67NvOfhkRTkf9bbN8JZ0HvJvhz2MPf+PwtdQwq+u f29d/JuRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAExEchvDgjMNruUvj71+efvl ifWMop/m3ip6dJthweTyXQ37VipxTWT73HGwWfVMnd7OUwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: mm/vmalloc: fix vmalloc which may return null if called with __GFP_NOFAIL commit a421ef303008 ("mm: allow !GFP_KERNEL allocations for kvmalloc") includes support for __GFP_NOFAIL, but it presents a conflict with commit dd544141b9eb ("vmalloc: back off when the current task is OOM-killed"). A possible scenario is as follows: process-a __vmalloc_node_range(GFP_KERNEL | __GFP_NOFAIL) __vmalloc_area_node() vm_area_alloc_pages() --> oom-killer send SIGKILL to process-a if (fatal_signal_pending(current)) break; --> return NULL; To fix this, do not check fatal_signal_pending() in vm_area_alloc_pages() if __GFP_NOFAIL set. This issue occurred during OPLUS KASAN TEST. Below is part of the log -> oom-killer sends signal to process [65731.222840] [ T1308] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/apps/uid_10198,task=gs.intelligence,pid=32454,uid=10198 [65731.259685] [T32454] Call trace: [65731.259698] [T32454] dump_backtrace+0xf4/0x118 [65731.259734] [T32454] show_stack+0x18/0x24 [65731.259756] [T32454] dump_stack_lvl+0x60/0x7c [65731.259781] [T32454] dump_stack+0x18/0x38 [65731.259800] [T32454] mrdump_common_die+0x250/0x39c [mrdump] [65731.259936] [T32454] ipanic_die+0x20/0x34 [mrdump] [65731.260019] [T32454] atomic_notifier_call_chain+0xb4/0xfc [65731.260047] [T32454] notify_die+0x114/0x198 [65731.260073] [T32454] die+0xf4/0x5b4 [65731.260098] [T32454] die_kernel_fault+0x80/0x98 [65731.260124] [T32454] __do_kernel_fault+0x160/0x2a8 [65731.260146] [T32454] do_bad_area+0x68/0x148 [65731.260174] [T32454] do_mem_abort+0x151c/0x1b34 [65731.260204] [T32454] el1_abort+0x3c/0x5c [65731.260227] [T32454] el1h_64_sync_handler+0x54/0x90 [65731.260248] [T32454] el1h_64_sync+0x68/0x6c [65731.260269] [T32454] z_erofs_decompress_queue+0x7f0/0x2258 --> be->decompressed_pages = kvcalloc(be->nr_pages, sizeof(struct page *), GFP_KERNEL | __GFP_NOFAIL); kernel panic by NULL pointer dereference. erofs assume kvmalloc with __GFP_NOFAIL never return NULL. [65731.260293] [T32454] z_erofs_runqueue+0xf30/0x104c [65731.260314] [T32454] z_erofs_readahead+0x4f0/0x968 [65731.260339] [T32454] read_pages+0x170/0xadc [65731.260364] [T32454] page_cache_ra_unbounded+0x874/0xf30 [65731.260388] [T32454] page_cache_ra_order+0x24c/0x714 [65731.260411] [T32454] filemap_fault+0xbf0/0x1a74 [65731.260437] [T32454] __do_fault+0xd0/0x33c [65731.260462] [T32454] handle_mm_fault+0xf74/0x3fe0 [65731.260486] [T32454] do_mem_abort+0x54c/0x1b34 [65731.260509] [T32454] el0_da+0x44/0x94 [65731.260531] [T32454] el0t_64_sync_handler+0x98/0xb4 [65731.260553] [T32454] el0t_64_sync+0x198/0x19c The Linux kernel CVE team has assigned CVE-2024-39474 to this issue. Affected and fixed versions =========================== Issue introduced in 5.17 with commit 9376130c390a and fixed in 6.1.95 with commit 198a80833e34 Issue introduced in 5.17 with commit 9376130c390a and fixed in 6.6.34 with commit c55d3564ad25 Issue introduced in 5.17 with commit 9376130c390a and fixed in 6.9.5 with commit 758678b65164 Issue introduced in 5.17 with commit 9376130c390a and fixed in 6.10-rc1 with commit 8e0545c83d67 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-2024-39474 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: mm/vmalloc.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/198a80833e3421d4c9820a4ae907120adf598c91 https://git.kernel.org/stable/c/c55d3564ad25ce87ab7cc6af251f9574faebd8da https://git.kernel.org/stable/c/758678b65164b2158fc1de411092191cb3c394d4 https://git.kernel.org/stable/c/8e0545c83d672750632f46e3f9ad95c48c91a0fc