cve-2023-52896
Vulnerability from cvelistv5
Published
2024-08-21 06:10
Modified
2024-11-04 14:54
Severity ?
EPSS score ?
Summary
btrfs: fix race between quota rescan and disable leading to NULL pointer deref
References
Impacted products
{ "containers": { "adp": [ { "metrics": [ { "other": { "content": { "id": "CVE-2023-52896", "options": [ { "Exploitation": "none" }, { "Automatable": "no" }, { "Technical Impact": "partial" } ], "role": "CISA Coordinator", "timestamp": "2024-09-10T16:03:43.723269Z", "version": "2.0.3" }, "type": "ssvc" } } ], "providerMetadata": { "dateUpdated": "2024-09-12T17:33:13.066Z", "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "shortName": "CISA-ADP" }, "title": "CISA ADP Vulnrichment" } ], "cna": { "affected": [ { "defaultStatus": "unaffected", "product": "Linux", "programFiles": [ "fs/btrfs/qgroup.c" ], "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "vendor": "Linux", "versions": [ { "lessThan": "89ac597e3e80", "status": "affected", "version": "26b3901d20bf", "versionType": "git" }, { "lessThan": "3bd433748571", "status": "affected", "version": "32747e01436a", "versionType": "git" }, { "lessThan": "64287cd456a2", "status": "affected", "version": "89d4cca583fc", "versionType": "git" }, { "lessThan": "1004fc90f0d7", "status": "affected", "version": "e804861bd4e6", "versionType": "git" }, { "lessThan": "b7adbf9ada35", "status": "affected", "version": "e804861bd4e6", "versionType": "git" } ] }, { "defaultStatus": "affected", "product": "Linux", "programFiles": [ "fs/btrfs/qgroup.c" ], "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "vendor": "Linux", "versions": [ { "status": "affected", "version": "5.17" }, { "lessThan": "5.17", "status": "unaffected", "version": "0", "versionType": "semver" }, { "lessThanOrEqual": "5.4.*", "status": "unaffected", "version": "5.4.230", "versionType": "semver" }, { "lessThanOrEqual": "5.10.*", "status": "unaffected", "version": "5.10.165", "versionType": "semver" }, { "lessThanOrEqual": "5.15.*", "status": "unaffected", "version": "5.15.90", "versionType": "semver" }, { "lessThanOrEqual": "6.1.*", "status": "unaffected", "version": "6.1.8", "versionType": "semver" }, { "lessThanOrEqual": "*", "status": "unaffected", "version": "6.2", "versionType": "original_commit_for_fix" } ] } ], "descriptions": [ { "lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix race between quota rescan and disable leading to NULL pointer deref\n\nIf we have one task trying to start the quota rescan worker while another\none is trying to disable quotas, we can end up hitting a race that results\nin the quota rescan worker doing a NULL pointer dereference. The steps for\nthis are the following:\n\n1) Quotas are enabled;\n\n2) Task A calls the quota rescan ioctl and enters btrfs_qgroup_rescan().\n It calls qgroup_rescan_init() which returns 0 (success) and then joins a\n transaction and commits it;\n\n3) Task B calls the quota disable ioctl and enters btrfs_quota_disable().\n It clears the bit BTRFS_FS_QUOTA_ENABLED from fs_info-\u003eflags and calls\n btrfs_qgroup_wait_for_completion(), which returns immediately since the\n rescan worker is not yet running.\n Then it starts a transaction and locks fs_info-\u003eqgroup_ioctl_lock;\n\n4) Task A queues the rescan worker, by calling btrfs_queue_work();\n\n5) The rescan worker starts, and calls rescan_should_stop() at the start\n of its while loop, which results in 0 iterations of the loop, since\n the flag BTRFS_FS_QUOTA_ENABLED was cleared from fs_info-\u003eflags by\n task B at step 3);\n\n6) Task B sets fs_info-\u003equota_root to NULL;\n\n7) The rescan worker tries to start a transaction and uses\n fs_info-\u003equota_root as the root argument for btrfs_start_transaction().\n This results in a NULL pointer dereference down the call chain of\n btrfs_start_transaction(). The stack trace is something like the one\n reported in Link tag below:\n\n general protection fault, probably for non-canonical address 0xdffffc0000000041: 0000 [#1] PREEMPT SMP KASAN\n KASAN: null-ptr-deref in range [0x0000000000000208-0x000000000000020f]\n CPU: 1 PID: 34 Comm: kworker/u4:2 Not tainted 6.1.0-syzkaller-13872-gb6bb9676f216 #0\n Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022\n Workqueue: btrfs-qgroup-rescan btrfs_work_helper\n RIP: 0010:start_transaction+0x48/0x10f0 fs/btrfs/transaction.c:564\n Code: 48 89 fb 48 (...)\n RSP: 0018:ffffc90000ab7ab0 EFLAGS: 00010206\n RAX: 0000000000000041 RBX: 0000000000000208 RCX: ffff88801779ba80\n RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000\n RBP: dffffc0000000000 R08: 0000000000000001 R09: fffff52000156f5d\n R10: fffff52000156f5d R11: 1ffff92000156f5c R12: 0000000000000000\n R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000003\n FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000\n CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\n CR2: 00007f2bea75b718 CR3: 000000001d0cc000 CR4: 00000000003506e0\n DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\n DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\n Call Trace:\n \u003cTASK\u003e\n btrfs_qgroup_rescan_worker+0x3bb/0x6a0 fs/btrfs/qgroup.c:3402\n btrfs_work_helper+0x312/0x850 fs/btrfs/async-thread.c:280\n process_one_work+0x877/0xdb0 kernel/workqueue.c:2289\n worker_thread+0xb14/0x1330 kernel/workqueue.c:2436\n kthread+0x266/0x300 kernel/kthread.c:376\n ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308\n \u003c/TASK\u003e\n Modules linked in:\n\nSo fix this by having the rescan worker function not attempt to start a\ntransaction if it didn\u0027t do any rescan work." } ], "providerMetadata": { "dateUpdated": "2024-11-04T14:54:44.998Z", "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "shortName": "Linux" }, "references": [ { "url": "https://git.kernel.org/stable/c/89ac597e3e807b91e2ebd6a7c36fec7b97290233" }, { "url": "https://git.kernel.org/stable/c/3bd43374857103ba3cac751d6d4afa8d83b5d92a" }, { "url": "https://git.kernel.org/stable/c/64287cd456a22373053998c1fccf14b651e9cbbd" }, { "url": "https://git.kernel.org/stable/c/1004fc90f0d79a4b7d9e3d432729914f472f9ad1" }, { "url": "https://git.kernel.org/stable/c/b7adbf9ada3513d2092362c8eac5cddc5b651f5c" } ], "title": "btrfs: fix race between quota rescan and disable leading to NULL pointer deref", "x_generator": { "engine": "bippy-9e1c9544281a" } } }, "cveMetadata": { "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "assignerShortName": "Linux", "cveId": "CVE-2023-52896", "datePublished": "2024-08-21T06:10:36.233Z", "dateReserved": "2024-08-21T06:07:11.014Z", "dateUpdated": "2024-11-04T14:54:44.998Z", "state": "PUBLISHED" }, "dataType": "CVE_RECORD", "dataVersion": "5.1", "meta": { "nvd": "{\"cve\":{\"id\":\"CVE-2023-52896\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-08-21T07:15:06.060\",\"lastModified\":\"2024-09-11T16:37:08.107\",\"vulnStatus\":\"Analyzed\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbtrfs: fix race between quota rescan and disable leading to NULL pointer deref\\n\\nIf we have one task trying to start the quota rescan worker while another\\none is trying to disable quotas, we can end up hitting a race that results\\nin the quota rescan worker doing a NULL pointer dereference. The steps for\\nthis are the following:\\n\\n1) Quotas are enabled;\\n\\n2) Task A calls the quota rescan ioctl and enters btrfs_qgroup_rescan().\\n It calls qgroup_rescan_init() which returns 0 (success) and then joins a\\n transaction and commits it;\\n\\n3) Task B calls the quota disable ioctl and enters btrfs_quota_disable().\\n It clears the bit BTRFS_FS_QUOTA_ENABLED from fs_info-\u003eflags and calls\\n btrfs_qgroup_wait_for_completion(), which returns immediately since the\\n rescan worker is not yet running.\\n Then it starts a transaction and locks fs_info-\u003eqgroup_ioctl_lock;\\n\\n4) Task A queues the rescan worker, by calling btrfs_queue_work();\\n\\n5) The rescan worker starts, and calls rescan_should_stop() at the start\\n of its while loop, which results in 0 iterations of the loop, since\\n the flag BTRFS_FS_QUOTA_ENABLED was cleared from fs_info-\u003eflags by\\n task B at step 3);\\n\\n6) Task B sets fs_info-\u003equota_root to NULL;\\n\\n7) The rescan worker tries to start a transaction and uses\\n fs_info-\u003equota_root as the root argument for btrfs_start_transaction().\\n This results in a NULL pointer dereference down the call chain of\\n btrfs_start_transaction(). The stack trace is something like the one\\n reported in Link tag below:\\n\\n general protection fault, probably for non-canonical address 0xdffffc0000000041: 0000 [#1] PREEMPT SMP KASAN\\n KASAN: null-ptr-deref in range [0x0000000000000208-0x000000000000020f]\\n CPU: 1 PID: 34 Comm: kworker/u4:2 Not tainted 6.1.0-syzkaller-13872-gb6bb9676f216 #0\\n Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022\\n Workqueue: btrfs-qgroup-rescan btrfs_work_helper\\n RIP: 0010:start_transaction+0x48/0x10f0 fs/btrfs/transaction.c:564\\n Code: 48 89 fb 48 (...)\\n RSP: 0018:ffffc90000ab7ab0 EFLAGS: 00010206\\n RAX: 0000000000000041 RBX: 0000000000000208 RCX: ffff88801779ba80\\n RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000\\n RBP: dffffc0000000000 R08: 0000000000000001 R09: fffff52000156f5d\\n R10: fffff52000156f5d R11: 1ffff92000156f5c R12: 0000000000000000\\n R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000003\\n FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000\\n CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\\n CR2: 00007f2bea75b718 CR3: 000000001d0cc000 CR4: 00000000003506e0\\n DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\\n DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\\n Call Trace:\\n \u003cTASK\u003e\\n btrfs_qgroup_rescan_worker+0x3bb/0x6a0 fs/btrfs/qgroup.c:3402\\n btrfs_work_helper+0x312/0x850 fs/btrfs/async-thread.c:280\\n process_one_work+0x877/0xdb0 kernel/workqueue.c:2289\\n worker_thread+0xb14/0x1330 kernel/workqueue.c:2436\\n kthread+0x266/0x300 kernel/kthread.c:376\\n ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308\\n \u003c/TASK\u003e\\n Modules linked in:\\n\\nSo fix this by having the rescan worker function not attempt to start a\\ntransaction if it didn\u0027t do any rescan work.\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: btrfs: corrige la ejecuci\u00f3n entre el rescaneo de cuotas y la deshabilitaci\u00f3n que conduce a un puntero NULL deref. Si tenemos una tarea que intenta iniciar el trabajador de rescaneo de cuotas mientras otra intenta deshabilitar las cuotas, podemos finalizar hasta llegar a una ejecuci\u00f3n que resulta en que el trabajador de rescaneo de cuotas realice una desreferencia del puntero NULL. Los pasos para esto son los siguientes: 1) Se habilitan las cuotas; 2) La tarea A llama al ioctl de rescaneo de cuotas e ingresa btrfs_qgroup_rescan(). Llama a qgroup_rescan_init() que devuelve 0 (\u00e9xito) y luego se une a una transacci\u00f3n y la confirma; 3) La tarea B llama a ioctl de desactivaci\u00f3n de cuota e ingresa btrfs_quota_disable(). Borra el bit BTRFS_FS_QUOTA_ENABLED de fs_info-\u0026gt;flags y llama a btrfs_qgroup_wait_for_completion(), que regresa inmediatamente ya que el trabajador de rescaneo a\u00fan no se est\u00e1 ejecutando. Luego inicia una transacci\u00f3n y bloquea fs_info-\u0026gt;qgroup_ioctl_lock; 4) La tarea A pone en cola al trabajador que vuelve a escanear, llamando a btrfs_queue_work(); 5) El trabajador de rescaneo inicia y llama a rescan_should_stop() al inicio de su ciclo while, lo que resulta en 0 iteraciones del ciclo, ya que la bandera BTRFS_FS_QUOTA_ENABLED fue borrada de fs_info-\u0026gt;flags por la tarea B en el paso 3); 6) La tarea B establece fs_info-\u0026gt;quota_root en NULL; 7) El trabajador de rescaneo intenta iniciar una transacci\u00f3n y usa fs_info-\u0026gt;quota_root como argumento ra\u00edz para btrfs_start_transaction(). Esto da como resultado una desreferencia del puntero NULL en la cadena de llamadas de btrfs_start_transaction(). El seguimiento de la pila es similar al que se informa en la etiqueta de enlace a continuaci\u00f3n: falla de protecci\u00f3n general, probablemente para la direcci\u00f3n no can\u00f3nica 0xdffffc0000000041: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000208-0x0000000000000020f] CPU: 1 PID: 34 Comm: kworker/u4:2 No contaminado 6.1.0-syzkaller-13872-gb6bb9676f216 #0 Nombre del hardware: Google Google Compute Engine/Google Compute Engine, BIOS Google 26/10/2022 Cola de trabajo: btrfs-qgroup-rescan btrfs_work_helper RIP: 0010:start_transaction+0x48/0x10f0 fs/btrfs/transaction.c:564 C\u00f3digo: 48 89 fb 48 (...) RSP: 0018:ffffc90000ab7ab0 EFLAGS: 00010206 RAX: 0000000000000041 X: 0000000000000208 RCX: ffff88801779ba80 RDX: 00000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: dffffc0000000000 R08: 0000000000000001 R09: fffff52000156f5d R10: fffff52000156f5d R11: 2000156f5c R12: 0000000000000000 R13: 0000000000000001 R14: 0000000000000001 R15: 00000000000000003 FS: 0000000000000000(0000) 8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2bea75b718 CR3: 000000001d0cc000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 00000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Seguimiento de llamadas: / btrfs/qgroup.c:3402 btrfs_work_helper+0x312/0x850 fs/btrfs/async-thread.c:280 Process_one_work+0x877/0xdb0 kernel/workqueue.c:2289 trabajador_thread+0xb14/0x1330 kernel/workqueue.c:2436 kthread+0x266 /0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 M\u00f3dulos vinculados en: Solucione este problema haciendo que la funci\u00f3n de trabajo de rescaneo no intente iniciar una transacci\u00f3n si No hice ning\u00fan trabajo de reexploraci\u00f3n.\"}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H\",\"baseScore\":4.7,\"baseSeverity\":\"MEDIUM\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"HIGH\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"NONE\",\"integrityImpact\":\"NONE\",\"availabilityImpact\":\"HIGH\"},\"exploitabilityScore\":1.0,\"impactScore\":3.6}]},\"weaknesses\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-476\"}]}],\"configurations\":[{\"nodes\":[{\"operator\":\"OR\",\"negate\":false,\"cpeMatch\":[{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.4.178\",\"versionEndExcluding\":\"5.4.230\",\"matchCriteriaId\":\"E16E0383-9CED-439E-8DEC-DDDD9B142E64\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.10.99\",\"versionEndExcluding\":\"5.10.165\",\"matchCriteriaId\":\"5C13010D-C392-45FA-BB6D-957B35B6E33C\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.15.22\",\"versionEndExcluding\":\"5.15.90\",\"matchCriteriaId\":\"11ABF525-41F7-480A-8DEB-5BF11C1C0C44\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartExcluding\":\"5.16.8\",\"versionEndExcluding\":\"5.17\",\"matchCriteriaId\":\"F6E1B0A7-FD05-4730-935F-1A3481E6B3AF\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.17\",\"versionEndExcluding\":\"6.1.8\",\"matchCriteriaId\":\"3FB612E5-3EDB-46B7-95D9-1BA0CD61AA5E\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.2:rc1:*:*:*:*:*:*\",\"matchCriteriaId\":\"FF501633-2F44-4913-A8EE-B021929F49F6\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.2:rc2:*:*:*:*:*:*\",\"matchCriteriaId\":\"2BDA597B-CAC1-4DF0-86F0-42E142C654E9\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.2:rc3:*:*:*:*:*:*\",\"matchCriteriaId\":\"725C78C9-12CE-406F-ABE8-0813A01D66E8\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.2:rc4:*:*:*:*:*:*\",\"matchCriteriaId\":\"A127C155-689C-4F67-B146-44A57F4BFD85\"}]}]}],\"references\":[{\"url\":\"https://git.kernel.org/stable/c/1004fc90f0d79a4b7d9e3d432729914f472f9ad1\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/3bd43374857103ba3cac751d6d4afa8d83b5d92a\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/64287cd456a22373053998c1fccf14b651e9cbbd\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/89ac597e3e807b91e2ebd6a7c36fec7b97290233\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/b7adbf9ada3513d2092362c8eac5cddc5b651f5c\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]}]}}" } }
Loading…
Loading…
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.