Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Scott Pakin <pakin@uiuc.edu>
Cc: gdb-patches@sources.redhat.com
Subject: Re: PATCH: Make libmmalloc work properly with /dev/zero
Date: Sat, 23 Mar 2002 11:54:00 -0000	[thread overview]
Message-ID: <3C9CDD7A.1080302@cygnus.com> (raw)
In-Reply-To: <3C854268.2080508@uiuc.edu>

> I just tried using libmmalloc for the first time, and I was unable to
> get it to work when allocating memory from /dev/zero (e.g., by using
> "mmalloc_attach (-1, NULL)" to mmap() it).  libmmalloc bus errors when
> it tries to write to the allocated region.  The library works fine
> when I use an ordinary file, however.
> 
> I'm using the libmmalloc.a that comes with gdb-5.1, and I'm running
> under Linux 2.4.2.  /dev/zero has 0666 permissions.
> 
> I believe the bug is that libmmalloc always mmap()s files with
> MAP_SHARED, but it ought to map /dev/zero with MAP_PRIVATE, because
> /dev/zero really isn't writable.  Attached below is a patch to
> mmap-sup.c that makes mmalloc conditionally use one of MAP_SHARED or
> MAP_PRIVATE, based on whether or not the library explicitly opened
> /dev/zero.
> 
> Of course, if there's some subtle reason the code was written the way
> it was -- or if I'm doing something egregiously wrong -- please let me
> know.

Fred's ok with this patch.  However, I can't get it to apply - something 
ate something while it was in transit?  Perhaphs post it as a mime 
attachment?

I'll also need a ChangeLog entry.

nice catch,
Andrew




  reply	other threads:[~2002-03-23 19:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-05 14:11 Scott Pakin
2002-03-23 11:54 ` Andrew Cagney [this message]
2002-03-25  9:57   ` Scott Pakin
2002-04-07 10:58     ` Andrew Cagney

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=3C9CDD7A.1080302@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=pakin@uiuc.edu \
    /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