[Bug sanitizer/82109] New: False positive when using pthread_cleanup_push() and pthread_cancel()

mephi42 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Sep 5 19:18:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82109

            Bug ID: 82109
           Summary: False positive when using pthread_cleanup_push() and
                    pthread_cancel()
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mephi42 at gmail dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 42131
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42131&action=edit
minimal reproducible example

The attached program generates what I believe is a false positive:

WRITE of size 4096 thread T1
    #1 in cleanup_routine (asan_pthread_cancel)
    #2 in start_routine (asan_pthread_cancel)
    #3 in start_thread (libpthread.so)
    #4 in __clone (libc.so)

The reason seems to be that ASAN does not zero out shadow memory bytes set by
sleep_routine() when pthread_cancel() is called, which then overlap text
variable in cleanup_routine().


More information about the Gcc-bugs mailing list