From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Jason Wang <jasowang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Ohad Ben-Cohen <ohad@wizery.com>,
linux-remoteproc@vger.kernel.org,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH v2] rpmsg: virtio: don't let virtio core to validate used length
Date: Thu, 2 Dec 2021 10:00:11 -0700 [thread overview]
Message-ID: <20211202170011.GA900071@p14s> (raw)
In-Reply-To: <CACGkMEvQoUcPFgOTvEDGkZHMXhjhPrk0xq-Zq3+G20_Lp-hu8A@mail.gmail.com>
Hey guys,
On Thu, Nov 25, 2021 at 10:15:44AM +0800, Jason Wang wrote:
> On Thu, Nov 25, 2021 at 5:12 AM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Wed, Nov 24, 2021 at 05:20:45PM +0100, Arnaud Pouliquen wrote:
> > > Using OpenAMP library on remote side, when the rpmsg framework tries to
> > > reuse the buffer the following error message is displayed in
> > > the virtqueue_get_buf_ctx_split function:
> > > "virtio_rpmsg_bus virtio0: output:used len 28 is larger than in buflen 0"
> > >
> > > As described in virtio specification:
> > > "many drivers ignored the len value, as a result, many devices set len
> > > incorrectly. Thus, when using the legacy interface, it is generally
> > > a good idea to ignore the len value in used ring entries if possible."
> > >
> > > To stay in compliance with the legacy libraries, this patch prevents the
> > > virtio core from validating used length.
> > >
> > > Fixes: 939779f5152d ("virtio_ring: validate used buffer length")
> > >
> > > Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
> > > Cc: Jason Wang <jasowang@redhat.com>
> > > Cc: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> >
> > Arnaud, thanks a lot for the analysis.
> >
> > Jason, I think this is another good point. We really should not
> > validate input for legacy devices at all.
>
> I agree. Will do that in the next version.
I'm a little unclear about the "next version" in the above comment - is this
something I should wait for? Should I move forward with Arnaud's patch?
Thanks,
Mathieu
>
> Thanks
>
> >
> >
> > > Update vs v1[1]: update commit message to clarify the context.
> > >
> > > base-commit: fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf
> > >
> > > [1]https://lore.kernel.org/lkml/20211122160812.25125-1-arnaud.pouliquen@foss.st.com/T/
> > > ---
> > > drivers/rpmsg/virtio_rpmsg_bus.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> > > index 9c112aa65040..5f73f19c2c38 100644
> > > --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> > > +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> > > @@ -1054,6 +1054,7 @@ static struct virtio_driver virtio_ipc_driver = {
> > > .feature_table_size = ARRAY_SIZE(features),
> > > .driver.name = KBUILD_MODNAME,
> > > .driver.owner = THIS_MODULE,
> > > + .suppress_used_validation = true,
> > > .id_table = id_table,
> > > .probe = rpmsg_probe,
> > > .remove = rpmsg_remove,
> > > --
> > > 2.17.1
> >
>
next prev parent reply other threads:[~2021-12-02 17:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 16:20 [PATCH v2] rpmsg: virtio: don't let virtio core to validate used length Arnaud Pouliquen
2021-11-24 21:12 ` Michael S. Tsirkin
2021-11-25 2:15 ` Jason Wang
2021-12-02 17:00 ` Mathieu Poirier [this message]
2021-12-03 2:07 ` Jason Wang
2021-12-03 14:34 ` Arnaud POULIQUEN
2021-12-03 18:57 ` Mathieu Poirier
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=20211202170011.GA900071@p14s \
--to=mathieu.poirier@linaro.org \
--cc=arnaud.pouliquen@foss.st.com \
--cc=bjorn.andersson@linaro.org \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mst@redhat.com \
--cc=ohad@wizery.com \
/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