summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2021-10-27 05:21:04 +0300
committerMichael S. Tsirkin <mst@redhat.com>2021-11-01 12:26:48 +0300
commit939779f5152d161b34f612af29e7dc1ac4472fcf (patch)
treebf93ea06622a3e1fb9263a12ed4c7bd0f415b193 /security
parentf0839372478ec53ff6d728422a6088f8a35b3a28 (diff)
downloadlinux-939779f5152d161b34f612af29e7dc1ac4472fcf.tar.xz
virtio_ring: validate used buffer length
This patch validate the used buffer length provided by the device before trying to use it. This is done by record the in buffer length in a new field in desc_state structure during virtqueue_add(), then we can fail the virtqueue_get_buf() when we find the device is trying to give us a used buffer length which is greater than the in buffer length. Since some drivers have already done the validation by themselves, this patch tries to makes the core validation optional. For the driver that doesn't want the validation, it can set the suppress_used_validation to be true (which could be overridden by force_used_validation module parameter). To be more efficient, a dedicate array is used for storing the validate used length, this helps to eliminate the cache stress if validation is done by the driver. Signed-off-by: Jason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20211027022107.14357-2-jasowang@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions