All of lore.kernel.org
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.ibm.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.com, virtualization@lists.linux-foundation.org,
	f.hetzelt@tu-berlin.de, linux-kernel@vger.kernel.org,
	david.kaplan@amd.com, konrad.wilk@oracle.com,
	Halil Pasic <pasic@linux.ibm.com>
Subject: Re: [PATCH V5 1/4] virtio_ring: validate used buffer length
Date: Fri, 19 Nov 2021 16:09:51 +0100	[thread overview]
Message-ID: <20211119160951.5f2294c8.pasic@linux.ibm.com> (raw)
In-Reply-To: <20211027022107.14357-2-jasowang@redhat.com>

On Wed, 27 Oct 2021 10:21:04 +0800
Jason Wang <jasowang@redhat.com> wrote:

> This patch validate the used buffer length provided by the device
> before trying to use it. This is done by record the in buffer length
> in a new field in desc_state structure during virtqueue_add(), then we
> can fail the virtqueue_get_buf() when we find the device is trying to
> give us a used buffer length which is greater than the in buffer
> length.
> 
> Since some drivers have already done the validation by themselves,
> this patch tries to makes the core validation optional. For the driver
> that doesn't want the validation, it can set the
> suppress_used_validation to be true (which could be overridden by
> force_used_validation module parameter). To be more efficient, a
> dedicate array is used for storing the validate used length, this
> helps to eliminate the cache stress if validation is done by the
> driver.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Hi Jason!

Our CI has detected, that virtio-vsock became unusable with this
patch on s390x. I didn't test on x86 yet. The guest kernel says
something like:
vmw_vsock_virtio_transport virtio1: tx: used len 44 is larger than in buflen 0

Did you, or anybody else, see something like this on platforms other that
s390x?

I had a quick look at this code, and I speculate that it probably
uncovers a pre-existig bug, rather than introducing a new one.

If somebody is already working on this please reach out to me.

Regards,
Halil

WARNING: multiple messages have this Message-ID (diff)
From: Halil Pasic <pasic@linux.ibm.com>
To: Jason Wang <jasowang@redhat.com>
Cc: david.kaplan@amd.com, konrad.wilk@oracle.com,
	f.hetzelt@tu-berlin.de, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	Halil Pasic <pasic@linux.ibm.com>,
	mst@redhat.com
Subject: Re: [PATCH V5 1/4] virtio_ring: validate used buffer length
Date: Fri, 19 Nov 2021 16:09:51 +0100	[thread overview]
Message-ID: <20211119160951.5f2294c8.pasic@linux.ibm.com> (raw)
In-Reply-To: <20211027022107.14357-2-jasowang@redhat.com>

On Wed, 27 Oct 2021 10:21:04 +0800
Jason Wang <jasowang@redhat.com> wrote:

> This patch validate the used buffer length provided by the device
> before trying to use it. This is done by record the in buffer length
> in a new field in desc_state structure during virtqueue_add(), then we
> can fail the virtqueue_get_buf() when we find the device is trying to
> give us a used buffer length which is greater than the in buffer
> length.
> 
> Since some drivers have already done the validation by themselves,
> this patch tries to makes the core validation optional. For the driver
> that doesn't want the validation, it can set the
> suppress_used_validation to be true (which could be overridden by
> force_used_validation module parameter). To be more efficient, a
> dedicate array is used for storing the validate used length, this
> helps to eliminate the cache stress if validation is done by the
> driver.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Hi Jason!

Our CI has detected, that virtio-vsock became unusable with this
patch on s390x. I didn't test on x86 yet. The guest kernel says
something like:
vmw_vsock_virtio_transport virtio1: tx: used len 44 is larger than in buflen 0

Did you, or anybody else, see something like this on platforms other that
s390x?

I had a quick look at this code, and I speculate that it probably
uncovers a pre-existig bug, rather than introducing a new one.

If somebody is already working on this please reach out to me.

Regards,
Halil
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2021-11-19 15:10 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27  2:21 [PATCH V5 0/4] Validate used buffer length Jason Wang
2021-10-27  2:21 ` Jason Wang
2021-10-27  2:21 ` [PATCH V5 1/4] virtio_ring: validate " Jason Wang
2021-10-27  2:21   ` Jason Wang
2021-11-02  3:18   ` Xuan Zhuo
2021-11-02  3:54     ` Jason Wang
2021-11-02  3:54       ` Jason Wang
2021-11-19 15:09   ` Halil Pasic [this message]
2021-11-19 15:09     ` Halil Pasic
2021-11-22  3:51     ` Jason Wang
2021-11-22  3:51       ` Jason Wang
2021-11-22  5:35       ` Halil Pasic
2021-11-22  5:35         ` Halil Pasic
2021-11-22  5:49         ` Halil Pasic
2021-11-22  5:49           ` Halil Pasic
2021-11-22  6:25           ` Jason Wang
2021-11-22  6:25             ` Jason Wang
2021-11-22  7:55             ` Stefano Garzarella
2021-11-22  7:55               ` Stefano Garzarella
2021-11-22 11:08               ` Stefano Garzarella
2021-11-22 11:08                 ` Stefano Garzarella
2021-11-22 14:24                 ` Halil Pasic
2021-11-22 14:24                   ` Halil Pasic
2021-11-22 16:23                   ` Stefano Garzarella
2021-11-22 16:23                     ` Stefano Garzarella
2021-11-22 13:50             ` Halil Pasic
2021-11-22 13:50               ` Halil Pasic
2021-11-23  2:30               ` Jason Wang
2021-11-23  2:30                 ` Jason Wang
2021-11-23 12:17               ` Michael S. Tsirkin
2021-11-23 12:17                 ` Michael S. Tsirkin
2021-11-23 12:43                 ` Halil Pasic
2021-11-23 12:43                   ` Halil Pasic
2021-11-22 20:23             ` Halil Pasic
2021-11-22 20:23               ` Halil Pasic
2021-11-23  2:25               ` Jason Wang
2021-11-23  2:25                 ` Jason Wang
2021-11-23 11:05                 ` Michael S. Tsirkin
2021-11-23 11:05                   ` Michael S. Tsirkin
2021-11-24  1:30                   ` Michael Ellerman
2021-11-24  1:30                     ` Michael Ellerman
2021-11-24  2:26                     ` Jason Wang
2021-11-24  2:26                       ` Jason Wang
2021-11-24  2:33                       ` Jason Wang
2021-11-24  2:33                         ` Jason Wang
2021-11-24  7:22                         ` Michael S. Tsirkin
2021-11-24  7:22                           ` Michael S. Tsirkin
2021-11-24  7:59                           ` Jason Wang
2021-11-24  7:59                             ` Jason Wang
2021-11-24  8:24                             ` Michael S. Tsirkin
2021-11-24  8:24                               ` Michael S. Tsirkin
2021-11-24  8:28                               ` Jason Wang
2021-11-24  8:28                                 ` Jason Wang
2021-11-24 11:33                         ` Halil Pasic
2021-11-24 11:33                           ` Halil Pasic
2021-11-25  2:27                           ` Jason Wang
2021-11-25  2:27                             ` Jason Wang
2021-11-22  7:42       ` Stefano Garzarella
2021-11-22  7:42         ` Stefano Garzarella
2021-10-27  2:21 ` [PATCH V5 2/4] virtio-net: don't let virtio core to validate used length Jason Wang
2021-10-27  2:21   ` Jason Wang
2021-10-27  2:21 ` [PATCH V5 3/4] virtio-blk: " Jason Wang
2021-10-27  2:21   ` Jason Wang
2021-10-27  2:21 ` [PATCH V5 4/4] virtio-scsi: don't let virtio core to validate used buffer length Jason Wang
2021-10-27  2:21   ` Jason Wang

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=20211119160951.5f2294c8.pasic@linux.ibm.com \
    --to=pasic@linux.ibm.com \
    --cc=david.kaplan@amd.com \
    --cc=f.hetzelt@tu-berlin.de \
    --cc=jasowang@redhat.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.