cve-2021-47460
Vulnerability from cvelistv5
Published
2024-05-22 06:23
Modified
2024-12-19 07:42
Severity ?
Summary
In the Linux kernel, the following vulnerability has been resolved: ocfs2: fix data corruption after conversion from inline format Commit 6dbf7bb55598 ("fs: Don't invalidate page buffers in block_write_full_page()") uncovered a latent bug in ocfs2 conversion from inline inode format to a normal inode format. The code in ocfs2_convert_inline_data_to_extents() attempts to zero out the whole cluster allocated for file data by grabbing, zeroing, and dirtying all pages covering this cluster. However these pages are beyond i_size, thus writeback code generally ignores these dirty pages and no blocks were ever actually zeroed on the disk. This oversight was fixed by commit 693c241a5f6a ("ocfs2: No need to zero pages past i_size.") for standard ocfs2 write path, inline conversion path was apparently forgotten; the commit log also has a reasoning why the zeroing actually is not needed. After commit 6dbf7bb55598, things became worse as writeback code stopped invalidating buffers on pages beyond i_size and thus these pages end up with clean PageDirty bit but with buffers attached to these pages being still dirty. So when a file is converted from inline format, then writeback triggers, and then the file is grown so that these pages become valid, the invalid dirtiness state is preserved, mark_buffer_dirty() does nothing on these pages (buffers are already dirty) but page is never written back because it is clean. So data written to these pages is lost once pages are reclaimed. Simple reproducer for the problem is: xfs_io -f -c "pwrite 0 2000" -c "pwrite 2000 2000" -c "fsync" \ -c "pwrite 4000 2000" ocfs2_file After unmounting and mounting the fs again, you can observe that end of 'ocfs2_file' has lost its contents. Fix the problem by not doing the pointless zeroing during conversion from inline format similarly as in the standard write path. [akpm@linux-foundation.org: fix whitespace, per Joseph]
References
416baaa9-dc9f-4396-8d5f-8c081fb06d67https://git.kernel.org/stable/c/5314454ea3ff6fc746eaf71b9a7ceebed52888fa
416baaa9-dc9f-4396-8d5f-8c081fb06d67https://git.kernel.org/stable/c/560edd14de2bf9dbc0129681eeb4d5ef87cc105f
416baaa9-dc9f-4396-8d5f-8c081fb06d67https://git.kernel.org/stable/c/8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e
416baaa9-dc9f-4396-8d5f-8c081fb06d67https://git.kernel.org/stable/c/a3a089c241cd49b33a8cdd7fcb37cc87a086912a
416baaa9-dc9f-4396-8d5f-8c081fb06d67https://git.kernel.org/stable/c/b05caf023b14cbed9223bb5b48ecc7bffe38f632
416baaa9-dc9f-4396-8d5f-8c081fb06d67https://git.kernel.org/stable/c/f1b98569e81c37d7e0deada7172f8f60860c1360
416baaa9-dc9f-4396-8d5f-8c081fb06d67https://git.kernel.org/stable/c/fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08
af854a3a-2127-422b-91ae-364da2661108https://git.kernel.org/stable/c/5314454ea3ff6fc746eaf71b9a7ceebed52888fa
af854a3a-2127-422b-91ae-364da2661108https://git.kernel.org/stable/c/560edd14de2bf9dbc0129681eeb4d5ef87cc105f
af854a3a-2127-422b-91ae-364da2661108https://git.kernel.org/stable/c/8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e
af854a3a-2127-422b-91ae-364da2661108https://git.kernel.org/stable/c/a3a089c241cd49b33a8cdd7fcb37cc87a086912a
af854a3a-2127-422b-91ae-364da2661108https://git.kernel.org/stable/c/b05caf023b14cbed9223bb5b48ecc7bffe38f632
af854a3a-2127-422b-91ae-364da2661108https://git.kernel.org/stable/c/f1b98569e81c37d7e0deada7172f8f60860c1360
af854a3a-2127-422b-91ae-364da2661108https://git.kernel.org/stable/c/fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08
Impacted products
Vendor Product Version
Linux Linux Version: 5.10
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2021-47460",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-06-26T14:38:02.997186Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-06-26T14:38:12.616Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      },
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-04T05:39:58.992Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/560edd14de2bf9dbc0129681eeb4d5ef87cc105f"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/a3a089c241cd49b33a8cdd7fcb37cc87a086912a"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/b05caf023b14cbed9223bb5b48ecc7bffe38f632"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/f1b98569e81c37d7e0deada7172f8f60860c1360"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/5314454ea3ff6fc746eaf71b9a7ceebed52888fa"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "fs/ocfs2/alloc.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "560edd14de2bf9dbc0129681eeb4d5ef87cc105f",
              "status": "affected",
              "version": "acef5107e2eacb08a16ad5db60320d65bd26a6c0",
              "versionType": "git"
            },
            {
              "lessThan": "8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e",
              "status": "affected",
              "version": "7ed80e77c908cbaa686529a49f8ae0060c5caee7",
              "versionType": "git"
            },
            {
              "lessThan": "a3a089c241cd49b33a8cdd7fcb37cc87a086912a",
              "status": "affected",
              "version": "7ce2b16bad2cbfa3fa7bbc42c4448914f639ca47",
              "versionType": "git"
            },
            {
              "lessThan": "b05caf023b14cbed9223bb5b48ecc7bffe38f632",
              "status": "affected",
              "version": "f8a6a2ed4b7d1c3c8631eeb6d00572bc853094a8",
              "versionType": "git"
            },
            {
              "lessThan": "f1b98569e81c37d7e0deada7172f8f60860c1360",
              "status": "affected",
              "version": "6dbf7bb555981fb5faf7b691e8f6169fc2b2e63b",
              "versionType": "git"
            },
            {
              "lessThan": "fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08",
              "status": "affected",
              "version": "6dbf7bb555981fb5faf7b691e8f6169fc2b2e63b",
              "versionType": "git"
            },
            {
              "lessThan": "5314454ea3ff6fc746eaf71b9a7ceebed52888fa",
              "status": "affected",
              "version": "6dbf7bb555981fb5faf7b691e8f6169fc2b2e63b",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "fs/ocfs2/alloc.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "5.10"
            },
            {
              "lessThan": "5.10",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "4.9.*",
              "status": "unaffected",
              "version": "4.9.288",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "4.14.*",
              "status": "unaffected",
              "version": "4.14.253",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "4.19.*",
              "status": "unaffected",
              "version": "4.19.214",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.4.*",
              "status": "unaffected",
              "version": "5.4.156",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.76",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.14.*",
              "status": "unaffected",
              "version": "5.14.15",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "5.15",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: fix data corruption after conversion from inline format\n\nCommit 6dbf7bb55598 (\"fs: Don\u0027t invalidate page buffers in\nblock_write_full_page()\") uncovered a latent bug in ocfs2 conversion\nfrom inline inode format to a normal inode format.\n\nThe code in ocfs2_convert_inline_data_to_extents() attempts to zero out\nthe whole cluster allocated for file data by grabbing, zeroing, and\ndirtying all pages covering this cluster.  However these pages are\nbeyond i_size, thus writeback code generally ignores these dirty pages\nand no blocks were ever actually zeroed on the disk.\n\nThis oversight was fixed by commit 693c241a5f6a (\"ocfs2: No need to zero\npages past i_size.\") for standard ocfs2 write path, inline conversion\npath was apparently forgotten; the commit log also has a reasoning why\nthe zeroing actually is not needed.\n\nAfter commit 6dbf7bb55598, things became worse as writeback code stopped\ninvalidating buffers on pages beyond i_size and thus these pages end up\nwith clean PageDirty bit but with buffers attached to these pages being\nstill dirty.  So when a file is converted from inline format, then\nwriteback triggers, and then the file is grown so that these pages\nbecome valid, the invalid dirtiness state is preserved,\nmark_buffer_dirty() does nothing on these pages (buffers are already\ndirty) but page is never written back because it is clean.  So data\nwritten to these pages is lost once pages are reclaimed.\n\nSimple reproducer for the problem is:\n\n  xfs_io -f -c \"pwrite 0 2000\" -c \"pwrite 2000 2000\" -c \"fsync\" \\\n    -c \"pwrite 4000 2000\" ocfs2_file\n\nAfter unmounting and mounting the fs again, you can observe that end of\n\u0027ocfs2_file\u0027 has lost its contents.\n\nFix the problem by not doing the pointless zeroing during conversion\nfrom inline format similarly as in the standard write path.\n\n[akpm@linux-foundation.org: fix whitespace, per Joseph]"
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2024-12-19T07:42:49.842Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/560edd14de2bf9dbc0129681eeb4d5ef87cc105f"
        },
        {
          "url": "https://git.kernel.org/stable/c/8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e"
        },
        {
          "url": "https://git.kernel.org/stable/c/a3a089c241cd49b33a8cdd7fcb37cc87a086912a"
        },
        {
          "url": "https://git.kernel.org/stable/c/b05caf023b14cbed9223bb5b48ecc7bffe38f632"
        },
        {
          "url": "https://git.kernel.org/stable/c/f1b98569e81c37d7e0deada7172f8f60860c1360"
        },
        {
          "url": "https://git.kernel.org/stable/c/fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08"
        },
        {
          "url": "https://git.kernel.org/stable/c/5314454ea3ff6fc746eaf71b9a7ceebed52888fa"
        }
      ],
      "title": "ocfs2: fix data corruption after conversion from inline format",
      "x_generator": {
        "engine": "bippy-5f407fcff5a0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2021-47460",
    "datePublished": "2024-05-22T06:23:21.724Z",
    "dateReserved": "2024-05-22T06:20:56.197Z",
    "dateUpdated": "2024-12-19T07:42:49.842Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2021-47460\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-05-22T07:15:10.940\",\"lastModified\":\"2024-11-21T06:36:11.843\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nocfs2: fix data corruption after conversion from inline format\\n\\nCommit 6dbf7bb55598 (\\\"fs: Don\u0027t invalidate page buffers in\\nblock_write_full_page()\\\") uncovered a latent bug in ocfs2 conversion\\nfrom inline inode format to a normal inode format.\\n\\nThe code in ocfs2_convert_inline_data_to_extents() attempts to zero out\\nthe whole cluster allocated for file data by grabbing, zeroing, and\\ndirtying all pages covering this cluster.  However these pages are\\nbeyond i_size, thus writeback code generally ignores these dirty pages\\nand no blocks were ever actually zeroed on the disk.\\n\\nThis oversight was fixed by commit 693c241a5f6a (\\\"ocfs2: No need to zero\\npages past i_size.\\\") for standard ocfs2 write path, inline conversion\\npath was apparently forgotten; the commit log also has a reasoning why\\nthe zeroing actually is not needed.\\n\\nAfter commit 6dbf7bb55598, things became worse as writeback code stopped\\ninvalidating buffers on pages beyond i_size and thus these pages end up\\nwith clean PageDirty bit but with buffers attached to these pages being\\nstill dirty.  So when a file is converted from inline format, then\\nwriteback triggers, and then the file is grown so that these pages\\nbecome valid, the invalid dirtiness state is preserved,\\nmark_buffer_dirty() does nothing on these pages (buffers are already\\ndirty) but page is never written back because it is clean.  So data\\nwritten to these pages is lost once pages are reclaimed.\\n\\nSimple reproducer for the problem is:\\n\\n  xfs_io -f -c \\\"pwrite 0 2000\\\" -c \\\"pwrite 2000 2000\\\" -c \\\"fsync\\\" \\\\\\n    -c \\\"pwrite 4000 2000\\\" ocfs2_file\\n\\nAfter unmounting and mounting the fs again, you can observe that end of\\n\u0027ocfs2_file\u0027 has lost its contents.\\n\\nFix the problem by not doing the pointless zeroing during conversion\\nfrom inline format similarly as in the standard write path.\\n\\n[akpm@linux-foundation.org: fix whitespace, per Joseph]\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se resolvi\u00f3 la siguiente vulnerabilidad: ocfs2: corrige la corrupci\u00f3n de datos despu\u00e9s de la conversi\u00f3n desde el formato en l\u00ednea. el commit 6dbf7bb55598 (\\\"fs: No invalide los buffers de p\u00e1gina en block_write_full_page()\\\") descubri\u00f3 un error latente en la conversi\u00f3n de ocfs2 desde el inodo en l\u00ednea. formato a un formato de inodo normal. El c\u00f3digo en ocfs2_convert_inline_data_to_extents() intenta poner a cero todo el cl\u00faster asignado para datos de archivos capturando, poniendo a cero y ensuciando todas las p\u00e1ginas que cubren este cl\u00faster. Sin embargo, estas p\u00e1ginas est\u00e1n m\u00e1s all\u00e1 de i_size, por lo que el c\u00f3digo de reescritura generalmente ignora estas p\u00e1ginas sucias y nunca se puso a cero ning\u00fan bloque en el disco. Este descuido se solucion\u00f3 mediante el commit 693c241a5f6a (\\\"ocfs2: No es necesario poner a cero las p\u00e1ginas despu\u00e9s de i_size.\\\") para la ruta de escritura est\u00e1ndar de ocfs2, la ruta de conversi\u00f3n en l\u00ednea aparentemente se olvid\u00f3; el registro de confirmaci\u00f3n tambi\u00e9n tiene un razonamiento por el cual la puesta a cero en realidad no es necesaria. Despu\u00e9s de el commit 6dbf7bb55598, las cosas empeoraron ya que el c\u00f3digo de reescritura dej\u00f3 de invalidar los buffers en p\u00e1ginas m\u00e1s all\u00e1 de i_size y, por lo tanto, estas p\u00e1ginas terminan con un bit PageDirty limpio pero con los b\u00faferes adjuntos a estas p\u00e1ginas todav\u00eda sucios. Entonces, cuando un archivo se convierte desde un formato en l\u00ednea, se activa la reescritura y luego el archivo crece para que estas p\u00e1ginas se vuelvan v\u00e1lidas, se conserva el estado de suciedad no v\u00e1lido, mark_buffer_dirty() no hace nada en estas p\u00e1ginas (los b\u00faferes ya est\u00e1n sucios), excepto la p\u00e1gina nunca se vuelve a escribir porque est\u00e1 limpio. Por lo tanto, los datos escritos en estas p\u00e1ginas se pierden una vez que se recuperan las p\u00e1ginas. El reproductor simple para el problema es: xfs_io -f -c \\\"pwrite 0 2000\\\" -c \\\"pwrite 2000 2000\\\" -c \\\"fsync\\\" \\\\ -c \\\"pwrite 4000 2000\\\" ocfs2_file Despu\u00e9s de desmontar y montar el fs nuevamente, puede observar que El final de \u0027ocfs2_file\u0027 ha perdido su contenido. Solucione el problema al no realizar la puesta a cero in\u00fatil durante la conversi\u00f3n desde el formato en l\u00ednea de manera similar a como lo hace en la ruta de escritura est\u00e1ndar. [akpm@linux-foundation.org: arreglar espacios en blanco, seg\u00fan Joseph]\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/5314454ea3ff6fc746eaf71b9a7ceebed52888fa\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/560edd14de2bf9dbc0129681eeb4d5ef87cc105f\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/a3a089c241cd49b33a8cdd7fcb37cc87a086912a\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/b05caf023b14cbed9223bb5b48ecc7bffe38f632\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/f1b98569e81c37d7e0deada7172f8f60860c1360\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/5314454ea3ff6fc746eaf71b9a7ceebed52888fa\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"},{\"url\":\"https://git.kernel.org/stable/c/560edd14de2bf9dbc0129681eeb4d5ef87cc105f\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"},{\"url\":\"https://git.kernel.org/stable/c/8e6bfb4f70168ddfd32fb6dc028ad52faaf1f32e\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"},{\"url\":\"https://git.kernel.org/stable/c/a3a089c241cd49b33a8cdd7fcb37cc87a086912a\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"},{\"url\":\"https://git.kernel.org/stable/c/b05caf023b14cbed9223bb5b48ecc7bffe38f632\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"},{\"url\":\"https://git.kernel.org/stable/c/f1b98569e81c37d7e0deada7172f8f60860c1360\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"},{\"url\":\"https://git.kernel.org/stable/c/fa9b6b6c953e3f6441ed6cf83b4c771dac2dae08\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

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.