Skip to content

Commit bfb4cf9

Browse files
Lizhi Xugregkh
authored andcommitted
vmci: Prevent the dispatching of uninitialized payloads
The reproducer executes the host's unlocked_ioctl call in two different tasks. When init_context fails, the struct vmci_event_ctx is not fully initialized when executing vmci_datagram_dispatch() to send events to all vm contexts. This affects the datagram taken from the datagram queue of its context by another task, because the datagram payload is not initialized according to the size payload_size, which causes the kernel data to leak to the user space. Before dispatching the datagram, and before setting the payload content, explicitly set the payload content to 0 to avoid data leakage caused by incomplete payload initialization. Fixes: 28d6692 ("VMCI: context implementation.") Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=9b9124ae9b12d5af5d95 Tested-by: [email protected] Signed-off-by: Lizhi Xu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a398c42 commit bfb4cf9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/misc/vmw_vmci/vmci_context.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ static int ctx_fire_notification(u32 context_id, u32 priv_flags)
251251
ev.msg.hdr.src = vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID,
252252
VMCI_CONTEXT_RESOURCE_ID);
253253
ev.msg.hdr.payload_size = sizeof(ev) - sizeof(ev.msg.hdr);
254+
memset((char*)&ev.msg.hdr + sizeof(ev.msg.hdr), 0,
255+
ev.msg.hdr.payload_size);
254256
ev.msg.event_data.event = VMCI_EVENT_CTX_REMOVED;
255257
ev.payload.context_id = context_id;
256258

0 commit comments

Comments
 (0)