CVE-2021-47256

Source
https://cve.org/CVERecord?id=CVE-2021-47256
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-47256.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2021-47256
Downstream
Published
2024-05-21T15:15:14.380Z
Modified
2026-03-15T22:43:09.389736Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
[none]
Details

In the Linux kernel, the following vulnerability has been resolved:

mm/memory-failure: make sure wait for page writeback in memory_failure

Our syzkaller trigger the "BUGON(!listempty(&inode->iwblist))" in clear_inode:

kernel BUG at fs/inode.c:519! Internal error: Oops - BUG: 0 [#1] SMP Modules linked in: Process syz-executor.0 (pid: 249, stack limit = 0x00000000a12409d7) CPU: 1 PID: 249 Comm: syz-executor.0 Not tainted 4.19.95 Hardware name: linux,dummy-virt (DT) pstate: 80000005 (Nzcv daif -PAN -UAO) pc : clearinode+0x280/0x2a8 lr : clearinode+0x280/0x2a8 Call trace: clearinode+0x280/0x2a8 ext4clearinode+0x38/0xe8 ext4freeinode+0x130/0xc68 ext4evictinode+0xb20/0xcb8 evict+0x1a8/0x3c0 iput+0x344/0x460 dounlinkat+0x260/0x410 _arm64sysunlinkat+0x6c/0xc0 el0svccommon+0xdc/0x3b0 el0svchandler+0xf8/0x160 el0svc+0x10/0x218 Kernel panic - not syncing: Fatal exception

A crash dump of this problem show that someone called __munlockpagevec to clear page LRU without lockpage: dommap -> mmapregion -> domunmap -> munlockvmapagesrange -> _munlockpagevec.

As a result memoryfailure will call identifypagestate without waitonpagewriteback. And after truncateerrorpage clear the mapping of this page. endpagewriteback won't call sbclearinodewriteback to clear inode->iwblist. That will trigger BUGON in clear_inode!

Fix it by checking PageWriteback too to help determine should we skip waitonpage_writeback.

References

Affected packages

Git /

Affected ranges

Database specific

unresolved_ranges
[
    {
        "events": [
            {
                "introduced": "3.16"
            },
            {
                "fixed": "4.14.238"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "4.15"
            },
            {
                "fixed": "4.19.196"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "4.20"
            },
            {
                "fixed": "5.4.128"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "5.5"
            },
            {
                "fixed": "5.10.46"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "5.11"
            },
            {
                "fixed": "5.12.13"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.13-rc1"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.13-rc2"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.13-rc3"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.13-rc4"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.13-rc5"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.13-rc6"
            }
        ]
    }
]
source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-47256.json"