This is the mail archive of the
mailing list for the glibc project.
[Bug libc/3458] New: posix_madvise(addr, len, POSIX_MADV_DONTNEED) discards data
- From: "nmiell at comcast dot net" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 4 Nov 2006 10:28:54 -0000
- Subject: [Bug libc/3458] New: posix_madvise(addr, len, POSIX_MADV_DONTNEED) discards data
- Reply-to: sourceware-bugzilla at sourceware dot org
POSIX describes the POSIX_MADV_DONTNEED parameter to posix_madvise as follows:
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:
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
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
AssignedTo: drepper at redhat dot com
ReportedBy: nmiell at comcast dot net
CC: glibc-bugs at sources dot redhat dot com
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.