In the Linux kernel, the following vulnerability has been resolved:
ext4: avoid crash when inline data creation follows DIO write
When inode is created and written to using direct IO, there is nothing to clear the EXT4STATEMAYINLINEDATA flag. Thus when inode gets truncated later to say 1 byte and written using normal write, we will try to store the data as inline data. This confuses the code later because the inode now has both normal block and inline data allocated and the confusion manifests for example as:
kernel BUG at fs/ext4/inode.c:2721! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 359 Comm: repro Not tainted 5.19.0-rc8-00001-g31ba1e3b8305-dirty #15 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014 RIP: 0010:ext4writepages+0x363d/0x3660 RSP: 0018:ffffc90000ccf260 EFLAGS: 00010293 RAX: ffffffff81e1abcd RBX: 0000008000000000 RCX: ffff88810842a180 RDX: 0000000000000000 RSI: 0000008000000000 RDI: 0000000000000000 RBP: ffffc90000ccf650 R08: ffffffff81e17d58 R09: ffffed10222c680b R10: dfffe910222c680c R11: 1ffff110222c680a R12: ffff888111634128 R13: ffffc90000ccf880 R14: 0000008410000000 R15: 0000000000000001 FS: 00007f72635d2640(0000) GS:ffff88811b000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000565243379180 CR3: 000000010aa74000 CR4: 0000000000150eb0 Call Trace: <TASK> dowritepages+0x397/0x640 filemapfdatawritewbc+0x151/0x1b0 filewriteandwaitrange+0x1c9/0x2b0 ext4syncfile+0x19e/0xa00 vfsfsyncrange+0x17b/0x190 ext4bufferedwriteiter+0x488/0x530 ext4filewriteiter+0x449/0x1b90 vfswrite+0xbcd/0xf40 ksyswrite+0x198/0x2c0 _x64syswrite+0x7b/0x90 dosyscall64+0x3d/0x90 entrySYSCALL64after_hwframe+0x63/0xcd </TASK>
Fix the problem by clearing EXT4STATEMAYINLINEDATA when we are doing direct IO write to a file.
{ "vanir_signatures": [ { "id": "CVE-2022-50435-021fe4fe", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_llseek" }, "deprecated": false, "digest": { "length": 671.0, "function_hash": "61989564723857361117484216245830193273" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a22f52d883313bbfaf864669c14003f9456d4f8f" }, { "id": "CVE-2022-50435-078fb4e7", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_dio_write_iter" }, "deprecated": false, "digest": { "length": 1894.0, "function_hash": "192364577228025347049680391653960134249" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fb98cb61efff3b2a1964939465ccaaf906af1d4f" }, { "id": "CVE-2022-50435-09e75d7a", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_dio_write_iter" }, "deprecated": false, "digest": { "length": 1886.0, "function_hash": "103752031485644135062512102513946857931" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4bb26f2885ac6930984ee451b952c5a6042f2c0e" }, { "id": "CVE-2022-50435-21f59c52", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_llseek" }, "deprecated": false, "digest": { "length": 671.0, "function_hash": "61989564723857361117484216245830193273" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@59b108630a4987f71e1dc1dc50b8062e992b49c6" }, { "id": "CVE-2022-50435-53839142", "signature_type": "Line", "target": { "file": "fs/ext4/file.c" }, "deprecated": false, "digest": { "line_hashes": [ "143350117905216535820499029686339371984", "145793737005063838316782858203151223274", "240202720903266651503836172016147008730", "22896558214450563531472158912990253015" ], "threshold": 0.9 }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@771f15782d95760cde352c8d4bfd6f2c70719568" }, { "id": "CVE-2022-50435-704170c1", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_dio_write_iter" }, "deprecated": false, "digest": { "length": 1886.0, "function_hash": "103752031485644135062512102513946857931" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@89db2b50469bdbccb06ab072096d9d403124abac" }, { "id": "CVE-2022-50435-74b1e01c", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_dio_write_iter" }, "deprecated": false, "digest": { "length": 1907.0, "function_hash": "144561195181638616571241706769850358288" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d8e4af8314df54d94cf2a541cf9c8626afe81d41" }, { "id": "CVE-2022-50435-777861c5", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_seek_data" }, "deprecated": false, "digest": { "length": 933.0, "function_hash": "128795000127680035780298492785418497681" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@43ed16910af200e2fcfe16986bee1a67fba94992" }, { "id": "CVE-2022-50435-7b2909f1", "signature_type": "Line", "target": { "file": "fs/ext4/file.c" }, "deprecated": false, "digest": { "line_hashes": [ "143350117905216535820499029686339371984", "145793737005063838316782858203151223274", "240202720903266651503836172016147008730", "22896558214450563531472158912990253015" ], "threshold": 0.9 }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@89db2b50469bdbccb06ab072096d9d403124abac" }, { "id": "CVE-2022-50435-8012ff4e", "signature_type": "Line", "target": { "file": "fs/ext4/file.c" }, "deprecated": false, "digest": { "line_hashes": [ "209066030498419429685630873256754388641", "240858088214217814625673096092945613742", "292339948581272283842475148338896510249", "106411684533375302388979193499135913129" ], "threshold": 0.9 }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a22f52d883313bbfaf864669c14003f9456d4f8f" }, { "id": "CVE-2022-50435-c8820494", "signature_type": "Line", "target": { "file": "fs/ext4/file.c" }, "deprecated": false, "digest": { "line_hashes": [ "143350117905216535820499029686339371984", "145793737005063838316782858203151223274", "240202720903266651503836172016147008730", "22896558214450563531472158912990253015" ], "threshold": 0.9 }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4bb26f2885ac6930984ee451b952c5a6042f2c0e" }, { "id": "CVE-2022-50435-cff7718a", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_dio_write_iter" }, "deprecated": false, "digest": { "length": 1886.0, "function_hash": "103752031485644135062512102513946857931" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@771f15782d95760cde352c8d4bfd6f2c70719568" }, { "id": "CVE-2022-50435-d0d7696c", "signature_type": "Line", "target": { "file": "fs/ext4/file.c" }, "deprecated": false, "digest": { "line_hashes": [ "143350117905216535820499029686339371984", "145793737005063838316782858203151223274", "240202720903266651503836172016147008730", "22896558214450563531472158912990253015" ], "threshold": 0.9 }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d8e4af8314df54d94cf2a541cf9c8626afe81d41" }, { "id": "CVE-2022-50435-d57ebd51", "signature_type": "Line", "target": { "file": "fs/ext4/file.c" }, "deprecated": false, "digest": { "line_hashes": [ "209066030498419429685630873256754388641", "240858088214217814625673096092945613742", "292339948581272283842475148338896510249", "106411684533375302388979193499135913129" ], "threshold": 0.9 }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@59b108630a4987f71e1dc1dc50b8062e992b49c6" }, { "id": "CVE-2022-50435-dfa0eab3", "signature_type": "Function", "target": { "file": "fs/ext4/file.c", "function": "ext4_seek_data" }, "deprecated": false, "digest": { "length": 933.0, "function_hash": "128795000127680035780298492785418497681" }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3b31cc533665899965e351aae6cc3c3f3b9cc076" }, { "id": "CVE-2022-50435-ecee1268", "signature_type": "Line", "target": { "file": "fs/ext4/file.c" }, "deprecated": false, "digest": { "line_hashes": [ "143350117905216535820499029686339371984", "145793737005063838316782858203151223274", "240202720903266651503836172016147008730", "22896558214450563531472158912990253015" ], "threshold": 0.9 }, "signature_version": "v1", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fb98cb61efff3b2a1964939465ccaaf906af1d4f" } ] }