All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: IOCTL_PRIVCMD_MMAPBATCH on Xen 4.13.0
Date: Sun, 17 May 2020 11:30:59 +0200	[thread overview]
Message-ID: <20200517093059.GD1820@antioche.eu.org> (raw)
In-Reply-To: <d22b6b7c-9d1c-4cfb-427a-ca6f440a9b08@citrix.com>

On Sat, May 16, 2020 at 05:18:45PM +0100, Andrew Cooper wrote:
> On 15/05/2020 22:53, Manuel Bouyer wrote:
> > On Fri, May 15, 2020 at 10:38:13PM +0100, Andrew Cooper wrote:
> >>> [...]
> >>> Does it help ?
> >> Yes and no.  This is collateral damage of earlier bug.
> >>
> >> What failed was xen_init_fv()'s
> >>
> >>     shared_page = xc_map_foreign_range(xc_handle, domid, XC_PAGE_SIZE,
> >>                                        PROT_READ|PROT_WRITE, ioreq_pfn);
> >>     if (shared_page == NULL) {
> >>         fprintf(logfile, "map shared IO page returned error %d\n", errno);
> >>         exit(-1);
> >>     }
> >>
> >> because we've ended up with a non-NULL pointer with no mapping behind
> >> it, hence the SIGSEGV for the first time we try to use the pointer.
> >>
> >> Whatever logic is behind xc_map_foreign_range() should have returned
> >> NULL or a real mapping.
> > What's strange is that the mapping is validated, by mapping it in
> > the dom0 kernel space. But when we try to remap in in the process's
> > space, it fails.
> 
> Hmm - this sounds like a kernel bug I'm afraid.

no I don't think it is. It works with Xen 4.11, and it works with 4.13 for
PV/PVH domUs. Maybe there's a missing flag in the PTE of some sort that is
mandatory for 4.13 but not 4.11 for userland PTE but it doens't look obvious.

The difference could be that the kernel page tables are active when
mapping the foreing page in the dom0's kernel space, but the
user process page table it not (obviously, as we're in the kernel
when doing the mapping).

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--


  reply	other threads:[~2020-05-17  9:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 20:29 IOCTL_PRIVCMD_MMAPBATCH on Xen 4.13.0 Manuel Bouyer
2020-05-15 21:00 ` Andrew Cooper
2020-05-15 21:06   ` Manuel Bouyer
2020-05-15 21:38     ` Andrew Cooper
2020-05-15 21:53       ` Manuel Bouyer
2020-05-16 16:18         ` Andrew Cooper
2020-05-17  9:30           ` Manuel Bouyer [this message]
2020-05-17 17:32           ` Manuel Bouyer
2020-05-17 17:56             ` Manuel Bouyer
2020-05-18  7:36               ` Paul Durrant
2020-05-18 17:31                 ` Manuel Bouyer
2020-05-19  7:34                   ` Jan Beulich
2020-05-19  8:46                     ` Manuel Bouyer
2020-05-19  8:51                       ` Jan Beulich
2020-05-19  9:54               ` Roger Pau Monné
2020-05-19 10:28                 ` Manuel Bouyer

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=20200517093059.GD1820@antioche.eu.org \
    --to=bouyer@antioche.eu.org \
    --cc=andrew.cooper3@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.