Skip to content

Commit 5671c3b

Browse files
committed
Merge: CVE-2024-39499: vmci: prevent speculation leaks by sanitizing event in event_deliver()
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4701 JIRA: https://issues.redhat.com/browse/RHEL-47688 CVE: CVE-2024-39499 ``` vmci: prevent speculation leaks by sanitizing event in event_deliver() Coverity spotted that event_msg is controlled by user-space, event_msg->event_data.event is passed to event_deliver() and used as an index without sanitization. This change ensures that the event index is sanitized to mitigate any possibility of speculative information leaks. This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Only compile tested, no access to HW. Fixes: 1d99020 ("VMCI: event handling implementation.") Cc: stable <stable@kernel.org> Signed-off-by: Hagar Gamal Halim Hemdan <hagarhem@amazon.com> Link: https://lore.kernel.org/stable/20231127193533.46174-1-hagarhem%40amazon.com Link: https://lore.kernel.org/r/20240430085916.4753-1-hagarhem@amazon.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 8003f00) ``` Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> Approved-by: Charles Mirabile <cmirabil@redhat.com> Approved-by: Andrew Halaney <ahalaney@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents d5d6b73 + e56d6b4 commit 5671c3b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/misc/vmw_vmci/vmci_event.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/vmw_vmci_api.h>
1010
#include <linux/list.h>
1111
#include <linux/module.h>
12+
#include <linux/nospec.h>
1213
#include <linux/sched.h>
1314
#include <linux/slab.h>
1415
#include <linux/rculist.h>
@@ -86,9 +87,12 @@ static void event_deliver(struct vmci_event_msg *event_msg)
8687
{
8788
struct vmci_subscription *cur;
8889
struct list_head *subscriber_list;
90+
u32 sanitized_event, max_vmci_event;
8991

9092
rcu_read_lock();
91-
subscriber_list = &subscriber_array[event_msg->event_data.event];
93+
max_vmci_event = ARRAY_SIZE(subscriber_array);
94+
sanitized_event = array_index_nospec(event_msg->event_data.event, max_vmci_event);
95+
subscriber_list = &subscriber_array[sanitized_event];
9296
list_for_each_entry_rcu(cur, subscriber_list, node) {
9397
cur->callback(cur->id, &event_msg->event_data,
9498
cur->callback_data);

0 commit comments

Comments
 (0)