public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jlanders at vmware dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/11200] New: loadlocale.c:_nl_load_locale() incorrectly handles mmap() failures Date: Thu, 21 Jan 2010 03:44:00 -0000 [thread overview] Message-ID: <20100121034423.11200.jlanders@vmware.com> (raw) The function _nl_load_locale() uses the local variable "filedata" to hold data mmap()'d from the file specified in the argument list. When mmap() fails in _nl_load_locale() at loadlocale.c:223, the local variable filedata gets set to MAP_FAILED or ((void *) -1). When this failure is due to a genuine resource issue, errno gets set to a value other than ENOSYS and the block of code malloc()'ing space for filedata never gets executed. Below in this same function at loadlocale.c:261, filedata is only checked against NULL. As a result, _nl_intern_locale_data() gets passed filedata with a value of -1. This causes applications to generate a SIGFPE exception at the start of _nl_intern_locale_data(). The easiest fix is set filedata to NULL when mmap() fails in _nl_load_locale(). --- a/locale/loadlocale.c 2009-12-08 12:10:20.000000000 -0800 +++ b/locale/loadlocale.c 2010-01-20 12:37:06.000000000 -0800 @@ -224,6 +224,7 @@ PROT_READ, MAP_FILE|MAP_COPY, fd, 0); if (__builtin_expect (filedata == MAP_FAILED, 0)) { + filedata = NULL; if (__builtin_expect (errno, ENOSYS) == ENOSYS) { #endif /* _POSIX_MAPPED_FILES */ This issue exists in other releases prior to glibc-2.11, including glibc-2.5 on RHEL 5.3. Thanks, Joe -- Summary: loadlocale.c:_nl_load_locale() incorrectly handles mmap() failures Product: glibc Version: 2.11 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: jlanders at vmware dot com CC: glibc-bugs at sources dot redhat dot com GCC build triplet: x86_64-linuxnptl GCC host triplet: x86_64-linuxnptl GCC target triplet: x86_64-linuxnptl http://sourceware.org/bugzilla/show_bug.cgi?id=11200 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
next reply other threads:[~2010-01-21 3:44 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-01-21 3:44 jlanders at vmware dot com [this message] 2010-01-21 3:45 ` [Bug libc/11200] " jlanders at vmware dot com 2010-01-22 20:46 ` drepper at redhat dot com 2010-01-22 21:12 ` ianw at vmware dot com
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=20100121034423.11200.jlanders@vmware.com \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).