mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: "Eugenio Pérez" <eperezma@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	virtualization@lists.linux.dev, kvm@vger.kernel.org,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: vduse: add vq group support
Date: Sat, 27 Sep 2025 15:21:37 +0100	[thread overview]
Message-ID: <52c76446-117d-4953-9b33-32199f782b90@gmail.com> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 1205 bytes --]

Hi,

Static analysis on linux-next has found an issue with the following commit:

commit ffc3634b66967445f3368c3b53a42bccc52b2c7f
Author: Eugenio Pérez <eperezma@redhat.com>
Date:   Thu Sep 25 11:13:32 2025 +0200

     vduse: add vq group support


This issue is as follows in function vhost_vdpa_vring_ioct:

         case VHOST_VDPA_GET_VRING_GROUP: {
                 u64 group;

                 if (!ops->get_vq_group)
                         return -EOPNOTSUPP;
                 s.index = idx;
                 group = ops->get_vq_group(vdpa, idx);
                 if (group >= vdpa->ngroups || group > U32_MAX || group < 0)
                         return -EIO;
                 else if (copy_to_user(argp, &s, sizeof(s)))
                         return -EFAULT;
                 s.num = group;
                 return 0;
         }


The copy_to_user of struct s is copying a partially initialized struct 
s, field s.num contains garbage data from the stack and this is being 
copied back to user space. Field s.num should be assigned some value 
before the copy_to_user call to avoid uninitialized data from the stack 
being leaked to user space.

Colin


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

             reply	other threads:[~2025-09-27 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-27 14:21 Colin King (gmail) [this message]
2025-09-29  6:07 ` Eugenio Perez Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52c76446-117d-4953-9b33-32199f782b90@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®