cve-2024-35979
Vulnerability from cvelistv5
Published
2024-05-20 09:42
Modified
2024-08-02 03:21
Severity
Summary
raid1: fix use-after-free for original bio in raid1_write_request()
Impacted products
VendorProduct
LinuxLinux
LinuxLinux
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2024-35979",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-06-17T17:38:14.409469Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-06-17T17:40:22.888Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      },
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-02T03:21:49.042Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/3f28d49a328fe20926995d5fbdc92da665596268"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/f423f41b7679c09abb26d2bd54be5cbef23c9446"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/fcf3f7e2fc8a53a6140beee46ec782a4c88e4744"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "drivers/md/raid1.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "3f28d49a328f",
              "status": "affected",
              "version": "992db13a4aee",
              "versionType": "git"
            },
            {
              "lessThan": "f423f41b7679",
              "status": "affected",
              "version": "992db13a4aee",
              "versionType": "git"
            },
            {
              "lessThan": "fcf3f7e2fc8a",
              "status": "affected",
              "version": "992db13a4aee",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "drivers/md/raid1.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.6"
            },
            {
              "lessThan": "6.6",
              "status": "unaffected",
              "version": "0",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "6.6.*",
              "status": "unaffected",
              "version": "6.6.28",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "6.8.*",
              "status": "unaffected",
              "version": "6.8.7",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.9",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nraid1: fix use-after-free for original bio in raid1_write_request()\n\nr1_bio-\u003ebios[] is used to record new bios that will be issued to\nunderlying disks, however, in raid1_write_request(), r1_bio-\u003ebios[]\nwill set to the original bio temporarily. Meanwhile, if blocked rdev\nis set, free_r1bio() will be called causing that all r1_bio-\u003ebios[]\nto be freed:\n\nraid1_write_request()\n r1_bio = alloc_r1bio(mddev, bio); -\u003e r1_bio-\u003ebios[] is NULL\n for (i = 0;  i \u003c disks; i++) -\u003e for each rdev in conf\n  // first rdev is normal\n  r1_bio-\u003ebios[0] = bio; -\u003e set to original bio\n  // second rdev is blocked\n  if (test_bit(Blocked, \u0026rdev-\u003eflags))\n   break\n\n if (blocked_rdev)\n  free_r1bio()\n   put_all_bios()\n    bio_put(r1_bio-\u003ebios[0]) -\u003e original bio is freed\n\nTest scripts:\n\nmdadm -CR /dev/md0 -l1 -n4 /dev/sd[abcd] --assume-clean\nfio -filename=/dev/md0 -ioengine=libaio -rw=write -bs=4k -numjobs=1 \\\n    -iodepth=128 -name=test -direct=1\necho blocked \u003e /sys/block/md0/md/rd2/state\n\nTest result:\n\nBUG bio-264 (Not tainted): Object already free\n-----------------------------------------------------------------------------\n\nAllocated in mempool_alloc_slab+0x24/0x50 age=1 cpu=1 pid=869\n kmem_cache_alloc+0x324/0x480\n mempool_alloc_slab+0x24/0x50\n mempool_alloc+0x6e/0x220\n bio_alloc_bioset+0x1af/0x4d0\n blkdev_direct_IO+0x164/0x8a0\n blkdev_write_iter+0x309/0x440\n aio_write+0x139/0x2f0\n io_submit_one+0x5ca/0xb70\n __do_sys_io_submit+0x86/0x270\n __x64_sys_io_submit+0x22/0x30\n do_syscall_64+0xb1/0x210\n entry_SYSCALL_64_after_hwframe+0x6c/0x74\nFreed in mempool_free_slab+0x1f/0x30 age=1 cpu=1 pid=869\n kmem_cache_free+0x28c/0x550\n mempool_free_slab+0x1f/0x30\n mempool_free+0x40/0x100\n bio_free+0x59/0x80\n bio_put+0xf0/0x220\n free_r1bio+0x74/0xb0\n raid1_make_request+0xadf/0x1150\n md_handle_request+0xc7/0x3b0\n md_submit_bio+0x76/0x130\n __submit_bio+0xd8/0x1d0\n submit_bio_noacct_nocheck+0x1eb/0x5c0\n submit_bio_noacct+0x169/0xd40\n submit_bio+0xee/0x1d0\n blkdev_direct_IO+0x322/0x8a0\n blkdev_write_iter+0x309/0x440\n aio_write+0x139/0x2f0\n\nSince that bios for underlying disks are not allocated yet, fix this\nproblem by using mempool_free() directly to free the r1_bio."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2024-05-29T05:32:20.786Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/3f28d49a328fe20926995d5fbdc92da665596268"
        },
        {
          "url": "https://git.kernel.org/stable/c/f423f41b7679c09abb26d2bd54be5cbef23c9446"
        },
        {
          "url": "https://git.kernel.org/stable/c/fcf3f7e2fc8a53a6140beee46ec782a4c88e4744"
        }
      ],
      "title": "raid1: fix use-after-free for original bio in raid1_write_request()",
      "x_generator": {
        "engine": "bippy-a5840b7849dd"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2024-35979",
    "datePublished": "2024-05-20T09:42:04.424Z",
    "dateReserved": "2024-05-17T13:50:33.144Z",
    "dateUpdated": "2024-08-02T03:21:49.042Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2024-35979\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-05-20T10:15:12.480\",\"lastModified\":\"2024-05-20T13:00:04.957\",\"vulnStatus\":\"Awaiting Analysis\",\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nraid1: fix use-after-free for original bio in raid1_write_request()\\n\\nr1_bio-\u003ebios[] is used to record new bios that will be issued to\\nunderlying disks, however, in raid1_write_request(), r1_bio-\u003ebios[]\\nwill set to the original bio temporarily. Meanwhile, if blocked rdev\\nis set, free_r1bio() will be called causing that all r1_bio-\u003ebios[]\\nto be freed:\\n\\nraid1_write_request()\\n r1_bio = alloc_r1bio(mddev, bio); -\u003e r1_bio-\u003ebios[] is NULL\\n for (i = 0;  i \u003c disks; i++) -\u003e for each rdev in conf\\n  // first rdev is normal\\n  r1_bio-\u003ebios[0] = bio; -\u003e set to original bio\\n  // second rdev is blocked\\n  if (test_bit(Blocked, \u0026rdev-\u003eflags))\\n   break\\n\\n if (blocked_rdev)\\n  free_r1bio()\\n   put_all_bios()\\n    bio_put(r1_bio-\u003ebios[0]) -\u003e original bio is freed\\n\\nTest scripts:\\n\\nmdadm -CR /dev/md0 -l1 -n4 /dev/sd[abcd] --assume-clean\\nfio -filename=/dev/md0 -ioengine=libaio -rw=write -bs=4k -numjobs=1 \\\\\\n    -iodepth=128 -name=test -direct=1\\necho blocked \u003e /sys/block/md0/md/rd2/state\\n\\nTest result:\\n\\nBUG bio-264 (Not tainted): Object already free\\n-----------------------------------------------------------------------------\\n\\nAllocated in mempool_alloc_slab+0x24/0x50 age=1 cpu=1 pid=869\\n kmem_cache_alloc+0x324/0x480\\n mempool_alloc_slab+0x24/0x50\\n mempool_alloc+0x6e/0x220\\n bio_alloc_bioset+0x1af/0x4d0\\n blkdev_direct_IO+0x164/0x8a0\\n blkdev_write_iter+0x309/0x440\\n aio_write+0x139/0x2f0\\n io_submit_one+0x5ca/0xb70\\n __do_sys_io_submit+0x86/0x270\\n __x64_sys_io_submit+0x22/0x30\\n do_syscall_64+0xb1/0x210\\n entry_SYSCALL_64_after_hwframe+0x6c/0x74\\nFreed in mempool_free_slab+0x1f/0x30 age=1 cpu=1 pid=869\\n kmem_cache_free+0x28c/0x550\\n mempool_free_slab+0x1f/0x30\\n mempool_free+0x40/0x100\\n bio_free+0x59/0x80\\n bio_put+0xf0/0x220\\n free_r1bio+0x74/0xb0\\n raid1_make_request+0xadf/0x1150\\n md_handle_request+0xc7/0x3b0\\n md_submit_bio+0x76/0x130\\n __submit_bio+0xd8/0x1d0\\n submit_bio_noacct_nocheck+0x1eb/0x5c0\\n submit_bio_noacct+0x169/0xd40\\n submit_bio+0xee/0x1d0\\n blkdev_direct_IO+0x322/0x8a0\\n blkdev_write_iter+0x309/0x440\\n aio_write+0x139/0x2f0\\n\\nSince that bios for underlying disks are not allocated yet, fix this\\nproblem by using mempool_free() directly to free the r1_bio.\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se resolvi\u00f3 la siguiente vulnerabilidad: raid1: corrige el uso despu\u00e9s de liberar la biograf\u00eda original en raid1_write_request() r1_bio-\u0026gt;bios[] se usa para registrar nuevas biograf\u00edas que se emitir\u00e1n a los discos subyacentes; sin embargo, en raid1_write_request(), r1_bio-\u0026gt;bios[] se configurar\u00e1 temporalmente en la biograf\u00eda original. Mientras tanto, si se establece rdev bloqueado, se llamar\u00e1 a free_r1bio() causando que todos los r1_bio-\u0026gt;bios[] sean liberados: raid1_write_request() r1_bio = alloc_r1bio(mddev, bio); -\u0026gt; r1_bio-\u0026gt;bios[] es NULL para (i = 0; i \u0026lt; discos; i++) -\u0026gt; para cada rdev en conf // el primer rdev es normal r1_bio-\u0026gt;bios[0] = bio; -\u0026gt; establecer en biograf\u00eda original // el segundo rdev est\u00e1 bloqueado si (test_bit(Blocked, \u0026amp;rdev-\u0026gt;flags)) break if (blocked_rdev) free_r1bio() put_all_bios() bio_put(r1_bio-\u0026gt;bios[0]) -\u0026gt; biograf\u00eda original es Scripts de prueba liberados: mdadm -CR /dev/md0 -l1 -n4 /dev/sd[abcd] --assume-clean fio -filename=/dev/md0 -ioengine=libaio -rw=write -bs=4k -numjobs= 1 \\\\ -io Depth=128 -name=test -direct=1 eco bloqueado \u0026gt; /sys/block/md0/md/rd2/state Resultado de la prueba: ERROR bio-264 (No contaminado): Objeto ya libre ------ -------------------------------------------------- --------------------- Asignado en mempool_alloc_slab+0x24/0x50 age=1 cpu=1 pid=869 kmem_cache_alloc+0x324/0x480 mempool_alloc_slab+0x24/0x50 mempool_alloc+0x6e /0x220 bio_alloc_bioset+0x1af/0x4d0 blkdev_direct_IO+0x164/0x8a0 blkdev_write_iter+0x309/0x440 aio_write+0x139/0x2f0 io_submit_one+0x5ca/0xb70 __do_sys_io_submit+0x86/0x270 __x64_sys_io_submit+0x22/0x30 do_syscall_64+0xb1/0x210 Entry_SYSCALL_64_after_hwframe+0x6c/0x74 Liberado en mempool_free_slab +0x1f/0x30 edad=1 cpu=1 pid=869 kmem_cache_free+0x28c/0x550 mempool_free_slab+0x1f/0x30 mempool_free+0x40/0x100 bio_free+0x59/0x80 bio_put+0xf0/0x220 free_r1bio+0x74/0xb0 raid1_make_ request+0xadf/0x1150 md_handle_request+ 0xc7/0x3b0 md_submit_bio+0x76/0x130 __submit_bio+0xd8/0x1d0 submit_bio_noacct_nocheck+0x1eb/0x5c0 submit_bio_noacct+0x169/0xd40 submit_bio+0xee/0x1d0 blkdev_direct_IO+0x322/0x8a0 _write_iter+0x309/0x440 aio_write+0x139/0x2f0 Dado que las BIOS para los discos subyacentes son a\u00fan no asignado, solucione este problema usando mempool_free() directamente para liberar r1_bio.\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/3f28d49a328fe20926995d5fbdc92da665596268\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/f423f41b7679c09abb26d2bd54be5cbef23c9446\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/fcf3f7e2fc8a53a6140beee46ec782a4c88e4744\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading...

Loading...