Skip to contentSkip to conversation

Bug in xc_gntshr_munmap

DISCUSSION Vincent Bernardoff 2 participants 2 messages Jul 19, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

On the little program attached, xc_gntshr_munmap looks like it is not correctly un-sharing shared pages. Am I using these functions as they are intented to ?

Thanks in advance,

Vincent

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <xenctrl.h>

int main(int argc, char** argv)
{
int ret, i;
uint32_t refs[2] = {0};
void* pages;

  xc_gntshr *h = xc_gntshr_open(NULL, 0);

  if (h == NULL)
    {
      perror("xc_gntshr_open");
      exit (1);
    }

  for(i=0; i<10000; i++)
    {
      pages = xc_gntshr_share_pages(h, 0, 2, refs, 1);
      if (pages == NULL)
        {
          fprintf(stderr, "xc_gntshr_share_pages failed at the %dth iteration.\n", i);
          perror("xc_gntshr_share_pages");
          exit (1);
        }
      if(xc_gntshr_munmap(h, pages, 2) != 0)
        {
          perror("xc_gntshr_munmap");
          exit (1);
        }
    }

xc_gntshr_close(h);
}

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 6 lines · Vincent Bernardoff

Hi,

On the little program attached, xc_gntshr_munmap looks like it is not correctly un-sharing shared pages. Am I using these functions as they are intented to ?

Marek Marczykowski posted some patches back in April/May about a bug in xc_gntshr_munmap. I'd hazard a guess you are seeing the same thing.

Unfortunately those patches still had an outstanding issue and haven't been applied yet.

Some message ids:
<[email protected]> <[email protected]> <[email protected]> and in particular the reason it isn't applied yet:
<[email protected]>

Ian.