In the Linux kernel, the following vulnerability has been resolved:
erofs: handle overlapped pclusters out of crafted images properly
syzbot reported a task hang issue due to a deadlock case where it is waiting for the folio lock of a cached folio that will be used for cache I/Os.
After looking into the crafted fuzzed image, I found it's formed with several overlapped big pclusters as below:
Ext: logical offset | length : physical offset | length 0: 0.. 16384 | 16384 : 151552.. 167936 | 16384 1: 16384.. 32768 | 16384 : 155648.. 172032 | 16384 2: 32768.. 49152 | 16384 : 537223168.. 537239552 | 16384 ...
Here, extent 0/1 are physically overlapped although it's entirely impossible for normal filesystem images generated by mkfs.
First, managed folios containing compressed data will be marked as up-to-date and then unlocked immediately (unlike in-place folios) when compressed I/Os are complete. If physical blocks are not submitted in the incremental order, there should be separate BIOs to avoid dependency issues. However, the current code mis-arranges zerofsfillbiovec() and BIO submission which causes unexpected BIO waits.
Second, managed folios will be connected to their own pclusters for efficient inter-queries. However, this is somewhat hard to implement easily if overlapped big pclusters exist. Again, these only appear in fuzzed images so let's simply fall back to temporary short-lived pages for correctness.
Additionally, it justifies that referenced managed folios cannot be
truncated for now and reverts part of commit 2080ca1ed3e4 ("erofs: tidy
up struct z_erofs_bvec") for simplicity although it shouldn't be any
difference.
[
{
"id": "CVE-2024-47736-03d250c7",
"signature_version": "v1",
"digest": {
"function_hash": "29877983055698798205577251531520993908",
"length": 2403.0
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b9b30af0e86ffb485301ecd83b9129c9dfb7ebf8",
"target": {
"file": "fs/erofs/zdata.c",
"function": "z_erofs_submit_queue"
}
},
{
"id": "CVE-2024-47736-0c228549",
"signature_version": "v1",
"digest": {
"function_hash": "29877983055698798205577251531520993908",
"length": 2403.0
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9cfa199bcbbbba31cbf97b2786f44f4464f3f29a",
"target": {
"file": "fs/erofs/zdata.c",
"function": "z_erofs_submit_queue"
}
},
{
"id": "CVE-2024-47736-14fcaaa8",
"signature_version": "v1",
"digest": {
"function_hash": "303716570758851513853727836527034119898",
"length": 1919.0
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9cfa199bcbbbba31cbf97b2786f44f4464f3f29a",
"target": {
"file": "fs/erofs/zdata.c",
"function": "z_erofs_fill_bio_vec"
}
},
{
"id": "CVE-2024-47736-1b7be208",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"302471898897965934711275746055357800717",
"72684516893652573072331147459101059581",
"189720238404727451757010781914665013013",
"95764443252241599690604475993743432463",
"64604338933666322055375226620083713332",
"211231387564352489484777683692975677651",
"78551692034975417488085905104977332962",
"336156264441644411974308975798508902274",
"95073786979590998668837861052098450417",
"309775624338105434238311656471893971482",
"70333880335401889743749958957516811466",
"337526749369211802101176196612720654395",
"18440687676575169937616953731617900077",
"11186359371198448966163660814356002577",
"234439078086413143997682317525377562291",
"298238863306050847578406034294597093147",
"184063500549554511732447181811165995552",
"63589226108198027642182188118399938546",
"74176877147334631160526684321275425812",
"120428750938007686291034966630766737036",
"246920886088096470021332920663933540227",
"89992135813014813305757622754196690266",
"312511735003465921687854555916232641244",
"338317350738615301994078848278494907933",
"114904628912700926779032713468585616620",
"308982541165378538681780504085588889500",
"45244689000156189286370137935092813046",
"125609476282926792193855377667412041995",
"41876867109607839313969451598121733173",
"147890373515116680876563854963110788444",
"337120301253651362864323803969152851984",
"113936300148728700588309428132810255291",
"329791826477676308433304900641597698991",
"76945666628637163777741343870554208519",
"55557314997533748833587093315048405071",
"190986061846415837606072842045750650270",
"196332330272754239109074745683478940143",
"35939116874639619238543386175661059371",
"121989458339070935089690442066756114404",
"88835914803348309889796019759827160675",
"153321108666929839776139685174861592068",
"111415801794603501424492681521184233642",
"173000328327456328013706821984174669798",
"75958852780952708669656388222565885670",
"260476725265572946104220152389558828883",
"247975071289809285836813676672204762002",
"73670340687333490597527168862319026651",
"37048714426637547006571239607125670425",
"289131021204126858811254213095507905933",
"127829106219764940289656446654192293042",
"248823934048711807750184983712923631180",
"280342113999918582316187778760035995448",
"17081406646766266207860847668798353263",
"338616447859076546316561312962283127700",
"145887687957168743226546142706936700932",
"166202178551369148535820818613354993828",
"287103650571165965187488093702589796320",
"322835406571537779239708826564322839198",
"2607405567906877075075439728976096220",
"329027165764530149274938498514576347613",
"57066465991894319330962150409794823016",
"339346118894118699372299155007364602235",
"194899238279134889663922572814206056883"
]
},
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9e2f9d34dd12e6e5b244ec488bcebd0c2d566c50",
"target": {
"file": "fs/erofs/zdata.c"
}
},
{
"id": "CVE-2024-47736-3a11600d",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"302471898897965934711275746055357800717",
"72684516893652573072331147459101059581",
"189720238404727451757010781914665013013",
"95764443252241599690604475993743432463",
"64604338933666322055375226620083713332",
"211231387564352489484777683692975677651",
"78551692034975417488085905104977332962",
"336156264441644411974308975798508902274",
"95073786979590998668837861052098450417",
"309775624338105434238311656471893971482",
"70333880335401889743749958957516811466",
"337526749369211802101176196612720654395",
"18440687676575169937616953731617900077",
"11186359371198448966163660814356002577",
"234439078086413143997682317525377562291",
"298238863306050847578406034294597093147",
"184063500549554511732447181811165995552",
"63589226108198027642182188118399938546",
"74176877147334631160526684321275425812",
"120428750938007686291034966630766737036",
"246920886088096470021332920663933540227",
"89992135813014813305757622754196690266",
"312511735003465921687854555916232641244",
"338317350738615301994078848278494907933",
"114904628912700926779032713468585616620",
"308982541165378538681780504085588889500",
"45244689000156189286370137935092813046",
"125609476282926792193855377667412041995",
"41876867109607839313969451598121733173",
"147890373515116680876563854963110788444",
"337120301253651362864323803969152851984",
"113936300148728700588309428132810255291",
"329791826477676308433304900641597698991",
"76945666628637163777741343870554208519",
"55557314997533748833587093315048405071",
"190986061846415837606072842045750650270",
"196332330272754239109074745683478940143",
"35939116874639619238543386175661059371",
"121989458339070935089690442066756114404",
"88835914803348309889796019759827160675",
"153321108666929839776139685174861592068",
"111415801794603501424492681521184233642",
"173000328327456328013706821984174669798",
"75958852780952708669656388222565885670",
"260476725265572946104220152389558828883",
"247975071289809285836813676672204762002",
"73670340687333490597527168862319026651",
"37048714426637547006571239607125670425",
"289131021204126858811254213095507905933",
"127829106219764940289656446654192293042",
"248823934048711807750184983712923631180",
"280342113999918582316187778760035995448",
"17081406646766266207860847668798353263",
"338616447859076546316561312962283127700",
"145887687957168743226546142706936700932",
"166202178551369148535820818613354993828",
"287103650571165965187488093702589796320",
"322835406571537779239708826564322839198",
"2607405567906877075075439728976096220",
"329027165764530149274938498514576347613",
"57066465991894319330962150409794823016",
"339346118894118699372299155007364602235",
"194899238279134889663922572814206056883"
]
},
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9cfa199bcbbbba31cbf97b2786f44f4464f3f29a",
"target": {
"file": "fs/erofs/zdata.c"
}
},
{
"id": "CVE-2024-47736-49735641",
"signature_version": "v1",
"digest": {
"function_hash": "148699806677410103451741670929616376039",
"length": 1583.0
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1bf7e414cac303c9aec1be67872e19be8b64980c",
"target": {
"file": "fs/erofs/zdata.c",
"function": "pickup_page_for_submission"
}
},
{
"id": "CVE-2024-47736-6e1e6b54",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"206909247131029278104366617424991192827",
"226635816002565545747016174878402405491",
"96722092138586739726735699490089806863",
"146387176581071460524447371111795227121",
"162850167513741184388908650590556258772",
"181756089577256917396363020502831616120",
"124548527223501106887112831810203979500",
"208478664587068996586002980814323589114",
"83018978049742920578628568085191878205",
"70434222523192614210723641751428864725",
"208749194806004208740045048834451769808",
"89339728146368966417938151543824853832",
"122637253683348411204585586889146905665",
"46936465492969817031679437121921876488",
"158062292939347180726973239762115570412",
"116881499821789683196869049241010271518",
"88767533299452639157994938637924362407",
"300066745529070077280362505168954460391",
"220740064279868224118709711480155397080",
"254327074028402992541828861207847566253",
"180170212313615012297958817660153819673",
"114131802571006606065011832359028346050",
"192598438858333522035388091783933562686",
"316236151262645109597012494799278899109",
"215914157997172992402297950140889638456",
"189076203498129378777551613537669659346",
"48558617194864598643822863361575960312",
"235879421360553692798228701017387741337",
"272074231445428356681780693978813899130",
"78778398263498638506792685033051167538",
"250170883483316620816696261981503491901",
"192644180686061312161617965589203834886",
"91231086599816843297547418272393544323",
"66936400451482815454858293414774306362",
"277763731943280370956112477572355147087",
"308015975487088901528219083923561500811"
]
},
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1bf7e414cac303c9aec1be67872e19be8b64980c",
"target": {
"file": "fs/erofs/zdata.c"
}
},
{
"id": "CVE-2024-47736-9a7b0664",
"signature_version": "v1",
"digest": {
"function_hash": "303716570758851513853727836527034119898",
"length": 1919.0
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b9b30af0e86ffb485301ecd83b9129c9dfb7ebf8",
"target": {
"file": "fs/erofs/zdata.c",
"function": "z_erofs_fill_bio_vec"
}
},
{
"id": "CVE-2024-47736-bd59e2f6",
"signature_version": "v1",
"digest": {
"function_hash": "303716570758851513853727836527034119898",
"length": 1919.0
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9e2f9d34dd12e6e5b244ec488bcebd0c2d566c50",
"target": {
"file": "fs/erofs/zdata.c",
"function": "z_erofs_fill_bio_vec"
}
},
{
"id": "CVE-2024-47736-c94d4095",
"signature_version": "v1",
"digest": {
"function_hash": "29877983055698798205577251531520993908",
"length": 2403.0
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9e2f9d34dd12e6e5b244ec488bcebd0c2d566c50",
"target": {
"file": "fs/erofs/zdata.c",
"function": "z_erofs_submit_queue"
}
},
{
"id": "CVE-2024-47736-cb1b34e9",
"signature_version": "v1",
"digest": {
"function_hash": "44809453839963341055699748427151620057",
"length": 2220.0
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1bf7e414cac303c9aec1be67872e19be8b64980c",
"target": {
"file": "fs/erofs/zdata.c",
"function": "z_erofs_submit_queue"
}
},
{
"id": "CVE-2024-47736-f59577b5",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"302471898897965934711275746055357800717",
"72684516893652573072331147459101059581",
"189720238404727451757010781914665013013",
"95764443252241599690604475993743432463",
"64604338933666322055375226620083713332",
"211231387564352489484777683692975677651",
"78551692034975417488085905104977332962",
"336156264441644411974308975798508902274",
"95073786979590998668837861052098450417",
"309775624338105434238311656471893971482",
"70333880335401889743749958957516811466",
"337526749369211802101176196612720654395",
"18440687676575169937616953731617900077",
"11186359371198448966163660814356002577",
"234439078086413143997682317525377562291",
"298238863306050847578406034294597093147",
"184063500549554511732447181811165995552",
"63589226108198027642182188118399938546",
"74176877147334631160526684321275425812",
"120428750938007686291034966630766737036",
"246920886088096470021332920663933540227",
"89992135813014813305757622754196690266",
"312511735003465921687854555916232641244",
"338317350738615301994078848278494907933",
"114904628912700926779032713468585616620",
"308982541165378538681780504085588889500",
"45244689000156189286370137935092813046",
"125609476282926792193855377667412041995",
"41876867109607839313969451598121733173",
"147890373515116680876563854963110788444",
"337120301253651362864323803969152851984",
"113936300148728700588309428132810255291",
"329791826477676308433304900641597698991",
"76945666628637163777741343870554208519",
"55557314997533748833587093315048405071",
"190986061846415837606072842045750650270",
"196332330272754239109074745683478940143",
"35939116874639619238543386175661059371",
"121989458339070935089690442066756114404",
"88835914803348309889796019759827160675",
"153321108666929839776139685174861592068",
"111415801794603501424492681521184233642",
"173000328327456328013706821984174669798",
"75958852780952708669656388222565885670",
"260476725265572946104220152389558828883",
"247975071289809285836813676672204762002",
"73670340687333490597527168862319026651",
"37048714426637547006571239607125670425",
"289131021204126858811254213095507905933",
"127829106219764940289656446654192293042",
"248823934048711807750184983712923631180",
"280342113999918582316187778760035995448",
"17081406646766266207860847668798353263",
"338616447859076546316561312962283127700",
"145887687957168743226546142706936700932",
"166202178551369148535820818613354993828",
"287103650571165965187488093702589796320",
"322835406571537779239708826564322839198",
"2607405567906877075075439728976096220",
"329027165764530149274938498514576347613",
"57066465991894319330962150409794823016",
"339346118894118699372299155007364602235",
"194899238279134889663922572814206056883"
]
},
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b9b30af0e86ffb485301ecd83b9129c9dfb7ebf8",
"target": {
"file": "fs/erofs/zdata.c"
}
}
]