lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb09900a-8443-4260-9b66-5431a85ca102@gmail.com>
Date: Mon, 14 Oct 2024 10:39:26 +0100
From: "Colin King (gmail)" <colin.i.king@...il.com>
To: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Cc: Jason Wang <jasowang@...hat.com>, Paolo Abeni <pabeni@...hat.com>,
 "Michael S. Tsirkin\"" <mst@...hat.com>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: re: virtio_net: support device stats

Hi,

Static analysis on Linux-next has detected a potential issue with the 
following commit:

commit 941168f8b40e50518a3bc6ce770a7062a5d99230
Author: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Date:   Fri Apr 26 11:39:24 2024 +0800

     virtio_net: support device stats


The issue is in function virtnet_stats_ctx_init, in 
drivers/net/virtio_net.c as follows:

         if (vi->device_stats_cap & VIRTIO_NET_STATS_TYPE_CVQ) {
                 queue_type = VIRTNET_Q_TYPE_CQ;

                 ctx->bitmap[queue_type]   |= VIRTIO_NET_STATS_TYPE_CVQ;
                 ctx->desc_num[queue_type] += 
ARRAY_SIZE(virtnet_stats_cvq_desc);
                 ctx->size[queue_type]     += sizeof(struct 
virtio_net_stats_cvq);
         }


ctx->bitmap is declared as a u32 however it is being bit-wise or'd with 
VIRTIO_NET_STATS_TYPE_CVQ and this is defined as 1 << 32:

include/uapi/linux/virtio_net.h:#define VIRTIO_NET_STATS_TYPE_CVQ 
(1ULL << 32)

..and hence the bit-wise or operation won't set any bits in ctx->bitmap 
because 1ULL < 32 is too wide for a u32. I suspect ctx->bitmap should be 
declared as u64.

Colin





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ