mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Marc Zyngier <Marc.Zyngier@arm.com>
Subject: Re: [PATCH] virtio: 9p: correctly pass physical address to userspace for high pages
Date: Wed, 17 Oct 2012 17:17:38 +0100	[thread overview]
Message-ID: <20121017161738.GK5973@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <CA+1xoqcjomrD05vxdgx4FG2wR8DTmV58Xk5=BeVD3JGVfWrssA@mail.gmail.com>

On Wed, Oct 17, 2012 at 05:05:00PM +0100, Sasha Levin wrote:
> On Wed, Oct 17, 2012 at 6:14 AM, Will Deacon <will.deacon@arm.com> wrote:
> > When using a virtio transport, the 9p net device allocates pages to back
> > the descriptors inserted into the virtqueue. These allocations may be
> > performed from atomic context (under the channel lock) and can therefore
> > return high mappings which aren't suitable for virt_to_phys.
> >
> > This patch ensures that virtual addresses for virtio queue descriptors
> > are converted to physical addresses using kmap_to_page, which handles
> > high memory correctly.
> >
> > Cc: Rusty Russell <rusty@rustcorp.com.au>
> > Cc: Sasha Levin <levinsasha928@gmail.com>
> > Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > ---
> 
> One of the things I was seeing when fuzzing within lkvm were random
> crashes resulting
> from "odd" addresses used by virtio-9p queue descriptions. I
> attributed that to memory
> corruption as a result of something else failing the fuzz tests
> before, but this patch
> explains what might have gone wrong.

This is *exactly* what I have observed. More specifically, I hacked kvmtool
to support memory banks above 0x0 (I'll send some patches soon) so my
PHYS_OFFSET was 0x80000000. virtio-9p then gave me physical addresses at
0x7fe02000, which if linearly mapped would be 0xffe02000 -- the pkmap!

> I'll plug it in and run tests on it.

The kernel-janitors list pointed out to me that we need to EXPORT_SYMBOL on
kmap_to_page, so if you're building the virtio ring as a module you'll need
to do that.

Cheers,

Will

  reply	other threads:[~2012-10-17 16:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 10:14 Will Deacon
2012-10-17 16:05 ` Sasha Levin
2012-10-17 16:17   ` Will Deacon [this message]
2012-10-18  2:19 ` Rusty Russell
2012-10-18  9:42   ` Will Deacon
2012-10-18 23:39     ` Rusty Russell

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=20121017161738.GK5973@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=Marc.Zyngier@arm.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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®