[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in default pager or GNUMach (?)

From: Marco Gerards
Subject: Bug in default pager or GNUMach (?)
Date: 04 Aug 2003 20:13:29 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2


There is a bug in the default pager or in GNUMach that makes tmpfs

I have reproduced this problem with a small (and VERY ugly) test
program. This program creates a memory object using the default pager
interfaces and mmaps it. That works perfectly, but after unmapping and
mapping it again it crashes. The weird thing is that not only the test
program crashes but also the filesystem server I started it from!!

define IWANTTOCRASH to trigger this nice bug. :)

If it wasn't a thinking error of myself I will put this bug and test
program on savannah.

There is also another bug, default_pager_object_set_size in
mach-defpager does never return when called and makes tmpfs hang. I
will have a closer look at this later this week.


#define _GNU_SOURCE 1
/* Uncomment to trigger the bug.  */
/*#define IWANTTOCRASH 1 */

#include <hurd.h>
#include <stdio.h>
#include <fcntl.h>
#include <hurd/paths.h>
#include "default_pager_U.h"

test_memory_object (mach_port_t memobj)
  error_t err;
  vm_address_t buf = 0;
  vm_size_t buflen = 4096;
  vm_prot_t prot = VM_PROT_READ | VM_PROT_WRITE;
  char *foo;

  err = vm_map (mach_task_self (), &buf, buflen, 0, 1, memobj, 0, 0, 
                prot, prot, 0);

  if (err)
    return err;

  /* Test write and read.  */
  foo = (void *) buf;
  foo[1] = 'a';
  printf ("buf: %c\n", foo[1]);
  munmap (buf, buflen);

  return 0;

int main (void)
  mach_port_t memobj = 0;
  mach_port_t default_pager = 0;
  mach_port_t host_priv = 0 ;
  error_t err = 0;
  char buffer[4096];

  err = get_privileged_ports (&host_priv, NULL);
  if (err)
    error (1, err, "Error while allocating privileged port.\n");

  err = vm_set_default_memory_manager (host_priv, &default_pager);
  if (err)
    error (1, err, "Set default memory manager\n");

  err = default_pager_object_create (default_pager,
  if (err)
    error (1, err, "Error while creating memory object\n");
  printf ("err: %d, portr: %d\n", err, memobj);

  err = test_memory_object (memobj);
  if (err)
    error (1, err, "Error whle testing memory object (1)\n");

  err = test_memory_object (memobj);
  if (err)
    error (1, err, "Error whle testing memory object (1)\n");

  return 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]