summaryrefslogtreecommitdiff
path: root/tools/perf/scripts
diff options
context:
space:
mode:
authorzhang jiao <zhangjiao2@cmss.chinamobile.com>2026-10-29 15:25:10 +0800
committerMichael S. Tsirkin <mst@redhat.com>2026-11-03 07:32:14 -0500
commit92368f4fb8ff40b87faa4acf1775720ffaf5749d (patch)
treedc65e97757e234005644f865ecc2657caec45516 /tools/perf/scripts
parent058fc59326af3350c6e830858e56d2aeecabe0a2 (diff)
virtio_ring: Initialize id field in packed indirect descriptors
The virtqueue_add_indirect_packed() function fills an indirect descriptor table with addr, len, and flags for each entry, but does not initialize the id field of struct vring_packed_desc. The table is allocated via kmalloc() (not kzalloc) and then DMA-mapped with DMA_TO_DEVICE, making the uninitialized 2-byte id field of each descriptor readable by the device. This leaks kernel heap memory to the device for every packed indirect descriptor entry. A malicious or compromised device could extract heap contents by reading the id fields from the DMA-mapped indirect descriptor tables. This affects all virtio devices that use packed virtqueues with indirect descriptors, which is the common configuration for modern virtio devices. Fix this by explicitly initializing desc[i].id to zero in the descriptor filling loop. The id field is unused in indirect descriptor table entries per the virtio specification (only the head descriptor in the main ring uses id for buffer identification), so setting it to zero is semantically correct. This matches the split ring path where all four fields of struct vring_desc (addr, len, flags, next) are explicitly written in virtqueue_add_desc_split(). Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261029072511.851-1-zhangjiao2@cmss.chinamobile.com>
Diffstat (limited to 'tools/perf/scripts')
0 files changed, 0 insertions, 0 deletions