All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Jenny Herbert <jennifer.herbert@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 08/12] xen/grant-table: add a mechanism to safely unmap pages that are in use
Date: Wed, 7 Jan 2015 13:07:31 +0000	[thread overview]
Message-ID: <54AD2F93.209@citrix.com> (raw)
In-Reply-To: <1420632022.18631.58.camel@citrix.com>

On 07/01/15 12:00, Ian Campbell wrote:
> On Tue, 2015-01-06 at 18:57 +0000, David Vrabel wrote:
>> From: Jenny Herbert <jennifer.herbert@citrix.com>
>>
>> Introduce gnttab_unmap_refs_async() that can be used to safely unmap
>> pages that may be in use (ref count > 1).  If the pages are in use the
>> unmap is deferred and retried later.  This polling is not very clever
>> but it should be good enough if the cases where the delay is necessary
>> are rare.
>>
>> This is needed to allow block backends using grant mapping to safely
>> use network storage (block or filesystem based such as iSCSI or NFS).
>>
>> The network storage driver may complete a block request whilst there
>> is a queued network packet retry (because the ack from the remote end
>> races with deciding to queue the retry).  The pages for the retried
>> packet would be grant unmapped and the network driver (or hardware)
>> would access the unmapped page.
> 
> I thought this had been solved a little while ago by mapping a scratch
> page on unmap even for kernel space grant mappings, but both the design
> doc and here imply not (i.e. the scratch is for user grant mappings
> only), so I must be misremembering.

It was only for user grant mappings and it did not fix the case where
the page being unmapped was currently dma mapped.  This could have
resulted in the NIC transmitting sensitive data.

e.g.,

1. iscsi queues a retransmit with page P (frame F).
2. NIC driver DMA maps and queues frame F on h/w.
3. iscsi completes the I/O.
4. page P is unmapped.
5. response is sent to guest
6. guest reuses frame F.
7. NIC transmits frame F.

We don't use this safe unmap mechanism for netback because the zero copy
stuff means we don't need it and the polling on the unmap is high
latency and only good enough if the polling is needed very rarely.

David

  parent reply	other threads:[~2015-01-07 13:07 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-06 18:57 [RFC PATCH 00/12] xen: fix many long-standing grant mapping bugs David Vrabel
2015-01-06 18:57 ` [PATCH 01/12] mm: allow for an alternate set of pages for userspace mappings David Vrabel
2015-01-06 18:57 ` [PATCH 02/12] mm: add 'foreign' alias for the 'pinned' page flag David Vrabel
2015-01-07 17:12   ` Konrad Rzeszutek Wilk
2015-01-06 18:57 ` [PATCH 03/12] xen/grant-table: pre-populate kernel unmap ops for xen_gnttab_unmap_refs() David Vrabel
2015-01-06 18:57 ` [PATCH 04/12] xen: remove scratch frames for ballooned pages and m2p override David Vrabel
2015-01-06 18:57 ` [PATCH 05/12] x86/xen: require ballooned pages for grant maps David Vrabel
2015-01-06 18:57 ` [PATCH 06/12] xen: mark grant mapped pages as foreign David Vrabel
2015-01-07 11:53   ` Ian Campbell
2015-01-09 16:03   ` Stefano Stabellini
2015-01-09 16:19     ` Ian Campbell
2015-01-09 16:39       ` David Vrabel
2015-01-09 16:46         ` Stefano Stabellini
2015-01-09 16:47         ` Ian Campbell
2015-01-06 18:57 ` [PATCH 07/12] xen-netback: use foreign page information from the pages themselves David Vrabel
2015-01-07 11:57   ` Ian Campbell
2015-01-06 18:57 ` [PATCH 08/12] xen/grant-table: add a mechanism to safely unmap pages that are in use David Vrabel
2015-01-07 12:00   ` Ian Campbell
2015-01-07 12:06     ` Ian Campbell
2015-01-07 13:07     ` David Vrabel [this message]
2015-01-07 13:24       ` Ian Campbell
2015-01-07 13:30         ` David Vrabel
2015-01-07 13:33           ` Ian Campbell
2015-01-09 16:11   ` Stefano Stabellini
2015-01-06 18:57 ` [PATCH 09/12] xen/gntdev: safely unmap grants in case they are still " David Vrabel
2015-01-06 18:57 ` [PATCH 10/12] xen-blkback: " David Vrabel
2015-01-06 18:57 ` [PATCH 11/12] xen/gntdev: mark userspace PTEs as special on x86 PV guests David Vrabel
2015-01-07 12:11   ` Ian Campbell
2015-01-07 13:23     ` David Vrabel
2015-01-07 13:32       ` Ian Campbell
2015-01-06 18:57 ` [PATCH 12/12] xen/gntdev: provide a set of pages for each VMA David Vrabel
2015-01-09 15:55   ` Stefano Stabellini
2015-01-09 16:05     ` Stefano Stabellini
2015-01-09 16:41       ` David Vrabel

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=54AD2F93.209@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jennifer.herbert@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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.