public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/3458] New: posix_madvise(addr, len, POSIX_MADV_DONTNEED) discards data
@ 2006-11-04 10:29 nmiell at comcast dot net
  2006-11-05  5:45 ` [Bug libc/3458] " nmiell at comcast dot net
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: nmiell at comcast dot net @ 2006-11-04 10:29 UTC (permalink / raw)
  To: glibc-bugs

POSIX describes the POSIX_MADV_DONTNEED parameter to posix_madvise as follows:

POSIX_MADV_DONTNEED
   Specifies that the application expects that it will not access the specified
range in the near future.

Linux describes and implements the MADV_DONTNEED parameter to madvise as follows:

MADV_DONTNEED
   Do not expect access in the near future.  (For the time being, the
application is finished with the given range, so the kernel can free resources
associated with it.) Subsequent accesses of pages in this range will succeed,
but will result either in re-loading of the memory contents from the underlying
mapped file (see mmap()) or zero-fill-on-demand pages for mappings without an
underlying file.

glibc transparently forwards calls to posix_madvise to madvise, which means that
POSIX conformant applications which use posix_madvise(addr, len,
POSIX_MADV_DONTNEED) will corrupt data.

Suggested fix: Implement posix_madvise as a small wrapper around madvise which
silently discards all calls using POSIX_MADV_DONTNEED, fails for values other
than POSIX_MADV_*, and forwards the remainder.

-- 
           Summary: posix_madvise(addr, len, POSIX_MADV_DONTNEED) discards
                    data
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: nmiell at comcast dot net
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3458

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-07-12 14:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-04 10:29 [Bug libc/3458] New: posix_madvise(addr, len, POSIX_MADV_DONTNEED) discards data nmiell at comcast dot net
2006-11-05  5:45 ` [Bug libc/3458] " nmiell at comcast dot net
2007-02-17  9:07 ` drepper at redhat dot com
2007-02-17 20:35 ` nmiell at comcast dot net
2007-02-18 13:56 ` aj at suse dot de
2007-02-21 19:04 ` drepper at redhat dot com
2007-03-01 18:13 ` samuel dot thibault at ens-lyon dot org
2007-03-01 18:15 ` samuel dot thibault at ens-lyon dot org
2007-07-12 14:57 ` cvs-commit at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).