CVE-2021-46921 json
locking/qrwlock: Fix ordering in queued_write_lock_slowpath()
published 2y ago modified 3mo ago also EUVD-2021-33569
- cvss
- 7.8
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.2%
- EPSS 0.2% chance of exploitation in 30 days, percentile 14%
- public exploits
- 0
- none known
Summary
In the Linux kernel, the following vulnerability has been resolved:
locking/qrwlock: Fix ordering in queued_write_lock_slowpath()
While this code is executed with the wait_lock held, a reader can acquire the lock without holding wait_lock. The writer side loops checking the value with the atomic_cond_read_acquire(), but only truly acquires the lock when the compare-and-exchange is completed successfully which isn’t ordered. This exposes the window between the acquire and the cmpxchg to an A-B-A problem which allows reads following the lock acquisition to observe values speculatively before the write lock is truly acquired.
We've seen a problem in epoll where the reader does a xchg while holding the read lock, but the writer can see a value change out from under it.
Writer | Reader -------------------------------------------------------------------------------- ep_scan_ready_list() | |- write_lock_irq() | |- queued_write_lock_slowpath() | |- atomic_cond_read_acquire() | | read_lock_irqsave(&ep->lock, flags); --> (observes value before unlock) | chain_epi_lockless() | | epi->next = xchg(&ep->ovflist, epi); | | read_unlock_irqrestore(&ep->lock, flags); | | | atomic_cmpxchg_relaxed() | |-- READ_ONCE(ep->ovflist); |
A core can order the read of the ovflist ahead of the atomic_cmpxchg_relaxed(). Switching the cmpxchg to use acquire semantics addresses this issue at which point the atomic_cond_read can be switched to use relaxed semantics.
[peterz: use try_cmpxchg()]
Patch / fix
- Linux Linux 4.19.189, 5.4.115, 5.10.33, 5.11.17, 5.12
- linux Debian 14, Debian 13, Debian 12 5.10.38-1
debian advisories DEBIAN-CVE-2021-46921
- linux Ubuntu 18.04 LTS 4.15.0-144.148
- linux Ubuntu 20.04 LTS 5.4.0-74.83
- linux-aws Ubuntu 18.04 LTS 4.15.0-1101.108
- linux-aws Ubuntu 20.04 LTS 5.4.0-1047.49
- linux-gcp Ubuntu 20.04 LTS 5.4.0-1044.47
- linux-kvm Ubuntu 18.04 LTS 4.15.0-1092.94
- linux-kvm Ubuntu 20.04 LTS 5.4.0-1040.41
- linux-azure Ubuntu 20.04 LTS 5.4.0-1048.50
ubuntu advisories UBUNTU-CVE-2021-46921
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- kernel-64kb SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS, Enterprise Storage 7.1 5.3.18-150300.59.158.1
- kernel-syms SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS +1 more 5.3.18-150300.59.158.1
- kernel-source SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS +1 more 5.3.18-150300.59.158.1
- kernel-default SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE Micro 5.2 +5 more 5.3.18-150300.59.158.1
- kernel-preempt SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS +1 more 5.3.18-150300.59.158.1
- kernel-obs-build SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS +1 more 5.3.18-150300.59.158.1
- kernel-default-base SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE Micro 5.2 +3 more 5.3.18-150300.59.158.1.150300.18.92.5
- kernel-rt SLE Micro 5.2, SLE Micro 5.1 5.3.18-150300.166.1
suse advisories SUSE-SU-2024:1489-1SUSE-SU-2024:1465-1SUSE-SU-2024:1454-1SUSE-SU-2024:0976-1SUSE-SU-2024:0975-1SUSE-SU-2024:0925-1
- git.kernel.org/stable/c/5902f9453a313be8fe78cbd7e7ca9dba9319fc6e commit
- git.kernel.org/stable/c/82808cc026811fbc3ecf0c0b267a12a339eead56 commit
- git.kernel.org/stable/c/82fa9ced35d88581cffa4a1c856fc41fca96d80a commit
- git.kernel.org/stable/c/d558fcdb17139728347bccc60a16af3e639649d2 commit
- git.kernel.org/stable/c/84a24bf8c52e66b7ac89ada5e3cfbe72d65c1896 commit
Is CVE-2021-46921 in your stack? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerVendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2021-46921 updated cvss 4.4
kernel: locking/qrwlock: Fix ordering in queued_write_lock_slowpath()
-
Red Hat Enterprise Linux 6 perf, kernel, python-perf, kernel-kdump, kernel-firmware, kernel-bootwrapper, +1 more Red Hat Enterprise Linux 7 perf, kernel, bpftool, kernel-rt, python-perf, kernel-kdump, +8 moreaffected: no fix planned “Out of support scope”
-
Red Hat Enterprise Linux 8 perf, kernel, bpftool, kernel-rt, kernel-core, kernel-tools, +29 moreaffected: no fix available
-
Red Hat Enterprise Linux 9 rv, perf, rtla, kernel, bpftool, libperf, +83 morenot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- partial
- Assessed
- 2y ago
Exploit prediction
0.24% chance of exploitation in the next 30 days, higher than 14% of all scored CVEs (FIRST EPSS, 2026-11-09).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 3.1 | 5.5 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N |
Affected products
- Linux Linux
Classification
- Weakness
-
- CWE-668 Exposure of Resource to Wrong Sphere
- Technology feeds
References
-
git.kernel.org
/stable/c/5902f9453a313be8fe78cbd7e7ca9dba9319fc6e
patch
-
git.kernel.org
/stable/c/82808cc026811fbc3ecf0c0b267a12a339eead56
patch
-
git.kernel.org
/stable/c/82fa9ced35d88581cffa4a1c856fc41fca96d80a
patch
-
git.kernel.org
/stable/c/d558fcdb17139728347bccc60a16af3e639649d2
patch
-
git.kernel.org
/stable/c/84a24bf8c52e66b7ac89ada5e3cfbe72d65c1896
patch
Sources
- CVE List CVE-2021-46921
- NVD CVE-2021-46921
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.