In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to do sanity check on ixattrnid in sanitycheckinode()
syzbot reports a kernel bug as below:
BUG: KASAN: slab-out-of-bounds in f2fstestbit fs/f2fs/f2fs.h:2933 [inline] BUG: KASAN: slab-out-of-bounds in currentnataddr fs/f2fs/node.h:213 [inline] BUG: KASAN: slab-out-of-bounds in f2fsgetnode_info+0xece/0x1200 fs/f2fs/node.c:600 Read of size 1 at addr ffff88807a58c76c by task syz-executor280/5076
CPU: 1 PID: 5076 Comm: syz-executor280 Not tainted 6.9.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: <TASK> _dumpstack lib/dumpstack.c:88 [inline] dumpstacklvl+0x241/0x360 lib/dumpstack.c:114 printaddressdescription mm/kasan/report.c:377 [inline] printreport+0x169/0x550 mm/kasan/report.c:488 kasanreport+0x143/0x180 mm/kasan/report.c:601 f2fstestbit fs/f2fs/f2fs.h:2933 [inline] currentnataddr fs/f2fs/node.h:213 [inline] f2fsgetnodeinfo+0xece/0x1200 fs/f2fs/node.c:600 f2fsxattrfiemap fs/f2fs/data.c:1848 [inline] f2fsfiemap+0x55d/0x1ee0 fs/f2fs/data.c:1925 ioctlfiemap fs/ioctl.c:220 [inline] dovfsioctl+0x1c07/0x2e50 fs/ioctl.c:838 _dosysioctl fs/ioctl.c:902 [inline] _sesysioctl+0x81/0x170 fs/ioctl.c:890 dosyscallx64 arch/x86/entry/common.c:52 [inline] dosyscall64+0xf5/0x240 arch/x86/entry/common.c:83 entrySYSCALL64after_hwframe+0x77/0x7f
The root cause is we missed to do sanity check on ixattrnid during f2fsiget(), so that in fiemap() path, currentnataddr() will access natbitmap w/ offset from invalid ixattrnid, result in triggering kasan bug report, fix it.
[
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c",
"function": "sanity_check_inode"
},
"digest": {
"length": 4130.0,
"function_hash": "261474066971064191146482032057314546762"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@75c87e2ac6149abf44bdde0dd6d541763ddb0dff",
"signature_version": "v1",
"id": "CVE-2024-39467-06ead47f"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c"
},
"digest": {
"line_hashes": [
"240522512309630831697827857464120036961",
"63023319149774050960125992398873200987",
"200208149540487323179028507266602512800"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@75c87e2ac6149abf44bdde0dd6d541763ddb0dff",
"signature_version": "v1",
"id": "CVE-2024-39467-11c6f0cc"
},
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c",
"function": "sanity_check_inode"
},
"digest": {
"length": 2841.0,
"function_hash": "69936869037836657881192594031601670285"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c559a8d840562fbfce9f318448dda2f7d3e6d8e8",
"signature_version": "v1",
"id": "CVE-2024-39467-218b6b86"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c"
},
"digest": {
"line_hashes": [
"240522512309630831697827857464120036961",
"63023319149774050960125992398873200987",
"172388993099369029676905545851189396745"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8c8aa473fe6eb46a4bf99f3ea2dbe52bf0c1a1f0",
"signature_version": "v1",
"id": "CVE-2024-39467-435d275d"
},
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c",
"function": "sanity_check_inode"
},
"digest": {
"length": 4130.0,
"function_hash": "261474066971064191146482032057314546762"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1640dcf383cdba52be8b28d2a1a2aa7ef7a30c98",
"signature_version": "v1",
"id": "CVE-2024-39467-6c057bc9"
},
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c",
"function": "sanity_check_inode"
},
"digest": {
"length": 3429.0,
"function_hash": "174799085823058041681224740057869023023"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@68e3cd4ecb8603936cccdc338929130045df2e57",
"signature_version": "v1",
"id": "CVE-2024-39467-7117309e"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c"
},
"digest": {
"line_hashes": [
"78345570987310892096633975681807433061",
"105135349804760838859480469610730392589",
"172388993099369029676905545851189396745"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@20faaf30e55522bba2b56d9c46689233205d7717",
"signature_version": "v1",
"id": "CVE-2024-39467-75dff26b"
},
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c",
"function": "sanity_check_inode"
},
"digest": {
"length": 3647.0,
"function_hash": "330647104220516031639628174255931089615"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8c8aa473fe6eb46a4bf99f3ea2dbe52bf0c1a1f0",
"signature_version": "v1",
"id": "CVE-2024-39467-7ef72cd1"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c"
},
"digest": {
"line_hashes": [
"240522512309630831697827857464120036961",
"63023319149774050960125992398873200987",
"200208149540487323179028507266602512800"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1640dcf383cdba52be8b28d2a1a2aa7ef7a30c98",
"signature_version": "v1",
"id": "CVE-2024-39467-8cd625e2"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c"
},
"digest": {
"line_hashes": [
"218029329105855687436768572614079333290",
"105135349804760838859480469610730392589",
"200208149540487323179028507266602512800"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c559a8d840562fbfce9f318448dda2f7d3e6d8e8",
"signature_version": "v1",
"id": "CVE-2024-39467-969989c0"
},
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c",
"function": "sanity_check_inode"
},
"digest": {
"length": 3429.0,
"function_hash": "174799085823058041681224740057869023023"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@20faaf30e55522bba2b56d9c46689233205d7717",
"signature_version": "v1",
"id": "CVE-2024-39467-b9643677"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/f2fs/inode.c"
},
"digest": {
"line_hashes": [
"78345570987310892096633975681807433061",
"105135349804760838859480469610730392589",
"172388993099369029676905545851189396745"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@68e3cd4ecb8603936cccdc338929130045df2e57",
"signature_version": "v1",
"id": "CVE-2024-39467-ea899f7c"
}
]