public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ports/16418] New: ppc's get_clockfreq is racy and cancel-unsafe
@ 2014-01-09  5:52 aoliva at sourceware dot org
  2014-02-07  3:06 ` [Bug libc/16418] [powerpc] " jsm28 at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: aoliva at sourceware dot org @ 2014-01-09  5:52 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16418

            Bug ID: 16418
           Summary: ppc's get_clockfreq is racy and cancel-unsafe
           Product: glibc
           Version: 2.18
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ports
          Assignee: unassigned at sourceware dot org
          Reporter: aoliva at sourceware dot org
                CC: carlos at redhat dot com, roland at gnu dot org

The initialization of timebase_freq enables other threads to use incorrect
values, even permanently.  One problem is that timebase_freq is wider than a
word, so writes to it may be non-atomic, and concurrent threads may see a
nonzero partially-stored value and use it.  Another is that an error value
returned by the vsyscall will be stored in it, and that value may be used by
other threads as well until the thread completes the initialization from /proc,
at which point a concurrent thread may get a value that is half the error code
and half the final value.  There should be a single atomic write to
timebase_freq, or a separate atomic flag that indicates whether the value in it
is final.

Another problem is that the open, read and close syscalls are cancellation
points.  Most /proc-reading code uses the nocancel variants of these syscall
wrappers.  This is more important than just the file descriptor leaking
problem, that is frequent for async cancellation but that should never happen
for sync cancellation: if any of these calls gets a sync cancellation,
timebase_freq will keep the error value returned by the vsyscall forever.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2015-01-21 15:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-09  5:52 [Bug ports/16418] New: ppc's get_clockfreq is racy and cancel-unsafe aoliva at sourceware dot org
2014-02-07  3:06 ` [Bug libc/16418] [powerpc] " jsm28 at gcc dot gnu.org
2014-06-13  9:09 ` fweimer at redhat dot com
2014-11-24 20:43 ` azanella at linux dot vnet.ibm.com
2015-01-21 15:54 ` cvs-commit at gcc dot gnu.org
2015-01-21 15:56 ` azanella at linux dot vnet.ibm.com

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