linux-um archives
 help / color / mirror / Atom feed
From: Renzo Davoli <renzo@cs.unibo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] Nesting and other problems on 2.6.29-rc7
Date: Mon, 9 Mar 2009 23:16:37 +0100	[thread overview]
Message-ID: <20090309221637.GB3525@cs.unibo.it> (raw)
In-Reply-To: <20090308170758.GE6847@cs.unibo.it>

On Sun, Mar 08, 2009 at 06:07:58PM +0100, Renzo Davoli wrote:
> Eeek! page_mapcount(page) went negative! (-1)
> Then the entire outer uml crashes.
> I have spent the entire day yesterday trying to figure out what has changed since 
> the beginning of February when it worked.
> 
> On 2.6.29-rc7 I get a different error (the Eeek error has been eliminated from the
> kernel source code): the output of the nested execution is at the end of this message.
> The nested UML crashes anyway, but the calling UML does not panic.

I am hunting the bug...

The following code contains the same mmap64 call that lead nested uml to fail.

-----
#define _GNU_SOURCE
#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>

main() {
  int fd;
  void * addr;
  fd = open("/tmp/test",O_CREAT|O_RDWR,0x777);
  addr = mmap64((void *) 0x100000, 0x1000,
      PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, 0x15e000);
  printf("%x\n",addr);
  munmap(addr,0x1000);
  close(fd);
}
----

If you compile and run this code on 2.6.28, UML crashes completely.
On 2.6.29 it returns the same memory errors of a nested UML execution.

mmap64 is a system call.
In the outer UML it is managed by sys_mmap2.
sys_mmap2 calls do_mmap_pgoff
do_mmap_pgoff calls mmap_region
mmap region seems to find the region already allocated, thus it
unmaps the first page:
----
munmap_back:
  vma = find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);
  if (vma && vma->vm_start < addr + len) {
    if (do_munmap(mm, addr, len))
      return -ENOMEM;
    goto munmap_back;
  }
----
It fails when returning from the second call of find_vma_prepare.

Is there somebody out there with an enlighting idea on what is going on?

ciao
	renzo


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


  reply	other threads:[~2009-03-09 22:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-08 17:07 [uml-devel] Nesting and other problems on 2.6.29-rc7 Renzo Davoli
2009-03-09 22:16 ` Renzo Davoli [this message]
2009-03-09 22:46   ` Renzo Davoli

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=20090309221637.GB3525@cs.unibo.it \
    --to=renzo@cs.unibo.it \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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