All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Will Deacon <will.deacon@arm.com>
Cc: Marc.Zyngier@arm.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, ericvh@gmail.com,
	levinsasha928@gmail.com
Subject: Re: [PATCH v2 2/3] virtio: 9p: correctly pass physical address to userspace for high pages
Date: Mon, 22 Oct 2012 15:05:30 -0700	[thread overview]
Message-ID: <20121022150530.99caaecf.akpm@linux-foundation.org> (raw)
In-Reply-To: <1350651813-8694-2-git-send-email-will.deacon@arm.com>

On Fri, 19 Oct 2012 14:03:32 +0100
Will Deacon <will.deacon@arm.com> wrote:

> When using a virtio transport, the 9p net device may pass the physical
> address of a kernel buffer to userspace via a scatterlist inside a
> virtqueue. If the kernel buffer is mapped outside of the linear mapping
> (e.g. highmem), then virt_to_page will return a bogus value and we will
> populate the scatterlist with junk.
> 
> This patch uses kmap_to_page when populating the page array for a kernel
> buffer.
> 
> ...
>
> --- a/net/9p/trans_virtio.c
> +++ b/net/9p/trans_virtio.c
> @@ -39,6 +39,7 @@
>  #include <linux/inet.h>
>  #include <linux/idr.h>
>  #include <linux/file.h>
> +#include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <net/9p/9p.h>
>  #include <linux/parser.h>
> @@ -325,7 +326,7 @@ static int p9_get_mapped_pages(struct virtio_chan *chan,
>  		int count = nr_pages;
>  		while (nr_pages) {
>  			s = rest_of_page(data);
> -			pages[index++] = virt_to_page(data);
> +			pages[index++] = kmap_to_page(data);
>  			data += s;
>  			nr_pages--;

I am suspecting that this code has been busted for a while on x86
highmem, but nobody noticed.  True or false?  If "true" then I expect
that a -stable backport is appropriate?

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Will Deacon <will.deacon@arm.com>
Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.com.au,
	levinsasha928@gmail.com, Marc.Zyngier@arm.com,
	virtualization@lists.linux-foundation.org, ericvh@gmail.com
Subject: Re: [PATCH v2 2/3] virtio: 9p: correctly pass physical address to userspace for high pages
Date: Mon, 22 Oct 2012 15:05:30 -0700	[thread overview]
Message-ID: <20121022150530.99caaecf.akpm@linux-foundation.org> (raw)
In-Reply-To: <1350651813-8694-2-git-send-email-will.deacon@arm.com>

On Fri, 19 Oct 2012 14:03:32 +0100
Will Deacon <will.deacon@arm.com> wrote:

> When using a virtio transport, the 9p net device may pass the physical
> address of a kernel buffer to userspace via a scatterlist inside a
> virtqueue. If the kernel buffer is mapped outside of the linear mapping
> (e.g. highmem), then virt_to_page will return a bogus value and we will
> populate the scatterlist with junk.
> 
> This patch uses kmap_to_page when populating the page array for a kernel
> buffer.
> 
> ...
>
> --- a/net/9p/trans_virtio.c
> +++ b/net/9p/trans_virtio.c
> @@ -39,6 +39,7 @@
>  #include <linux/inet.h>
>  #include <linux/idr.h>
>  #include <linux/file.h>
> +#include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <net/9p/9p.h>
>  #include <linux/parser.h>
> @@ -325,7 +326,7 @@ static int p9_get_mapped_pages(struct virtio_chan *chan,
>  		int count = nr_pages;
>  		while (nr_pages) {
>  			s = rest_of_page(data);
> -			pages[index++] = virt_to_page(data);
> +			pages[index++] = kmap_to_page(data);
>  			data += s;
>  			nr_pages--;

I am suspecting that this code has been busted for a while on x86
highmem, but nobody noticed.  True or false?  If "true" then I expect
that a -stable backport is appropriate?


  reply	other threads:[~2012-10-22 22:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 13:03 [PATCH v2 1/3] mm: highmem: export kmap_to_page for modules Will Deacon
2012-10-19 13:03 ` Will Deacon
2012-10-19 13:03 ` [PATCH v2 2/3] virtio: 9p: correctly pass physical address to userspace for high pages Will Deacon
2012-10-19 13:03   ` Will Deacon
2012-10-22 22:05   ` Andrew Morton [this message]
2012-10-22 22:05     ` Andrew Morton
2012-10-19 13:03 ` [PATCH v2 3/3] virtio: force vring descriptors to be allocated from lowmem Will Deacon
2012-10-19 13:03   ` Will Deacon
2012-10-22 22:08 ` [PATCH v2 1/3] mm: highmem: export kmap_to_page for modules Andrew Morton
2012-10-22 22:08   ` Andrew Morton
2012-10-22 23:55 ` Rusty Russell
2012-10-22 23:55   ` Rusty Russell
2012-10-23 10:33   ` Will Deacon
2012-10-23 10:33     ` Will Deacon

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=20121022150530.99caaecf.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Marc.Zyngier@arm.com \
    --cc=ericvh@gmail.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=will.deacon@arm.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 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.