In the Linux kernel, the following vulnerability has been resolved:
nilfs2: fix failure to detect DAT corruption in btree and direct mappings
Patch series "nilfs2: fix kernel bug at submitbhwbc()".
This resolves a kernel BUG reported by syzbot. Since there are two flaws involved, I've made each one a separate patch.
The first patch alone resolves the syzbot-reported bug, but I think both fixes should be sent to stable, so I've tagged them as such.
This patch (of 2):
Syzbot has reported a kernel bug in submitbhwbc() when writing file data to a nilfs2 file system whose metadata is corrupted.
There are two flaws involved in this issue.
The first flaw is that when nilfsgetblock() locates a data block using btree or direct mapping, if the disk address translation routine nilfsdattranslate() fails with internal code -ENOENT due to DAT metadata corruption, it can be passed back to nilfsgetblock(). This causes nilfsgetblock() to misidentify an existing block as non-existent, causing both data block lookup and insertion to fail inconsistently.
The second flaw is that nilfsgetblock() returns a successful status in this inconsistent state. This causes the caller _blockwritebeginint() or others to request a read even though the buffer is not mapped, resulting in a BUGON check for the BHMapped flag in submitbhwbc() failing.
This fixes the first issue by changing the return value to code -EINVAL when a conversion using DAT fails with code -ENOENT, avoiding the conflicting condition that leads to the kernel bug described above. Here, code -EINVAL indicates that metadata corruption was detected during the block lookup, which will be properly handled as a file system error and converted to -EIO when passing through the nilfs2 bmap layer.
[
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"90875416303854620089435566818995284964",
"105765608771817897437430425881690589126",
"150156961017949407470696359550404247998",
"172505825009281810541729211234114661337",
"142786136430218908483524077700956111459",
"37561552258770306887421833042173051452",
"107842330732440051621081231070082051190",
"125521686052648676409794570466757904099",
"315162969390331293550416645361172856302",
"319269191158602377908888557641250647537",
"184235261060805065667853481052523453543",
"145185258254911016003061628181282426364"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/btree.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f69e81396aea66304d214f175aa371f1b5578862",
"signature_version": "v1",
"id": "CVE-2024-26956-140e29d4"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"221074018164935515816791542154664321468",
"6458200444803846041963807552430840605",
"112412513600095608582987020327179445544",
"189668309870829748813801515773252261137",
"215112490640048401956009976987067057530",
"164412214697983369262437875933439654462",
"66085701493423933411577790825183037417",
"100808239299352406048058296559369895811",
"51454381317043792414440437931594970706",
"68465687580034292546895801233249743226",
"1005981170775207399598201841273339668",
"265016306613397852173779701257775702059"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/direct.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9cbe1ad5f4354f4df1445e5f4883983328cd6d8e",
"signature_version": "v1",
"id": "CVE-2024-26956-1b6b31bc"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 799.0,
"function_hash": "244151358595989155147782321370667234047"
},
"target": {
"file": "fs/nilfs2/direct.c",
"function": "nilfs_direct_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@46b832e09d43b394ac0f6d9485d2b1a06593f0b7",
"signature_version": "v1",
"id": "CVE-2024-26956-2644ad7e"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"90875416303854620089435566818995284964",
"105765608771817897437430425881690589126",
"150156961017949407470696359550404247998",
"172505825009281810541729211234114661337",
"142786136430218908483524077700956111459",
"37561552258770306887421833042173051452",
"107842330732440051621081231070082051190",
"125521686052648676409794570466757904099",
"315162969390331293550416645361172856302",
"319269191158602377908888557641250647537",
"184235261060805065667853481052523453543",
"145185258254911016003061628181282426364"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/btree.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@46b832e09d43b394ac0f6d9485d2b1a06593f0b7",
"signature_version": "v1",
"id": "CVE-2024-26956-26ea3b37"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 799.0,
"function_hash": "244151358595989155147782321370667234047"
},
"target": {
"file": "fs/nilfs2/direct.c",
"function": "nilfs_direct_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82827ca21e7c8a91384c5baa656f78a5adfa4ab4",
"signature_version": "v1",
"id": "CVE-2024-26956-2a5f8c42"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"221074018164935515816791542154664321468",
"6458200444803846041963807552430840605",
"112412513600095608582987020327179445544",
"189668309870829748813801515773252261137",
"215112490640048401956009976987067057530",
"164412214697983369262437875933439654462",
"66085701493423933411577790825183037417",
"100808239299352406048058296559369895811",
"51454381317043792414440437931594970706",
"68465687580034292546895801233249743226",
"1005981170775207399598201841273339668",
"265016306613397852173779701257775702059"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/direct.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2e2619ff5d0def4bb6c2037a32a6eaa28dd95c84",
"signature_version": "v1",
"id": "CVE-2024-26956-317e3b01"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"221074018164935515816791542154664321468",
"6458200444803846041963807552430840605",
"112412513600095608582987020327179445544",
"189668309870829748813801515773252261137",
"215112490640048401956009976987067057530",
"164412214697983369262437875933439654462",
"66085701493423933411577790825183037417",
"100808239299352406048058296559369895811",
"51454381317043792414440437931594970706",
"68465687580034292546895801233249743226",
"1005981170775207399598201841273339668",
"265016306613397852173779701257775702059"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/direct.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b67189690eb4b7ecc84ae16fa1e880e0123eaa35",
"signature_version": "v1",
"id": "CVE-2024-26956-3adabf90"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 1688.0,
"function_hash": "72468984233013410731993341475601516581"
},
"target": {
"file": "fs/nilfs2/btree.c",
"function": "nilfs_btree_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f2f26b4a84a0ef41791bd2d70861c8eac748f4ba",
"signature_version": "v1",
"id": "CVE-2024-26956-3f0d4168"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"221074018164935515816791542154664321468",
"6458200444803846041963807552430840605",
"112412513600095608582987020327179445544",
"189668309870829748813801515773252261137",
"215112490640048401956009976987067057530",
"164412214697983369262437875933439654462",
"66085701493423933411577790825183037417",
"100808239299352406048058296559369895811",
"51454381317043792414440437931594970706",
"68465687580034292546895801233249743226",
"1005981170775207399598201841273339668",
"265016306613397852173779701257775702059"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/direct.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f2f26b4a84a0ef41791bd2d70861c8eac748f4ba",
"signature_version": "v1",
"id": "CVE-2024-26956-4c49faa9"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"90875416303854620089435566818995284964",
"105765608771817897437430425881690589126",
"150156961017949407470696359550404247998",
"172505825009281810541729211234114661337",
"142786136430218908483524077700956111459",
"37561552258770306887421833042173051452",
"107842330732440051621081231070082051190",
"125521686052648676409794570466757904099",
"315162969390331293550416645361172856302",
"319269191158602377908888557641250647537",
"184235261060805065667853481052523453543",
"145185258254911016003061628181282426364"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/btree.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2e2619ff5d0def4bb6c2037a32a6eaa28dd95c84",
"signature_version": "v1",
"id": "CVE-2024-26956-4e8d9b0e"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 799.0,
"function_hash": "244151358595989155147782321370667234047"
},
"target": {
"file": "fs/nilfs2/direct.c",
"function": "nilfs_direct_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2e2619ff5d0def4bb6c2037a32a6eaa28dd95c84",
"signature_version": "v1",
"id": "CVE-2024-26956-544cae68"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"221074018164935515816791542154664321468",
"6458200444803846041963807552430840605",
"112412513600095608582987020327179445544",
"189668309870829748813801515773252261137",
"215112490640048401956009976987067057530",
"164412214697983369262437875933439654462",
"66085701493423933411577790825183037417",
"100808239299352406048058296559369895811",
"51454381317043792414440437931594970706",
"68465687580034292546895801233249743226",
"1005981170775207399598201841273339668",
"265016306613397852173779701257775702059"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/direct.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c3b5c5c31e723b568f83d8cafab8629d9d830ffb",
"signature_version": "v1",
"id": "CVE-2024-26956-5861a11c"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 1699.0,
"function_hash": "235834400624748120260229723186919191468"
},
"target": {
"file": "fs/nilfs2/btree.c",
"function": "nilfs_btree_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9cbe1ad5f4354f4df1445e5f4883983328cd6d8e",
"signature_version": "v1",
"id": "CVE-2024-26956-7b175115"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 1688.0,
"function_hash": "72468984233013410731993341475601516581"
},
"target": {
"file": "fs/nilfs2/btree.c",
"function": "nilfs_btree_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@46b832e09d43b394ac0f6d9485d2b1a06593f0b7",
"signature_version": "v1",
"id": "CVE-2024-26956-7b93c15c"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"221074018164935515816791542154664321468",
"6458200444803846041963807552430840605",
"112412513600095608582987020327179445544",
"189668309870829748813801515773252261137",
"215112490640048401956009976987067057530",
"164412214697983369262437875933439654462",
"66085701493423933411577790825183037417",
"100808239299352406048058296559369895811",
"51454381317043792414440437931594970706",
"68465687580034292546895801233249743226",
"1005981170775207399598201841273339668",
"265016306613397852173779701257775702059"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/direct.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f69e81396aea66304d214f175aa371f1b5578862",
"signature_version": "v1",
"id": "CVE-2024-26956-814e4506"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 799.0,
"function_hash": "244151358595989155147782321370667234047"
},
"target": {
"file": "fs/nilfs2/direct.c",
"function": "nilfs_direct_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b67189690eb4b7ecc84ae16fa1e880e0123eaa35",
"signature_version": "v1",
"id": "CVE-2024-26956-8197bda2"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 799.0,
"function_hash": "244151358595989155147782321370667234047"
},
"target": {
"file": "fs/nilfs2/direct.c",
"function": "nilfs_direct_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c3b5c5c31e723b568f83d8cafab8629d9d830ffb",
"signature_version": "v1",
"id": "CVE-2024-26956-8ff1aa4c"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 799.0,
"function_hash": "244151358595989155147782321370667234047"
},
"target": {
"file": "fs/nilfs2/direct.c",
"function": "nilfs_direct_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f69e81396aea66304d214f175aa371f1b5578862",
"signature_version": "v1",
"id": "CVE-2024-26956-9491a3b4"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 799.0,
"function_hash": "244151358595989155147782321370667234047"
},
"target": {
"file": "fs/nilfs2/direct.c",
"function": "nilfs_direct_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9cbe1ad5f4354f4df1445e5f4883983328cd6d8e",
"signature_version": "v1",
"id": "CVE-2024-26956-9825e14a"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"90875416303854620089435566818995284964",
"105765608771817897437430425881690589126",
"150156961017949407470696359550404247998",
"172505825009281810541729211234114661337",
"142786136430218908483524077700956111459",
"37561552258770306887421833042173051452",
"107842330732440051621081231070082051190",
"125521686052648676409794570466757904099",
"315162969390331293550416645361172856302",
"319269191158602377908888557641250647537",
"184235261060805065667853481052523453543",
"145185258254911016003061628181282426364"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/btree.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f2f26b4a84a0ef41791bd2d70861c8eac748f4ba",
"signature_version": "v1",
"id": "CVE-2024-26956-9e3ac00e"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"221074018164935515816791542154664321468",
"6458200444803846041963807552430840605",
"112412513600095608582987020327179445544",
"189668309870829748813801515773252261137",
"215112490640048401956009976987067057530",
"164412214697983369262437875933439654462",
"66085701493423933411577790825183037417",
"100808239299352406048058296559369895811",
"51454381317043792414440437931594970706",
"68465687580034292546895801233249743226",
"1005981170775207399598201841273339668",
"265016306613397852173779701257775702059"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/direct.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@46b832e09d43b394ac0f6d9485d2b1a06593f0b7",
"signature_version": "v1",
"id": "CVE-2024-26956-a2baf17c"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 1688.0,
"function_hash": "72468984233013410731993341475601516581"
},
"target": {
"file": "fs/nilfs2/btree.c",
"function": "nilfs_btree_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82827ca21e7c8a91384c5baa656f78a5adfa4ab4",
"signature_version": "v1",
"id": "CVE-2024-26956-ae704f15"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 1699.0,
"function_hash": "235834400624748120260229723186919191468"
},
"target": {
"file": "fs/nilfs2/btree.c",
"function": "nilfs_btree_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c3b5c5c31e723b568f83d8cafab8629d9d830ffb",
"signature_version": "v1",
"id": "CVE-2024-26956-b0f05fc5"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"90875416303854620089435566818995284964",
"105765608771817897437430425881690589126",
"150156961017949407470696359550404247998",
"172505825009281810541729211234114661337",
"142786136430218908483524077700956111459",
"37561552258770306887421833042173051452",
"107842330732440051621081231070082051190",
"125521686052648676409794570466757904099",
"315162969390331293550416645361172856302",
"319269191158602377908888557641250647537",
"184235261060805065667853481052523453543",
"145185258254911016003061628181282426364"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/btree.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82827ca21e7c8a91384c5baa656f78a5adfa4ab4",
"signature_version": "v1",
"id": "CVE-2024-26956-b2545bf9"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 1688.0,
"function_hash": "72468984233013410731993341475601516581"
},
"target": {
"file": "fs/nilfs2/btree.c",
"function": "nilfs_btree_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f69e81396aea66304d214f175aa371f1b5578862",
"signature_version": "v1",
"id": "CVE-2024-26956-b52b5632"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 1688.0,
"function_hash": "72468984233013410731993341475601516581"
},
"target": {
"file": "fs/nilfs2/btree.c",
"function": "nilfs_btree_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2e2619ff5d0def4bb6c2037a32a6eaa28dd95c84",
"signature_version": "v1",
"id": "CVE-2024-26956-b8a34b51"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"90875416303854620089435566818995284964",
"105765608771817897437430425881690589126",
"150156961017949407470696359550404247998",
"172505825009281810541729211234114661337",
"142786136430218908483524077700956111459",
"37561552258770306887421833042173051452",
"107842330732440051621081231070082051190",
"125521686052648676409794570466757904099",
"315162969390331293550416645361172856302",
"319269191158602377908888557641250647537",
"184235261060805065667853481052523453543",
"145185258254911016003061628181282426364"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/btree.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c3b5c5c31e723b568f83d8cafab8629d9d830ffb",
"signature_version": "v1",
"id": "CVE-2024-26956-c1c4c678"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 1699.0,
"function_hash": "235834400624748120260229723186919191468"
},
"target": {
"file": "fs/nilfs2/btree.c",
"function": "nilfs_btree_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b67189690eb4b7ecc84ae16fa1e880e0123eaa35",
"signature_version": "v1",
"id": "CVE-2024-26956-cf67417f"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"90875416303854620089435566818995284964",
"105765608771817897437430425881690589126",
"150156961017949407470696359550404247998",
"172505825009281810541729211234114661337",
"142786136430218908483524077700956111459",
"37561552258770306887421833042173051452",
"107842330732440051621081231070082051190",
"125521686052648676409794570466757904099",
"315162969390331293550416645361172856302",
"319269191158602377908888557641250647537",
"184235261060805065667853481052523453543",
"145185258254911016003061628181282426364"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/btree.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9cbe1ad5f4354f4df1445e5f4883983328cd6d8e",
"signature_version": "v1",
"id": "CVE-2024-26956-dc1e1614"
},
{
"signature_type": "Function",
"deprecated": false,
"digest": {
"length": 799.0,
"function_hash": "244151358595989155147782321370667234047"
},
"target": {
"file": "fs/nilfs2/direct.c",
"function": "nilfs_direct_lookup_contig"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f2f26b4a84a0ef41791bd2d70861c8eac748f4ba",
"signature_version": "v1",
"id": "CVE-2024-26956-f517b428"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"221074018164935515816791542154664321468",
"6458200444803846041963807552430840605",
"112412513600095608582987020327179445544",
"189668309870829748813801515773252261137",
"215112490640048401956009976987067057530",
"164412214697983369262437875933439654462",
"66085701493423933411577790825183037417",
"100808239299352406048058296559369895811",
"51454381317043792414440437931594970706",
"68465687580034292546895801233249743226",
"1005981170775207399598201841273339668",
"265016306613397852173779701257775702059"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/direct.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82827ca21e7c8a91384c5baa656f78a5adfa4ab4",
"signature_version": "v1",
"id": "CVE-2024-26956-fd578579"
},
{
"signature_type": "Line",
"deprecated": false,
"digest": {
"line_hashes": [
"90875416303854620089435566818995284964",
"105765608771817897437430425881690589126",
"150156961017949407470696359550404247998",
"172505825009281810541729211234114661337",
"142786136430218908483524077700956111459",
"37561552258770306887421833042173051452",
"107842330732440051621081231070082051190",
"125521686052648676409794570466757904099",
"315162969390331293550416645361172856302",
"319269191158602377908888557641250647537",
"184235261060805065667853481052523453543",
"145185258254911016003061628181282426364"
],
"threshold": 0.9
},
"target": {
"file": "fs/nilfs2/btree.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b67189690eb4b7ecc84ae16fa1e880e0123eaa35",
"signature_version": "v1",
"id": "CVE-2024-26956-ff652e09"
}
]