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

Enable compiler and linker safety switches for debug builds

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P2
    • 9
    • 9
    • infrastructure
    • b20
    • generic
    • generic

    Description

      A number of compiler and linker switches are available which enable compile and/or runtime checks of certain memory native operations. Some other switches render static data read-only so that errors which would cause overwrite can be detected. These switches can be enabled for debug builds

      The rationale behind the implementation is as follows. For the initial phase of JDK 9 I would like to:

      For release (aka product) enable compile time checks for builds. This was done in JDK-8030350

      For fast debug builds we can enable linker protections (relro, now) and static compile time bounds checks (FORTIFY_SOURCE=1). Some or all of these might be moved to the release builds as well because they have zero or very minimal runtime or executable size cost.

      For slow debug builds we can enable full runtime bounds checks and full stack protection (FORTIFY_SOURCE=2 -fprotect-stack).

      Enabling the additional protections in debug builds will help us find bugs in our native code and we don't care *as much* about footprint and performance. (fastdebug is already 40% larger and 20% slower than release). Since many engineers already do their personal builds in fastdebug or slowdebug mode for testing this will provide good opportunity to shake out any problems with the options while not impacting release builds.

      Attachments

        Issue Links

          Activity

            People

              mduigou Mike Duigou
              mduigou Mike Duigou
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: