In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to do sanity check on sitbitmapsize
w/ below testcase, resize will generate a corrupted image which contains inconsistent metadata, so when mounting such image, it will trigger kernel panic:
touch img truncate -s $((512102410241024)) img mkfs.f2fs -f img $((25610241024)) resize.f2fs -s -i img -t $((10241024*1024)) mount img /mnt/f2fs
------------[ cut here ]------------ kernel BUG at fs/f2fs/segment.h:863! Oops: invalid opcode: 0000 [#1] SMP PTI CPU: 11 UID: 0 PID: 3922 Comm: mount Not tainted 6.15.0-rc1+ #191 PREEMPT(voluntary) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:f2fsrameta_pages+0x47c/0x490
Call Trace: f2fsbuildsegmentmanager+0x11c3/0x2600 f2fsfillsuper+0xe97/0x2840 mountbdev+0xf4/0x140 legacygettree+0x2b/0x50 vfsgettree+0x29/0xd0 pathmount+0x487/0xaf0 _x64sysmount+0x116/0x150 dosyscall64+0x82/0x190 entrySYSCALL64afterhwframe+0x76/0x7e RIP: 0033:0x7fdbfde1bcfe
The reaseon is:
siti->bitmapsize is 192, so size of sit bitmap is 192*8=1536, at maximum there are 1536 sit blocks, however MAINSEGS is 261893, so that sitblkcnt is 4762, buildsitentries() -> currentsitaddr() tries to access out-of-boundary in sitbitmap at offset from [1536, 4762), once sitbitmap and sitbitmapmirror is not the same, it will trigger f2fsbug_on().
Let's add sanity check in f2fssanitycheck_ckpt() to avoid panic.
[
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3e5ac62a56a24f4d88ce8ffd7bc452428b235868",
"id": "CVE-2025-38218-01b88522",
"signature_version": "v1",
"target": {
"function": "f2fs_sanity_check_ckpt",
"file": "fs/f2fs/super.c"
},
"signature_type": "Function",
"digest": {
"function_hash": "118396579688566842081420789174083230847",
"length": 4398.0
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ad862f71016ba38039df1c96ed55c0a4314cc183",
"id": "CVE-2025-38218-032bd00e",
"signature_version": "v1",
"target": {
"file": "fs/f2fs/super.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"48036132647463325147764935616687212077",
"247003950684628301339707317266024156638",
"209834034502932497125283246655524016753",
"181248973157490113167416736349700902388",
"71209655599727549967499561461463881870",
"329726807536202555913729706007962847959",
"109560840202961658210137198004685110219"
]
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@79ef8a6c4ec53d327580fd7d2b522cf4f1d05b0c",
"id": "CVE-2025-38218-10f0a30c",
"signature_version": "v1",
"target": {
"function": "f2fs_sanity_check_ckpt",
"file": "fs/f2fs/super.c"
},
"signature_type": "Function",
"digest": {
"function_hash": "118396579688566842081420789174083230847",
"length": 4398.0
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@38ef48a8afef8df646b6f6ae7abb872f18b533c1",
"id": "CVE-2025-38218-12f82388",
"signature_version": "v1",
"target": {
"function": "f2fs_sanity_check_ckpt",
"file": "fs/f2fs/super.c"
},
"signature_type": "Function",
"digest": {
"function_hash": "81524387748019829738136800977841938950",
"length": 4392.0
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3e5ac62a56a24f4d88ce8ffd7bc452428b235868",
"id": "CVE-2025-38218-18569c71",
"signature_version": "v1",
"target": {
"file": "fs/f2fs/super.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"48036132647463325147764935616687212077",
"247003950684628301339707317266024156638",
"209834034502932497125283246655524016753",
"181248973157490113167416736349700902388",
"71209655599727549967499561461463881870",
"329726807536202555913729706007962847959",
"109560840202961658210137198004685110219"
]
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@79ef8a6c4ec53d327580fd7d2b522cf4f1d05b0c",
"id": "CVE-2025-38218-449dd526",
"signature_version": "v1",
"target": {
"file": "fs/f2fs/super.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"48036132647463325147764935616687212077",
"247003950684628301339707317266024156638",
"209834034502932497125283246655524016753",
"181248973157490113167416736349700902388",
"71209655599727549967499561461463881870",
"329726807536202555913729706007962847959",
"109560840202961658210137198004685110219"
]
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ad862f71016ba38039df1c96ed55c0a4314cc183",
"id": "CVE-2025-38218-54dc0a08",
"signature_version": "v1",
"target": {
"function": "f2fs_sanity_check_ckpt",
"file": "fs/f2fs/super.c"
},
"signature_type": "Function",
"digest": {
"function_hash": "81524387748019829738136800977841938950",
"length": 4392.0
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5db0d252c64e91ba1929c70112352e85dc5751e7",
"id": "CVE-2025-38218-68ccbd21",
"signature_version": "v1",
"target": {
"function": "f2fs_sanity_check_ckpt",
"file": "fs/f2fs/super.c"
},
"signature_type": "Function",
"digest": {
"function_hash": "118396579688566842081420789174083230847",
"length": 4398.0
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82f51bff393e4c12cf4de553120ca831cfa4ef19",
"id": "CVE-2025-38218-958f1183",
"signature_version": "v1",
"target": {
"file": "fs/f2fs/super.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"48036132647463325147764935616687212077",
"247003950684628301339707317266024156638",
"209834034502932497125283246655524016753",
"181248973157490113167416736349700902388",
"71209655599727549967499561461463881870",
"329726807536202555913729706007962847959",
"109560840202961658210137198004685110219"
]
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82f51bff393e4c12cf4de553120ca831cfa4ef19",
"id": "CVE-2025-38218-aa42772a",
"signature_version": "v1",
"target": {
"function": "f2fs_sanity_check_ckpt",
"file": "fs/f2fs/super.c"
},
"signature_type": "Function",
"digest": {
"function_hash": "61112405594920248792046747634583000140",
"length": 4221.0
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@38ef48a8afef8df646b6f6ae7abb872f18b533c1",
"id": "CVE-2025-38218-eead646c",
"signature_version": "v1",
"target": {
"file": "fs/f2fs/super.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"48036132647463325147764935616687212077",
"247003950684628301339707317266024156638",
"209834034502932497125283246655524016753",
"181248973157490113167416736349700902388",
"71209655599727549967499561461463881870",
"329726807536202555913729706007962847959",
"109560840202961658210137198004685110219"
]
}
},
{
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5db0d252c64e91ba1929c70112352e85dc5751e7",
"id": "CVE-2025-38218-feb50852",
"signature_version": "v1",
"target": {
"file": "fs/f2fs/super.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"48036132647463325147764935616687212077",
"247003950684628301339707317266024156638",
"209834034502932497125283246655524016753",
"181248973157490113167416736349700902388",
"71209655599727549967499561461463881870",
"329726807536202555913729706007962847959",
"109560840202961658210137198004685110219"
]
}
}
]