{"id":"CVE-2026-143176","summary":"errseq: don't let errseq_check_and_advance() hide later errors","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nerrseq: don't let errseq_check_and_advance() hide later errors\n\nerrseq_check_and_advance() reads the errseq_t, sets ERRSEQ_SEEN with a\ncmpxchg() and then advances *since to the value it computed, ignoring\nwhether the cmpxchg() succeeded. When it fails because errseq_set()\nrecorded a different error in the meantime, *since ends up holding a\nvalue that was never stored in the errseq_t.\n\nerrseq_set() only bumps the counter when ERRSEQ_SEEN is set. So as long\nas nobody has seen the new error, recording the original errno again\nrecreates exactly the old value, and once another subscriber marks it\nseen, it is equal to the stale *since. The next check through that\ncursor then reports nothing, although -ENOSPC was recorded after the\nvalue that check reported, and -EIO was recorded again after it\nreturned:\n\n  cursor f                writeback              cursor g\n  --------                ---------              --------\n                          set(-EIO)\n  check_and_advance(&f)\n    old = [c, EIO]\n                          set(-ENOSPC)\n                          -\u003e [c, ENOSPC]\n    cmpxchg() fails\n    f = [c, EIO, SEEN]\n    returns -EIO\n                          set(-EIO)\n                          -\u003e [c, EIO]\n                          (no bump: unseen)\n                                                 check_and_advance(&g)\n                                                 -\u003e [c, EIO, SEEN]\n                                                 returns -EIO\n  check_and_advance(&f)\n    [c, EIO, SEEN] == f\n    returns 0             \u003c- -ENOSPC and the second -EIO are lost\n\nFor file-\u003ef_wb_err this means that fsync() on one descriptor can return\n0 although writeback failed after the previous fsync() on that\ndescriptor returned, when writeback errors race with fsync() on another\ndescriptor of the same file. The same applies to syncfs() through\nsb-\u003es_wb_err, which every file on the filesystem shares, and to the\next4 and jbd2 cursors on the block device mapping. The kernel-doc\npromises \"Negative errno if one has been stored, or 0 if no new error\nhas occurred\".\n\nRetry with the value found when the cmpxchg() fails, so that *since is\nonly ever advanced to a value that was actually stored with ERRSEQ_SEEN\nset. Every later errseq_set() then has to bump the counter, and the\nerror is reported. The retry loop terminates because each iteration\nneeds a concurrent update, like the loop in errseq_set().\n\nA TLA+ model of errseq_set() and errseq_check_and_advance(), checked\nwith the TLC model checker, finds the lost error with the current code;\nwith this change TLC checks that an error recorded after a check\nreturned is always reported by the next check (exhaustively for two\nsubscribers with three checks each, and one writer recording four\nerrors or two writers recording two each). The KUnit race test added\nin the next patch misses the error in 1-6% of 2 million rounds on\n4-CPU UML before this change (depending on host load), and in none\nafter it.","modified":"2026-12-03T11:01:40.615807625Z","published":"2026-12-03T09:20:10.273Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143176.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/2b049d0432dc33de4ae72548cf4dea4c594ca595"},{"type":"WEB","url":"https://git.kernel.org/stable/c/94defd41d80f10bbe883c0c8d1b28d1665b6b153"},{"type":"WEB","url":"https://git.kernel.org/stable/c/a06aca98fb2d0deb3a5be25e1482d07c7267c15a"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143176.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-143176"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"84cbadadc6eafc4798513773a2c8fce37dcd2fb8"},{"fixed":"2b049d0432dc33de4ae72548cf4dea4c594ca595"},{"fixed":"a06aca98fb2d0deb3a5be25e1482d07c7267c15a"},{"fixed":"94defd41d80f10bbe883c0c8d1b28d1665b6b153"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143176.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.13.0"},{"fixed":"6.18.66"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143176.json"}}],"schema_version":"1.9.2"}