#223 mmap issue on OpenBSD-current

closed-works-for-me
Bruno Haible
5
2006-08-03
2004-08-16
Marc Espie
No

We are trying to switch to a mmap-based malloc implementation.
This interferes with clisp like this:
./lisp.run -B . -N locale -Efile UTF-8 -Eterminal UTF-8 -norc -m
1000KW -M interpreted.mem -q -c compiler.lisp
Cannot map memory to address 0xe833f000 .
errno = EINVAL: Invalid argument.

Looking through clisp source, I find several places where this
string occurs. I could use a small roadmap to track this issue
down: what does clisp do with mmap'ing stuff to fixed addresses,
and how can I influence it to mmap stuff to legitimate addresses
under the new scheme ?

Discussion

  • Sam Steingold
    Sam Steingold
    2004-08-16

    • assigned_to: nobody --> haible
     
  • Bruno Haible
    Bruno Haible
    2004-08-18

    Logged In: YES
    user_id=5923

    Hello Marc,

    Three questions:

    Does it also happen with the newest release, clisp-2.33.2 ?
    (You didn't say which clisp version you use.)

    What is the typical memory map of a process, such as /bin/cat ?
    I.e. at which addresses must clisp expect shared libraries and
    mallocs to be located?

    What are the restrictions for using mmap? It appears that
    mmap(0xe833f000, ... MAP_FIXED ...) fails with EINVAL. Any
    idea why? (On Linux/x86 it would be because the virtual
    address space ends at 0xc0000000, but how is it on
    OpenBSD?)

     
  • Sam Steingold
    Sam Steingold
    2005-01-30

    • labels: --> memory management
     
  • Sam Steingold
    Sam Steingold
    2005-10-30

    • status: open --> pending-works-for-me
     
  • Sam Steingold
    Sam Steingold
    2005-10-30

    Logged In: YES
    user_id=5735

    freebsd works for me on i386.

     
  • Sam Steingold
    Sam Steingold
    2005-10-30

    Logged In: YES
    user_id=5735

    This bug report is now marked as "pending"/"works for me".
    This means that we think that we cannot reproduce the problem
    and cannot do anything about it.
    Unless you - the reporter - act within 2 weeks,
    the bug will be permanently closed.
    Sorry about the inconvenience -
    we hope your silence means that
    you are no longer observing the problem either.

     
  • Marc Espie
    Marc Espie
    2005-10-30

    Logged In: YES
    user_id=1053809

    FreeBSD is not OpenBSD, sorry sds. The fact that it works with
    FreeBSD has absolutely no relevance to OpenBSD.

    I have some further understanding of the problem: mmapping to
    fixed addresses will not work at all. The only case where you can
    use mmap to a fixed address is when you map memory again on a
    given process...

    Otherwise, the OpenBSD system now uses randomization to load
    shared libraries and the program text, and malloc, to ensure two
    runs of the same program don't lead to the same address, and thus
    mitigating a lot of exploits.

    This feature is not an option that you can turn off.

     
  • Marc Espie
    Marc Espie
    2005-10-30

    • status: pending-works-for-me --> open-works-for-me
     
  • Sam Steingold
    Sam Steingold
    2005-10-30

    Logged In: YES
    user_id=5735

    if mmap does not work, you can disable it.
    see end of clisp/unix/PLATFORMS
    and add NO_.... to CFLAGS

     
  • Sam Steingold
    Sam Steingold
    2005-10-30

    OpenBSD i386 autoconf headers

     
    Attachments
  • Sam Steingold
    Sam Steingold
    2005-10-30

    Logged In: YES
    user_id=5735

    actually, this works for me just fine on the OpenBSD SF CF.
    the 2.35 binary is available in the "Files" section.
    CVS head unixconf attached

     
  • Sam Steingold
    Sam Steingold
    2005-10-30

    Logged In: YES
    user_id=5735

    OpenBSD x86-openbsd1.cf.sourceforge.net 3.4 GENERIC#18 i386

     
  • Sam Steingold
    Sam Steingold
    2006-07-19

    • status: open-works-for-me --> pending-works-for-me
     
  • Sam Steingold
    Sam Steingold
    2006-07-19

    Logged In: YES
    user_id=5735

    OpenBSD x86-openbsd1.cf.sourceforge.net 3.8 GENERIC#138 i386
    ./configure --with-gmalloc
    works fine, package is available on SF.

     
  • Logged In: YES
    user_id=1312539

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
    • status: pending-works-for-me --> closed-works-for-me