Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8129814

improper use of OSX semaphore_t from signal handlers

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 9
    • hotspot
    • None
    • generic
    • os_x

      In os_bsd.cpp there are two semaphores that are posted to from signal handlers. One is a raw OS-specific semaphore (sem_t or Apple semaphore_t), while the other is a wrapper around such.

      Some documentation for OSX semaphore_t indicates that it should not be used from signal handlers, e.g.

      https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/synchronization/synchronization.html

        Semaphores can be used any place where mutexes can occur. This
        precludes their use in interrupt handlers or within the context of
        the scheduler, and makes it strongly discouraged in the VM system.

      If that's correct, then we should not be using OSX semaphore_t for the purpose it is being used for in os_bsd.cpp. Note that this decision to use OSX semaphore_t goes all the way back to the original BSD port integration:

      http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/diff/f08d439fab8c/src/os/bsd/vm/os_bsd.cpp

            Unassigned Unassigned
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: