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 94A74233D8E for ; Sat, 9 Nov 2024 10:15:56 +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=1731147356; cv=none; b=ZpvsuAO+Zoakd2y0MCNyjyvilZM0RrncGiKfYU7pmYqCukvjAXYgdfgXRIS6hh/e5PHM2CyDJwl+f8NrBo5gI9fEF358fcbbXeEOkPo/0ZgnWlYoIGdFIDcWp0hP0kOQVhHR+7JZyb3XHiES59LNqYcyJ+2Pz2pdP6b77K8TiPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731147356; c=relaxed/simple; bh=JGNF+h7F+4sVyHk2l2NCm9fACC7YKeu8L3MVEs6CZ6g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VRa5tWlVcX3d28hC7OggXyrqSNZWNoit5C41PAlS7xdLrlOEXxPgXK2sm8zc1Pa83bT1uIdJqX4+TYzQS6pGby9x1CCJtYX09NO6mVZ+yCzpysMHQx2Xfzp+/Nu8k9CREla6YTu57xIEURrk/sWl/51OfvEZuU5pryo1M1Z9Bn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UEO1lqk1; 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="UEO1lqk1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0A56C4CECE; Sat, 9 Nov 2024 10:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1731147356; bh=JGNF+h7F+4sVyHk2l2NCm9fACC7YKeu8L3MVEs6CZ6g=; h=From:To:Cc:Subject:Date:Reply-to:From; b=UEO1lqk1M3Q2sNFiVZJuVuSwjXTcK9u74FXXdEcLiHirRHOyE7GPdcBB20xGqkohT RKOQufyhdt9PuqnxBPkZi1hKVjiqqgyxroKchl1bItP1UWlh4WteAnimuydevNvb4T Nor2oCFoxhlqSOf/cgNAa5dZoHugF9pak3inJ3+w= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-50223: sched/numa: Fix the potential null pointer dereference in task_numa_work() Date: Sat, 9 Nov 2024 11:15:31 +0100 Message-ID: <2024110927-CVE-2024-50223-c11b@gregkh> X-Mailer: git-send-email 2.47.0 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=4398; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=JGNF+h7F+4sVyHk2l2NCm9fACC7YKeu8L3MVEs6CZ6g=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn6ZvabL0Qd80wKyjp41npijMTTA8c/hF+dp/EjsVOwe tGH09yuHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRhT8ZFhy54zL71rXCsJbP BtVNq+TPW0Ro3GdYMPfUg1vp/vlRvJcDv5qFtsyq33nAFQA= 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: sched/numa: Fix the potential null pointer dereference in task_numa_work() When running stress-ng-vm-segv test, we found a null pointer dereference error in task_numa_work(). Here is the backtrace: [323676.066985] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020 ...... [323676.067108] CPU: 35 PID: 2694524 Comm: stress-ng-vm-se ...... [323676.067113] pstate: 23401009 (nzCv daif +PAN -UAO +TCO +DIT +SSBS BTYPE=--) [323676.067115] pc : vma_migratable+0x1c/0xd0 [323676.067122] lr : task_numa_work+0x1ec/0x4e0 [323676.067127] sp : ffff8000ada73d20 [323676.067128] x29: ffff8000ada73d20 x28: 0000000000000000 x27: 000000003e89f010 [323676.067130] x26: 0000000000080000 x25: ffff800081b5c0d8 x24: ffff800081b27000 [323676.067133] x23: 0000000000010000 x22: 0000000104d18cc0 x21: ffff0009f7158000 [323676.067135] x20: 0000000000000000 x19: 0000000000000000 x18: ffff8000ada73db8 [323676.067138] x17: 0001400000000000 x16: ffff800080df40b0 x15: 0000000000000035 [323676.067140] x14: ffff8000ada73cc8 x13: 1fffe0017cc72001 x12: ffff8000ada73cc8 [323676.067142] x11: ffff80008001160c x10: ffff000be639000c x9 : ffff8000800f4ba4 [323676.067145] x8 : ffff000810375000 x7 : ffff8000ada73974 x6 : 0000000000000001 [323676.067147] x5 : 0068000b33e26707 x4 : 0000000000000001 x3 : ffff0009f7158000 [323676.067149] x2 : 0000000000000041 x1 : 0000000000004400 x0 : 0000000000000000 [323676.067152] Call trace: [323676.067153] vma_migratable+0x1c/0xd0 [323676.067155] task_numa_work+0x1ec/0x4e0 [323676.067157] task_work_run+0x78/0xd8 [323676.067161] do_notify_resume+0x1ec/0x290 [323676.067163] el0_svc+0x150/0x160 [323676.067167] el0t_64_sync_handler+0xf8/0x128 [323676.067170] el0t_64_sync+0x17c/0x180 [323676.067173] Code: d2888001 910003fd f9000bf3 aa0003f3 (f9401000) [323676.067177] SMP: stopping secondary CPUs [323676.070184] Starting crashdump kernel... stress-ng-vm-segv in stress-ng is used to stress test the SIGSEGV error handling function of the system, which tries to cause a SIGSEGV error on return from unmapping the whole address space of the child process. Normally this program will not cause kernel crashes. But before the munmap system call returns to user mode, a potential task_numa_work() for numa balancing could be added and executed. In this scenario, since the child process has no vma after munmap, the vma_next() in task_numa_work() will return a null pointer even if the vma iterator restarts from 0. Recheck the vma pointer before dereferencing it in task_numa_work(). The Linux kernel CVE team has assigned CVE-2024-50223 to this issue. Affected and fixed versions =========================== Issue introduced in 6.3 with commit 214dbc428137 and fixed in 6.6.60 with commit ade91f6e9848 Issue introduced in 6.3 with commit 214dbc428137 and fixed in 6.11.7 with commit c60d98ef7078 Issue introduced in 6.3 with commit 214dbc428137 and fixed in 6.12-rc6 with commit 9c70b2a33cd2 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-50223 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: kernel/sched/fair.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/ade91f6e9848b370add44d89c976e070ccb492ef https://git.kernel.org/stable/c/c60d98ef7078fc3e22b48e98eae7a897d88494ee https://git.kernel.org/stable/c/9c70b2a33cd2aa6a5a59c5523ef053bd42265209