public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/6958] New: calloc() may return non-cleared memory for applications using mlockall()
@ 2008-10-13 18:56 torger at ludd dot ltu dot se
  0 siblings, 0 replies; only message in thread
From: torger at ludd dot ltu dot se @ 2008-10-13 18:56 UTC (permalink / raw)
  To: glibc-bugs

in arena.c there the trick to use madvise(MADV_DONTNEED) to free up / clear
mmap()'d anonymous memory. The return value of madvise() is not checked.

If the user application has called 'mlockall(MCL_CURRENT | MCL_FUTURE);' at
startup, which is common for soft-realtime applications (audio software for
example), madvise(MADV_DONTNEED) in arena.c will return -1 EINVAL since it is
not allowed to release locked pages.

The result is that an application which has locked the memory will in some
(fairly rare) situations get non-cleared memory from calloc(), leading to all
sorts of heisenbugs.

The only other reference I have found to this problem, is this old bug report
(no action):

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=473812

-- 
           Summary: calloc() may return non-cleared memory for applications
                    using mlockall()
           Product: glibc
           Version: 2.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: torger at ludd dot ltu dot se
                CC: glibc-bugs at sources dot redhat dot com


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

------- 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] only message in thread

only message in thread, other threads:[~2008-10-13 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-13 18:56 [Bug libc/6958] New: calloc() may return non-cleared memory for applications using mlockall() torger at ludd dot ltu dot se

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).