]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: avoid possible double fetch in handling CQE
authorLalithambika Krishnakumar <lalithambika.krishnakumar@intel.com>
Wed, 23 Dec 2020 22:09:00 +0000 (14:09 -0800)
committerChristoph Hellwig <hch@lst.de>
Wed, 6 Jan 2021 09:30:37 +0000 (10:30 +0100)
commit171b10f7a86cd6b28aee3e093f760b384f821475
tree9d613daac28ccc1da9bcfc7e581293b7a9c3c3c5
parentf13c26d17de2a775a72a925678d0360399815eb4
nvme: avoid possible double fetch in handling CQE

While handling the completion queue, keep a local copy of the command id
from the DMA-accessible completion entry. This silences a time-of-check
to time-of-use (TOCTOU) warning from KF/x[1], with respect to a
Thunderclap[2] vulnerability analysis. The double-read impact appears
benign.

There may be a theoretical window for @command_id to be used as an
adversary-controlled array-index-value for mounting a speculative
execution attack, but that mitigation is saved for a potential follow-on.
A man-in-the-middle attack on the data payload is out of scope for this
analysis and is hopefully mitigated by filesystem integrity mechanisms.

[1] https://github.com/intel/kernel-fuzzer-for-xen-project
[2] http://thunderclap.io/thunderclap-paper-ndss2019.pdf
Signed-off-by: Lalithambika Krishna Kumar <lalithambika.krishnakumar@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c