public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/13344] New: Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications.
@ 2011-10-25 18:20 cryptooctoploid at gmail dot com
  2011-10-25 20:32 ` [Bug nptl/13344] " jakub at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: cryptooctoploid at gmail dot com @ 2011-10-25 18:20 UTC (permalink / raw)
  To: glibc-bugs

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

             Bug #: 13344
           Summary: Marking all functions which don't have callbacks with
                    the leaf attribute breaks pthread applications.
           Product: glibc
           Version: 2.14
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: cryptooctoploid@gmail.com
    Classification: Unclassified


Commit aa78043a4aafe5 marks all functions, which don't have callbacks, with
the leaf attribute. This may break pthreaded apps (for example "git grep"),
because pthread_mutex_{lock,unlock,trylock,timedlock} and 
pthread_cond_{wait,timedwait} , etc. are also marked and therefore gcc
happily optimizes them. 

See: https://bugzilla.redhat.com/show_bug.cgi?id=747377
or: http://thread.gmane.org/gmane.comp.version-control.git/184184

There are two possibilties to solve this issue; either don't mark the pthread
related functions in glibc or teach gcc to unmark those functions.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug nptl/13344] Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications.
  2011-10-25 18:20 [Bug nptl/13344] New: Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications cryptooctoploid at gmail dot com
@ 2011-10-25 20:32 ` jakub at redhat dot com
  2011-10-25 20:39 ` jakub at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at redhat dot com @ 2011-10-25 20:32 UTC (permalink / raw)
  To: glibc-bugs

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

Jakub Jelinek <jakub at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jakub at redhat dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug nptl/13344] Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications.
  2011-10-25 18:20 [Bug nptl/13344] New: Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications cryptooctoploid at gmail dot com
  2011-10-25 20:32 ` [Bug nptl/13344] " jakub at redhat dot com
@ 2011-10-25 20:39 ` jakub at redhat dot com
  2011-10-25 20:52 ` jakub at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at redhat dot com @ 2011-10-25 20:39 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at redhat dot com> 2011-10-25 20:38:30 UTC ---
I think the leaf attribute in gcc is currently primarily used by ipa-reference
to find out what variables are supposed not to be read resp. written during the
call to that function (with leaf attribute all static vars in the current
translation unit are in that set if the leaf function is defined in some other
compilation unit) and for checking whether labels can be reached by non-local
goto.  While the synchronization primitives don't call any callbacks, from this
POV it is undesirable to treat them that way, they need to be considered as
full barriers.  I think the GCC documentation of leaf attribute should be
improved and the pthread.h/sem.h functions that are supposed to work as memory
synchronization points should use __THROWNL or similar macro which would be the
old __THROW, without leaf attribute in it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug nptl/13344] Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications.
  2011-10-25 18:20 [Bug nptl/13344] New: Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications cryptooctoploid at gmail dot com
  2011-10-25 20:32 ` [Bug nptl/13344] " jakub at redhat dot com
  2011-10-25 20:39 ` jakub at redhat dot com
@ 2011-10-25 20:52 ` jakub at redhat dot com
  2011-10-26  6:55 ` jim at meyering dot net
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at redhat dot com @ 2011-10-25 20:52 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at redhat dot com> 2011-10-25 20:51:21 UTC ---
There are other functions that shouldn't be marked leaf BTW, although they are
__THROW - e.g. sprintf/snprintf/vsprintf/vsnprintf and their checking
equivalents - it is possible to register a printf hook and the hook certainly
can be defined in the current function.  And the wide counterparts too.  I'd
say sscanf/vsscanf should be treated similarly just in case there will be scanf
hooks implemented in the future.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug nptl/13344] Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications.
  2011-10-25 18:20 [Bug nptl/13344] New: Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications cryptooctoploid at gmail dot com
                   ` (2 preceding siblings ...)
  2011-10-25 20:52 ` jakub at redhat dot com
@ 2011-10-26  6:55 ` jim at meyering dot net
  2011-10-27 16:41 ` cryptooctoploid at gmail dot com
  2014-06-27 11:44 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jim at meyering dot net @ 2011-10-26  6:55 UTC (permalink / raw)
  To: glibc-bugs

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

jim@meyering.net <jim at meyering dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jim at meyering dot net

--- Comment #3 from jim at meyering dot net <jim at meyering dot net> 2011-10-26 06:55:18 UTC ---
at least per POSIX,
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_11,
here's the full list:

The following functions synchronize memory with respect to other threads:

    fork
    pthread_barrier_wait
    pthread_cond_broadcast
    pthread_cond_signal
    pthread_cond_timedwait
    pthread_cond_wait
    pthread_create
    pthread_join
    pthread_mutex_lock
    pthread_mutex_timedlock
    pthread_mutex_trylock
    pthread_mutex_unlock
    pthread_spin_lock
    pthread_spin_trylock
    pthread_spin_unlock
    pthread_rwlock_rdlock
    pthread_rwlock_timedrdlock
    pthread_rwlock_timedwrlock
    pthread_rwlock_tryrdlock
    pthread_rwlock_trywrlock
    pthread_rwlock_unlock
    pthread_rwlock_wrlock
    sem_post
    sem_timedwait
    sem_trywait
    sem_wait
    semctl
    semop
    wait
    waitpid

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug nptl/13344] Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications.
  2011-10-25 18:20 [Bug nptl/13344] New: Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications cryptooctoploid at gmail dot com
                   ` (3 preceding siblings ...)
  2011-10-26  6:55 ` jim at meyering dot net
@ 2011-10-27 16:41 ` cryptooctoploid at gmail dot com
  2014-06-27 11:44 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: cryptooctoploid at gmail dot com @ 2011-10-27 16:41 UTC (permalink / raw)
  To: glibc-bugs

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

Octoploid <cryptooctoploid at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Octoploid <cryptooctoploid at gmail dot com> 2011-10-27 16:40:32 UTC ---
Fixed. Thanks.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug nptl/13344] Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications.
  2011-10-25 18:20 [Bug nptl/13344] New: Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications cryptooctoploid at gmail dot com
                   ` (4 preceding siblings ...)
  2011-10-27 16:41 ` cryptooctoploid at gmail dot com
@ 2014-06-27 11:44 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 11:44 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

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


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

end of thread, other threads:[~2014-06-27 11:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-25 18:20 [Bug nptl/13344] New: Marking all functions which don't have callbacks with the leaf attribute breaks pthread applications cryptooctoploid at gmail dot com
2011-10-25 20:32 ` [Bug nptl/13344] " jakub at redhat dot com
2011-10-25 20:39 ` jakub at redhat dot com
2011-10-25 20:52 ` jakub at redhat dot com
2011-10-26  6:55 ` jim at meyering dot net
2011-10-27 16:41 ` cryptooctoploid at gmail dot com
2014-06-27 11:44 ` fweimer at redhat dot 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).