{"id":"CVE-2026-143019","state":"PUBLISHED","title":"dm snapshot: fix discard writing into the next COW chunk","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ndm snapshot: fix discard writing into the next COW chunk\n\nzero_exception() zeroes one chunk of the COW device and takes the start\nsector from bio->bi_iter.bi_sector.  remap_exception() has already set\nthat to the COW chunk start plus the offset inside the chunk.  That\noffset is needed for reads and writes, but for a discard it is wrong:\nthe zeroing window is shifted, so the head of the target chunk keeps\nits old data and the tail lands in the next COW chunk, which holds a\ndifferent exception.\n\nio_overlaps_chunk() should have caught this, but it only compares the\nlength.  \"maps to entire chunks\" in snapshot.rst also means the discard\nhas to start on a chunk boundary.\n\nA discard that is not a full chunk has a second problem: after\nremap_exception() it is sent to the COW device, where it hits a chunk\nthat still backs a live exception.  After a discard the contents are\nundefined, but the exception stays in the table and keeps pointing at\nthat chunk, so a later read returns whatever the discard left instead\nof the snapshot's data.\n\nReproducer:\n\n\ttruncate -s 4M o.img c.img\n\to=$(losetup -f --show o.img)\n\tc=$(losetup -f --show c.img)\n\tdmsetup create snap --table \\\n\t\t\"0 8192 snapshot $o $c P 512 1 discard_zeroes_cow\"\n\n\t# write two chunks, this creates two exceptions\n\thead -c 256K /dev/zero | tr '\\000' '\\252' > pat\n\tdd if=pat of=/dev/mapper/snap bs=256K seek=1 count=1 conv=notrunc\n\tdd if=pat of=/dev/mapper/snap bs=256K seek=2 count=1 conv=notrunc\n\n\t# shift the snapshot by 8 sectors, so a discard that is aligned on\n\t# top is unaligned inside the snapshot\n\tdmsetup create top --table \"0 8184 linear /dev/mapper/snap 8\"\n\tblkdiscard -o 262144 -l 262144 /dev/mapper/top\n\tsync\n\techo 3 > /proc/sys/vm/drop_caches\n\n\t# chunk 1\n\tdd if=/dev/mapper/snap bs=512 skip=512 count=8 | od -An -tx1 -N1\n\t# chunk 2\n\tdd if=/dev/mapper/snap bs=512 skip=1024 count=8 | od -An -tx1 -N1\n\nBefore: aa 00  <- chunk 2 was zeroed although it was not discarded\nAfter:  aa aa  <- nothing written, a discard is only a hint\n\nFix it by requiring the discard to start on a chunk boundary in\nio_overlaps_chunk(), and by finishing a discard that is not a full\nchunk with bio_endio() instead of passing it down to the COW device.","publishedAt":"2026-12-03T09:17:54.070Z","updatedAt":"2026-12-03T09:17:54.070Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"1fa8f3def9b79052ed510aa85eefbdb2d7b0ead1","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"6a227764d4e9ffdbe9ab4e59e9b24e21fa0e91bd","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"4a02cc97d87a3c2eb7c37ac6ea7e8ef8e8fc0344","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"19ff998f1d27e1417b286ae0ec88fc19842d4f2f","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"0c661d80fdbeea980d3e03b528ecb51e38f0d85e","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"73174b4bb6fcd0e6cf973c9402a0fae2e567ad9f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/md/dm-snap.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.3","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.3","versionType":"semver"},{"version":"5.10.276","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.227","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/md/dm-snap.c"]}],"references":["https://git.kernel.org/stable/c/1fa8f3def9b79052ed510aa85eefbdb2d7b0ead1","https://git.kernel.org/stable/c/6a227764d4e9ffdbe9ab4e59e9b24e21fa0e91bd","https://git.kernel.org/stable/c/4a02cc97d87a3c2eb7c37ac6ea7e8ef8e8fc0344","https://git.kernel.org/stable/c/19ff998f1d27e1417b286ae0ec88fc19842d4f2f","https://git.kernel.org/stable/c/0c661d80fdbeea980d3e03b528ecb51e38f0d85e","https://git.kernel.org/stable/c/73174b4bb6fcd0e6cf973c9402a0fae2e567ad9f"],"weaknesses":[],"ingestedAt":"2026-12-03T09:26:06.073Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/143xxx/CVE-2026-143019.json","commit":"9fd484e43f2e14021809e195d28c1172759faad0","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-143019","state":"PUBLISHED","datePublished":"2026-12-03T09:17:54.070Z","dateUpdated":"2026-12-03T09:17:54.070Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-12-03T03:10:28.343Z"},"containers":{"cna":{"title":"dm snapshot: fix discard writing into the next COW chunk","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ndm snapshot: fix discard writing into the next COW chunk\n\nzero_exception() zeroes one chunk of the COW device and takes the start\nsector from bio->bi_iter.bi_sector.  remap_exception() has already set\nthat to the COW chunk start plus the offset inside the chunk.  That\noffset is needed for reads and writes, but for a discard it is wrong:\nthe zeroing window is shifted, so the head of the target chunk keeps\nits old data and the tail lands in the next COW chunk, which holds a\ndifferent exception.\n\nio_overlaps_chunk() should have caught this, but it only compares the\nlength.  \"maps to entire chunks\" in snapshot.rst also means the discard\nhas to start on a chunk boundary.\n\nA discard that is not a full chunk has a second problem: after\nremap_exception() it is sent to the COW device, where it hits a chunk\nthat still backs a live exception.  After a discard the contents are\nundefined, but the exception stays in the table and keeps pointing at\nthat chunk, so a later read returns whatever the discard left instead\nof the snapshot's data.\n\nReproducer:\n\n\ttruncate -s 4M o.img c.img\n\to=$(losetup -f --show o.img)\n\tc=$(losetup -f --show c.img)\n\tdmsetup create snap --table \\\n\t\t\"0 8192 snapshot $o $c P 512 1 discard_zeroes_cow\"\n\n\t# write two chunks, this creates two exceptions\n\thead -c 256K /dev/zero | tr '\\000' '\\252' > pat\n\tdd if=pat of=/dev/mapper/snap bs=256K seek=1 count=1 conv=notrunc\n\tdd if=pat of=/dev/mapper/snap bs=256K seek=2 count=1 conv=notrunc\n\n\t# shift the snapshot by 8 sectors, so a discard that is aligned on\n\t# top is unaligned inside the snapshot\n\tdmsetup create top --table \"0 8184 linear /dev/mapper/snap 8\"\n\tblkdiscard -o 262144 -l 262144 /dev/mapper/top\n\tsync\n\techo 3 > /proc/sys/vm/drop_caches\n\n\t# chunk 1\n\tdd if=/dev/mapper/snap bs=512 skip=512 count=8 | od -An -tx1 -N1\n\t# chunk 2\n\tdd if=/dev/mapper/snap bs=512 skip=1024 count=8 | od -An -tx1 -N1\n\nBefore: aa 00  <- chunk 2 was zeroed although it was not discarded\nAfter:  aa aa  <- nothing written, a discard is only a hint\n\nFix it by requiring the discard to start on a chunk boundary in\nio_overlaps_chunk(), and by finishing a discard that is not a full\nchunk with bio_endio() instead of passing it down to the COW device."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"1fa8f3def9b79052ed510aa85eefbdb2d7b0ead1","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"6a227764d4e9ffdbe9ab4e59e9b24e21fa0e91bd","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"4a02cc97d87a3c2eb7c37ac6ea7e8ef8e8fc0344","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"19ff998f1d27e1417b286ae0ec88fc19842d4f2f","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"0c661d80fdbeea980d3e03b528ecb51e38f0d85e","versionType":"git"},{"version":"2e6023850e177dbaca21498ada04c5a5ac93f812","status":"affected","lessThan":"73174b4bb6fcd0e6cf973c9402a0fae2e567ad9f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/md/dm-snap.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.3","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.3","versionType":"semver"},{"version":"5.10.276","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.227","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/md/dm-snap.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/1fa8f3def9b79052ed510aa85eefbdb2d7b0ead1"},{"url":"https://git.kernel.org/stable/c/6a227764d4e9ffdbe9ab4e59e9b24e21fa0e91bd"},{"url":"https://git.kernel.org/stable/c/4a02cc97d87a3c2eb7c37ac6ea7e8ef8e8fc0344"},{"url":"https://git.kernel.org/stable/c/19ff998f1d27e1417b286ae0ec88fc19842d4f2f"},{"url":"https://git.kernel.org/stable/c/0c661d80fdbeea980d3e03b528ecb51e38f0d85e"},{"url":"https://git.kernel.org/stable/c/73174b4bb6fcd0e6cf973c9402a0fae2e567ad9f"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-12-03T09:17:54.070Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.3","versionEndExcluding":"5.10.276"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.3","versionEndExcluding":"5.15.227"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.3","versionEndExcluding":"6.12.120"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.3","versionEndExcluding":"6.18.66"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.3","versionEndExcluding":"7.3.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.3","versionEndExcluding":"7.4-rc3"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}