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 93B2937FF77 for ; Wed, 22 Apr 2026 13:56:33 +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=1776866193; cv=none; b=MlK1klCyCSqqfn2pO9MzX1oa3uVgkQ8dsb7MKsMHpr20IeDQduae01Nbsgos9Rh+s+cUGQrRVel0tX82O6RNfFM7vx66XrW70PJ6WyWufpJWamDlspWUyLheG8TPq7GRev640L+DVcx/PTYO/SwvNGVdBPqArNqyEpVqtczpr10= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776866193; c=relaxed/simple; bh=hyS0+CxOMpPmYvd5/0RdirjHhD0cDxlXH+/AYNaBIl8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=i7TBC1nhXh7Zwo4Xjt2elPeDc+u6yYef2wuGsV7jq45TzivL07hM8xkLI+CSrx0Dv0UarJQZQm5fGatrw/SWF6L4ghHM9fgAnEpsxSagUhHKuhEpt71AaMBy3E+xnVMwH1oLe1/QUEXHbRoTLHvycOxPkpevE0APelwaoF4HjOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=z4VgsB5f; 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="z4VgsB5f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AFC4C19425; Wed, 22 Apr 2026 13:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776866193; bh=hyS0+CxOMpPmYvd5/0RdirjHhD0cDxlXH+/AYNaBIl8=; h=From:To:Cc:Subject:Date:Reply-To:From; b=z4VgsB5fbS7NAKFxNf+UGP1rSpAOWKdzZLdtUzBfU6TISdTD6NMXkstbya2LJdwXo yfJfgSjM3yWHv3hk0OfzdFiGwqYyRURFLh9dwaOb4eVvXbghoNHskVpt4uuHNub8kF Gl5s5krYgmZMjr0VGz35OUPm8cMFDVf/BF3KGtgs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-31458: mm/damon/sysfs: check contexts->nr before accessing contexts_arr[0] Date: Wed, 22 Apr 2026 15:54:04 +0200 Message-ID: <2026042250-CVE-2026-31458-5a8e@gregkh> X-Mailer: git-send-email 2.54.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=3333; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Yo0lFKCzznx4DF1L4saiBjN7CysuEL+pc7yRCsmqTZw=; b=owGbwMvMwCRo6H6F97bub03G02pJDJkvLr1bUWqfqlj85Lx3hZzB6qQkwc01DmEimlyxC8//F Nvea/qjI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACaiE8AwV4r95wvL33c4f30w bozVU59xe7dIM8Mc7s45t0vPiB0Ws/45dUXBm+WR1zR1AA== 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: mm/damon/sysfs: check contexts->nr before accessing contexts_arr[0] Multiple sysfs command paths dereference contexts_arr[0] without first verifying that kdamond->contexts->nr == 1. A user can set nr_contexts to 0 via sysfs while DAMON is running, causing NULL pointer dereferences. In more detail, the issue can be triggered by privileged users like below. First, start DAMON and make contexts directory empty (kdamond->contexts->nr == 0). # damo start # cd /sys/kernel/mm/damon/admin/kdamonds/0 # echo 0 > contexts/nr_contexts Then, each of below commands will cause the NULL pointer dereference. # echo update_schemes_stats > state # echo update_schemes_tried_regions > state # echo update_schemes_tried_bytes > state # echo update_schemes_effective_quotas > state # echo update_tuned_intervals > state Guard all commands (except OFF) at the entry point of damon_sysfs_handle_cmd(). The Linux kernel CVE team has assigned CVE-2026-31458 to this issue. Affected and fixed versions =========================== Issue introduced in 5.18 with commit 0ac32b8affb5a384253dbb8339bd2d0e91add0b7 and fixed in 6.6.131 with commit aba546061341b56e9ffb37e1eb661a3628b6ec12 Issue introduced in 5.18 with commit 0ac32b8affb5a384253dbb8339bd2d0e91add0b7 and fixed in 6.12.80 with commit 1e8da792672481d603fa7cd0d815577220a3ee27 Issue introduced in 5.18 with commit 0ac32b8affb5a384253dbb8339bd2d0e91add0b7 and fixed in 6.18.21 with commit 708033c231bd782858f4ddbb46ee874a5a5fbdab Issue introduced in 5.18 with commit 0ac32b8affb5a384253dbb8339bd2d0e91add0b7 and fixed in 6.19.11 with commit bbe03ad3fb9e714191757ca7b41582f930be7be2 Issue introduced in 5.18 with commit 0ac32b8affb5a384253dbb8339bd2d0e91add0b7 and fixed in 7.0 with commit 1bfe9fb5ed2667fb075682408b776b5273162615 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-31458 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/damon/sysfs.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/aba546061341b56e9ffb37e1eb661a3628b6ec12 https://git.kernel.org/stable/c/1e8da792672481d603fa7cd0d815577220a3ee27 https://git.kernel.org/stable/c/708033c231bd782858f4ddbb46ee874a5a5fbdab https://git.kernel.org/stable/c/bbe03ad3fb9e714191757ca7b41582f930be7be2 https://git.kernel.org/stable/c/1bfe9fb5ed2667fb075682408b776b5273162615