Mercurial > hg > icedtea6-hg
changeset 2977:6415ddeeeb09
Merge
author | Andrew John Hughes <ahughes@redhat.com> |
---|---|
date | Tue, 19 Mar 2013 00:21:31 +0000 |
parents | 55720644035f (current diff) 18b6e9eaf3e8 (diff) |
children | c01c31ed2f60 |
files | ChangeLog Makefile.am patches/arm-hsdis.patch patches/ecj/hotspot-jdk-dependency.patch patches/no-static-linking.patch patches/pr639-broken_shark_build.patch patches/sdt-arguments.patch patches/sdt-dtrace-hpp.patch patches/sdt-jni.patch patches/sdt-make.patch patches/systemtap-alloc-size-workaround.patch patches/systemtap_gc.patch |
diffstat | 50 files changed, 4971 insertions(+), 941 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Wed Feb 13 23:54:10 2013 +0000 +++ b/.hgignore Tue Mar 19 00:21:31 2013 +0000 @@ -4,10 +4,6 @@ missing aclocal.m4 autom4te.cache -cacao -netbeans -visualvm -bootstrap build debian lib @@ -52,3 +48,6 @@ syntax: regexp ^openjdk +^cacao +^bootstrap +^jamvm
--- a/ChangeLog Wed Feb 13 23:54:10 2013 +0000 +++ b/ChangeLog Tue Mar 19 00:21:31 2013 +0000 @@ -1,3 +1,175 @@ +2013-03-18 Andrew John Hughes <gnu.andrew@redhat.com> + + * Makefile.am: + (ICEDTEA_PATCHES): Add new patches to appropriate + HotSpot builds. + * patches/hotspot/hs23/revert-7017193.patch: + Backport from 2.x series. Revert the upstream + fix for 7017193 and add a much simpler fix using + free which doesn't suffer from performance issues. + https://bugzilla.redhat.com/show_bug.cgi?id=902004 + For HotSpot 23 only. + * patches/hotspot/original/7197906-handle_32_bit_shifts.patch: + Backport from OpenJDK 7 for bundled HotSpot only. + * patches/hotspot/original/fix_get_stack_bounds_leak.patch: + Same fix for 7017193 as in patch above, but for bundled HotSpot, + which doesn't have the upstream fix. + * NEWS: Updated. + +2013-03-18 Andrew John Hughes <gnu.andrew@redhat.com> + + * hotspot.map: Sync with IcedTea7 2.3 tree + again following u17b02 sync. + +2013-03-07 Andrew John Hughes <gnu.andrew@redhat.com> + + * hotspot.map: Sync with IcedTea7 2.3 tree; + only changes are new release tags. + +2013-03-07 Andrew John Hughes <gnu.andrew@redhat.com> + + * patches/security/20130304/declaration_correction.patch: + Remove local patch... + * Makefile.am: Swap patches. + * NEWS: Updated. + * patches/openjdk/8009641-8007675_build_fix.patch: + ...replaced by this from upstream. + +2013-03-07 Andrew John Hughes <gnu.andrew@redhat.com> + + * NEWS: + Add 1.11.9 & 1.12.4 release notes. + +2013-03-07 Andrew John Hughes <gnu.andrew@redhat.com> + + * Makefile.am: + (SECURITY_PATCHES): List new patches. + * patches/security/20130304/8007014.patch, + * patches/security/20130304/8007675.patch: + Patches from upstream. + * patches/security/20130304/declaration_correction.patch: + Correct bad code added to LCMSTransform.java + which fails with ecj. + +2013-02-17 Andrew John Hughes <gnu.andrew@redhat.com> + + * Makefile.am: + (ICEDTEA_PATCHES): Add new patches. + * patches/openjdk/8007393.patch, + * patches/openjdk/8007611.patch: + Regression fixes for LogManager. + +2013-02-15 Andrew John Hughes <gnu.andrew@redhat.com> + + * Makefile.am: + (SECURITY_PATCHES): Add latest security patches. + * patches/security/20130219/8006446.patch, + * patches/security/20130219/8006777.patch, + * patches/security/20130219/8007688.patch: + New patches for next security update. + +2013-02-20 Andrew John Hughes <gnu.andrew@redhat.com> + + * NEWS: + Add 1.11.8 & 1.12.3 release notes. + +2013-02-17 Andrew John Hughes <gnu.andrew@redhat.com> + + * .hgignore: Fix so the cacao patches directory + isn't hidden. + * patches/cacao/hotspot/hs23/memory.patch, + * patches/cacao/hotspot/original/memory.patch: + Add patches missed from last commit. + +2013-02-15 Andrew John Hughes <gnu.andrew@redhat.com> + + * Makefile.am: + (ICEDTEA_PATCHES): Specialise HotSpot segment of + CACAO memory patch and some SystemTap patches. + Split remaining SystemTap patches between hs23 + and original builds. + * patches/cacao/memory.patch: + Remove HotSpot fragments. + * patches/hotspot/hs23/systemtap-alloc-size-workaround.patch: + hs23 version of existing patch. + * patches/hotspot/hs23/systemtap.patch: + Taken from IcedTea7 2.3. + * patches/hotspot/hs23/systemtap_gc.patch: + hs23 version of existing patch. + * patches/hotspot/original/sdt-arguments.patch + * patches/hotspot/original/sdt-dtrace-hpp.patch + * patches/hotspot/original/sdt-jni.patch + * patches/hotspot/original/sdt-make.patch: + * patches/hotspot/original/systemtap-alloc-size-workaround.patch + * patches/hotspot/original/systemtap_gc.patch: + Moved from.... + * patches/sdt-arguments.patch + * patches/sdt-dtrace-hpp.patch + * patches/sdt-jni.patch + * patches/sdt-make.patch + * patches/systemtap-alloc-size-workaround.patch + * patches/systemtap_gc.patch: + ...here. + +2013-02-14 Andrew John Hughes <gnu.andrew@redhat.com> + + PR1319: Support GIF lib v5. + * Makefile.am: + (ICEDTEA_PATCHES): Add new patch. + * patches/pr1319-support_giflib_5.patch: + Support building with giflib 5.x. + +2013-02-14 Andrew John Hughes <gnu.andrew@redhat.com> + + PR1317: Provide an option to build with a more up-to-date HotSpot + * patches/no-static-linking.patch: + Dropped; unneeded if STATIC_CXX is set to false. + * INSTALL: Update HotSpot build documentation. + * Makefile.am: + (SECURITY_PATCHES): Exclude patches in hs23 HotSpot + if building with it. + (ICEDTEA_PATCHES): Likewise, and exclude the ARM32 + port which doesn't work with hs23. Also specialise + some patches which differ depending on HotSpot version. + (ICEDTEA_ECJ_PATCHES): Specialise hotspot-jdk-dependency.patch + depending on version of HotSpot being built. + (ICEDTEA_ENV): Pass STATIC_CXX=false to avoid patching. + Pass BUILD_GCC and BUILD_CXX in place of suffix patch if + building hs23. + * NEWS: + List this new feature and also the bug fix, PR1318. + * acinclude.m4: + (IT_ENABLE_ZERO_BUILD): Define only once. Depend on + CACAO, Zero and Shark. + (IT_SET_SHARK_BUILD): Define only once. + (IT_ENABLE_JAMVM): Likewise. + (IT_ENABLE_CACAO): Likewise. + (IT_WITH_HOTSPOT_BUILD): Likewise. Set ALTERNATE_BUILD + to hs23. Depend on Zero build determination and use to + pick default. Error out if hs23 is enabled with Zero. + * hotspot.map: Add reference to hs23 from the 2.3 tree. + * patches/ecj/hotspot/hs23/hotspot-jdk-dependency.patch: + Added for hs23 build. + * patches/ecj/hotspot/original/hotspot-jdk-dependency.patch: + Moved from patches/ecj/hotspot-jdk-dependency.patch. + * patches/gcc-suffix-hotspot.patch: + Split out for original HotSpot builds. + * patches/gcc-suffix.patch: Original version minus HotSpot + chunk. + * patches/hotspot/hs23/arm-hsdis.patch, + * patches/hotspot/hs23/pr639-broken_shark_build.patch: + hs23 versions of these patches which don't appear upstream. + * patches/hotspot/original/arm-hsdis.patch, + * patches/hotspot/original/pr639-broken_shark_build.patch: + Moved from patches. + * patches/hotspot/hs23/remove_jsr292_tests.patch: + Remove JSR292 tests from hs23 HotSpot when building on 6. + +2013-02-14 Andrew John Hughes <gnu.andrew@redhat.com> + + * NEWS: Add 1.11.6, 1.11.7, 1.12.1 & 1.12.2 + releases. + 2013-02-08 Andrew John Hughes <gnu.andrew@redhat.com> PR1301: PR1171 causes Zero builds to fail
--- a/INSTALL Wed Feb 13 23:54:10 2013 +0000 +++ b/INSTALL Tue Mar 19 00:21:31 2013 +0000 @@ -319,12 +319,18 @@ of the requested build. At present, IcedTea6 supports the 'original' HotSpot 20 provided as -part of the upstream tarball. Note that the norm. is for up to one -alternate (non-default) build to be supported and just passing ---with-hotspot-build (equivalent to --with-hotspot-build=yes) will -always provide the alternate build. Conversely, passing ---without-hotspot-build (equivalent to --with-hotspot-build=no) -provides the original build from the OpenJDK tarball. +part of the upstream tarball and 'hs23', the HotSpot used by the IcedTea +2.3.x series. Note that the norm. is for up to one alternate (non-default) +build to be supported and just passing --with-hotspot-build +(equivalent to --with-hotspot-build=yes) will always provide the alternate +build. Conversely, passing --without-hotspot-build (equivalent to +--with-hotspot-build=no) provides the original build from the OpenJDK tarball. + +When no option is specified, the default build is used. At present, +this is 'hs23' unless the user is building Zero or Shark (either by +choice, or because the build has default to this on architectures +other than x86/x86_64/sparc). As 'hs23' is known not to work with +Zero or Shark, 'original' is still the default for these builds. Javascript Support ==================
--- a/Makefile.am Wed Feb 13 23:54:10 2013 +0000 +++ b/Makefile.am Tue Mar 19 00:21:31 2013 +0000 @@ -271,16 +271,25 @@ patches/security/20130201/8000540.patch \ patches/security/20130201/8000631.patch \ patches/security/20130201/8001242.patch \ - patches/security/20130201/8001307.patch \ patches/security/20130201/8001972.patch \ patches/security/20130201/8002325.patch \ - patches/security/20130201/8001235.patch + patches/security/20130201/8001235.patch \ + patches/security/20130219/8006446.patch \ + patches/security/20130219/8006777.patch \ + patches/security/20130219/8007688.patch \ + patches/security/20130304/8007014.patch \ + patches/security/20130304/8007675.patch \ + patches/openjdk/8009641-8007675_build_fix.patch + +if !WITH_ALT_HSBUILD +SECURITY_PATCHES += \ + patches/security/20130201/8001307.patch +endif SPECIAL_SECURITY_PATCH = patches/security/20120214/7112642.patch ICEDTEA_PATCHES = \ $(SECURITY_PATCHES) \ - patches/stdc-limit-macros.patch \ patches/openjdk/4993545-nativeinlightfixer.patch \ patches/openjdk/6637796-set_bounds.patch \ patches/openjdk/6607660-treelock.patch \ @@ -303,27 +312,20 @@ patches/parisc-opt.patch \ patches/lucene-crash.patch \ patches/version.patch \ - patches/version-hotspot.patch \ - patches/text-relocations.patch \ patches/openjdk/7043921-java_rmi_cgi.patch \ patches/use-system-tzdata.patch \ patches/headers.patch \ patches/gcc-suffix.patch \ - patches/memory-limits.patch \ patches/libraries.patch \ patches/jvmtiEnv.patch \ patches/lcms.patch \ - patches/print_lsb_release.patch \ patches/uname.patch \ patches/freetypeversion.patch \ patches/nomotif-6706121.patch \ patches/nomotif.patch \ patches/nomotif-mtoolkit.patch \ - patches/alpha-fixes.patch \ patches/alt-jar.patch \ patches/jdk-use-ssize_t.patch \ - patches/use-idx_t.patch \ - patches/params-cast-size_t.patch \ patches/clean-crypto.patch \ patches/arch.patch \ patches/lc_ctype.patch \ @@ -334,8 +336,6 @@ patches/pr261.patch \ patches/sparc-buildfixes.patch \ patches/sparc64-linux.patch \ - patches/sparc-ptracefix.patch \ - patches/sparc-trapsfix.patch \ patches/jtreg-6592792.patch \ patches/s390-noinline.patch \ patches/jtreg-dnd.patch \ @@ -344,15 +344,11 @@ patches/dnd-filelists.patch \ patches/disable-cc-incompatible-sanity-checks.patch \ patches/explicit-target-arch.patch \ - patches/openjdk/7019808-stack_noexec.patch \ patches/parisc.patch \ - patches/sh4-support.patch \ patches/policy-evaluation.patch \ - patches/update-bootclasspath.patch \ patches/openjdk/6959123-libpng_14.patch \ patches/applet_hole.patch \ patches/jtreg-httpTest.patch \ - patches/arm.patch \ patches/debug-dir.patch \ patches/override-redirect-metacity.patch \ patches/openjdk/6967533-pre_epoch.patch \ @@ -363,18 +359,15 @@ patches/openjdk/6510892-httpserver_test.patch \ patches/openjdk/6638712-wildcard_types.patch \ patches/openjdk/6650759-missing_inference.patch \ - patches/numa_on_early_glibc.patch \ patches/jtreg-international-fonts.patch \ patches/f14-fonts.patch \ patches/jtreg-T6638712-fix.patch \ patches/jtreg-T6650759m-fix.patch \ patches/openjdk/7003777-bad-html-entity-parse.patch \ - patches/jtreg-6929067-fix.patch \ patches/rendering-engine-tests.patch \ patches/openjdk/6800846-printing-quality.patch \ patches/rh661505-jpeg.patch \ patches/6703377-freetypescaler.patch \ - patches/ia64-fix.patch \ patches/openjdk/6642612-filechooser_button_sizes.patch \ patches/jtreg-international-fonts-styles.patch \ patches/openjdk/6736649-text_bearings.patch \ @@ -384,8 +377,6 @@ patches/openjdk/4724552-CubicCurve2D.patch \ patches/openjdk/4493128-CubicCurve2D.patch \ patches/openjdk/4645692-CubicCurve2D.solveCubic.patch \ - patches/no-static-linking.patch \ - patches/openjdk/7041156-gcc_export_dynamic.patch \ patches/g344659-sparc_fix.patch \ patches/openjdk/6728834-blurred-lcd-aa-text.patch \ patches/openjdk/6749060-bad-lcd-aa-non-opaque-dest.patch \ @@ -409,14 +400,9 @@ patches/openjdk/7027667-AAShapePipeRegTest.patch \ patches/openjdk/7019861-AA-regression-fix.patch \ patches/g356743-libpng-1.5.patch \ - patches/openjdk/7032388-work_without_cmov_instruction.patch \ - patches/openjdk/7031385-gcc-register-allocation-fix.patch \ patches/openjdk/6986968-crash_on_xim_restart.patch \ patches/openjdk/7036754-stroker-nan.patch \ patches/openjdk/pgram-pipe-regression.patch \ - patches/openjdk/7034464-transparent_huge_pages.patch \ - patches/openjdk/7037939-disable_adaptive_resizing_with_large_pages.patch \ - patches/openjdk/7043564-hugepage.patch \ patches/openjdk/mutter.patch \ patches/fonts-rhel-version.patch \ patches/openjdk/7036148-npe-null-jmenu-name.patch \ @@ -431,30 +417,21 @@ patches/openjdk/6818312-com.sun.awt.SecurityWarning.getSize.patch \ patches/jtreg-MappedByteBuffer-Basic.patch \ patches/openjdk/7008106-WindowOpacity.patch \ - patches/openjdk/6956668-misbehavior_of_XOR_operator_with_int.patch \ patches/openjdk/6699843-IllegalArgumentException_drawString.patch \ patches/openjdk/6918065-Crash_in_Java2D_blit_loop.patch \ patches/openjdk/6623219-Font_canDisplayUpTo_does_not_work.patch \ patches/openjdk/6783910-java_awt_Color_brighter_darker_fix.patch \ patches/openjdk/6785424-SecurityException_locating_physical_fonts.patch \ - patches/openjdk/7047069-Array_can_dynamically_change_size.patch \ - patches/openjdk/6796786-invalid_FP_identity_transform.patch \ - patches/openjdk/7042070-Typo_in_Test6796786.patch \ patches/openjdk/6679308-Poor_text_rendering_on_translucent_image.patch \ patches/openjdk/6842838-64-bit_failure_in_handling_invalid_manifest.patch \ patches/openjdk/6882768-test_for_6842838_is_broken.patch \ - patches/pr639-broken_shark_build.patch \ + patches/hotspot/$(HSBUILD)/pr639-broken_shark_build.patch \ patches/powerpc-stacksize.patch \ - patches/jtreg-remove-test-6987555.patch \ - patches/jtreg-remove-test-6991596.patch \ - patches/openjdk/7036220-shark_llvm_29_headers.patch \ - patches/openjdk/7029152-String_intrinsics_miss_optimization.patch \ patches/openjdk/6711682-JCheckBox_in_JTable_does_not_respond_to_click.patch \ patches/openjdk/6758179-D3D_AlphaComposite_is_applied_incorrectly.patch \ patches/jtreg-ConstructDeflaterInput-fix.patch \ patches/openjdk/6613904-GroupLayout_createParallelGroup_null_arg.patch \ patches/openjdk/7049339-anyblit-broken.patch \ - patches/jtreg-hotspot-Test7020373-fix.patch \ patches/openjdk/4917091-javac_rejects_array_over_128_in_length.patch \ patches/openjdk/6390045-error_cannot_access_java_lang_void.patch \ patches/openjdk/6752638-preferLocaleFonts_throws_NPE.patch \ @@ -462,15 +439,12 @@ patches/openjdk/6669869-Beans_isDesignTime_should_be_per-AppContext.patch \ patches/openjdk/6934356-Vector_writeObject_serialization_DL.patch \ patches/openjdk/7036582-Improve_test_coverage_of_BigDecimal.patch \ - patches/pr690-shark-jit-hs20.patch \ - patches/pr696-zero-fast_aldc-hs20.patch \ patches/openjdk/6806261-BigDecimal_longValueExact_throws_NPE.patch \ patches/openjdk/6371401-BigInteger.shift_throws_StackOverflowError.patch \ patches/openjdk/6826104-npe_on_app_and_toolkit_modal_dialog_click.patch \ patches/openjdk/5082756-ImageIO_plugins_metadata_boolean_attributes.patch \ patches/openjdk/6296893-BMP_Writer_handles_TopDown_prop_incorrectly.patch \ - patches/arm-debug.patch \ - patches/arm-hsdis.patch \ + patches/hotspot/$(HSBUILD)/arm-hsdis.patch \ patches/openjdk/7103610-_NET_WM_PID_and_WM_CLIENT_MACHINE_are_not_set.patch \ patches/openjdk/6706974-krb5_test_infrastructure.patch \ patches/openjdk/6764553-IdResolver_is_not_thread_safe.patch \ @@ -500,9 +474,61 @@ patches/openjdk/6980681-corba_deadlock.patch \ patches/openjdk/7162902-corba_fixes.patch \ patches/traceable.patch \ + patches/openjdk/8005615-failure_to_load_logger_implementation.patch \ + patches/openjdk/8004341-jck_dialog_failure.patch \ + patches/pr1319-support_giflib_5.patch \ + patches/openjdk/8007393.patch \ + patches/openjdk/8007611.patch + +if WITH_ALT_HSBUILD +ICEDTEA_PATCHES += \ + patches/hotspot/hs23/remove_jsr292_tests.patch \ + patches/hotspot/hs23/revert-7017193.patch +else +# stdc-limit-macros is part of 7032458 +# pr690-shark-jit-hs20.patch is part of 7032458 +# pr696-zero-fast_aldc-hs20.patch is 7030207 & part of 7032458 +ICEDTEA_PATCHES += \ + patches/stdc-limit-macros.patch \ + patches/version-hotspot.patch \ + patches/text-relocations.patch \ + patches/gcc-suffix-hotspot.patch \ + patches/memory-limits.patch \ + patches/print_lsb_release.patch \ + patches/alpha-fixes.patch \ + patches/use-idx_t.patch \ + patches/params-cast-size_t.patch \ + patches/sparc-ptracefix.patch \ + patches/sparc-trapsfix.patch \ + patches/openjdk/7019808-stack_noexec.patch \ + patches/sh4-support.patch \ + patches/update-bootclasspath.patch \ + patches/arm.patch \ + patches/numa_on_early_glibc.patch \ + patches/jtreg-6929067-fix.patch \ + patches/ia64-fix.patch \ + patches/openjdk/7041156-gcc_export_dynamic.patch \ + patches/openjdk/7032388-work_without_cmov_instruction.patch \ + patches/openjdk/7031385-gcc-register-allocation-fix.patch \ + patches/openjdk/7034464-transparent_huge_pages.patch \ + patches/openjdk/7037939-disable_adaptive_resizing_with_large_pages.patch \ + patches/openjdk/7043564-hugepage.patch \ + patches/openjdk/6956668-misbehavior_of_XOR_operator_with_int.patch \ + patches/openjdk/7047069-Array_can_dynamically_change_size.patch \ + patches/openjdk/6796786-invalid_FP_identity_transform.patch \ + patches/openjdk/7042070-Typo_in_Test6796786.patch \ + patches/jtreg-remove-test-6987555.patch \ + patches/jtreg-remove-test-6991596.patch \ + patches/openjdk/7036220-shark_llvm_29_headers.patch \ + patches/openjdk/7029152-String_intrinsics_miss_optimization.patch \ + patches/jtreg-hotspot-Test7020373-fix.patch \ + patches/pr690-shark-jit-hs20.patch \ + patches/pr696-zero-fast_aldc-hs20.patch \ + patches/arm-debug.patch \ patches/openjdk/7010849-modernise_sa.patch \ - patches/openjdk/8005615-failure_to_load_logger_implementation.patch \ - patches/openjdk/8004341-jck_dialog_failure.patch + patches/hotspot/original/7197906-handle_32_bit_shifts.patch \ + patches/hotspot/original/fix_get_stack_bounds_leak.patch +endif if WITH_RHINO ICEDTEA_PATCHES += \ @@ -513,11 +539,13 @@ ICEDTEA_PATCHES += \ patches/cacao/launcher.patch \ patches/cacao/memory.patch \ + patches/cacao/hotspot/$(HSBUILD)/memory.patch \ patches/cacao/armhf.patch else if USING_CACAO ICEDTEA_PATCHES += \ - patches/cacao/memory.patch + patches/cacao/memory.patch \ + patches/cacao/hotspot/$(HSBUILD)/memory.patch endif endif @@ -533,13 +561,18 @@ endif if ENABLE_SYSTEMTAP -ICEDTEA_PATCHES += patches/sdt-jni.patch \ - patches/sdt-dtrace-hpp.patch \ - patches/sdt-make.patch \ - patches/sdt-arguments.patch \ - patches/systemtap_gc.patch - patches/systemtap-gcc-4.5.patch \ - patches/systemtap-alloc-size-workaround.patch +if WITH_ALT_HSBUILD +ICEDTEA_PATCHES += patches/hotspot/hs23/systemtap.patch +else +ICEDTEA_PATCHES += patches/hotspot/original/sdt-jni.patch \ + patches/hotspot/original/sdt-dtrace-hpp.patch \ + patches/hotspot/original/sdt-make.patch \ + patches/hotspot/original/sdt-arguments.patch \ + patches/systemtap-gcc-4.5.patch +endif +ICEDTEA_PATCHES += \ + patches/hotspot/$(HSBUILD)/systemtap_gc.patch \ + patches/hotspot/$(HSBUILD)/systemtap-alloc-size-workaround.patch endif if ENABLE_NSS @@ -571,7 +604,7 @@ patches/ecj/corba-dependencies.patch \ patches/ecj/jaxws-langtools-dependency.patch \ patches/ecj/jaxws-jdk-dependency.patch \ - patches/ecj/hotspot-jdk-dependency.patch + patches/ecj/hotspot/$(HSBUILD)/hotspot-jdk-dependency.patch if DTDTYPE_QNAME ICEDTEA_ECJ_PATCHES += \ @@ -654,7 +687,14 @@ DEBUG_BINARIES="true" \ ALT_DROPS_DIR="$(abs_top_builddir)/drops" \ VERBOSE="$(VERBOSE)" \ - ALT_OUTPUTDIR="$(BUILD_OUTPUT_DIR)" + ALT_OUTPUTDIR="$(BUILD_OUTPUT_DIR)" \ + STATIC_CXX="false" + +if WITH_ALT_HSBUILD +ICEDTEA_ENV += \ + BUILD_GCC=gcc$(GCC_SUFFIX) \ + BUILD_CXX=g++$(GCC_SUFFIX) +endif if ENABLE_CACAO ICEDTEA_ENV += \
--- a/NEWS Wed Feb 13 23:54:10 2013 +0000 +++ b/NEWS Tue Mar 19 00:21:31 2013 +0000 @@ -12,6 +12,146 @@ New in release 1.13.0 (201X-XX-XX): +* New features + - PR1317: Provide an option to build with a more up-to-date HotSpot +* Backports + - S8009641: OpenJDK 6 build broken via 8007675 fix + - S7197906: BlockOffsetArray::power_to_cards_back() needs to handle > 32 bit shifts (bundled HotSpot only) +* Bug fixes + - PR1318: Fix automatic enabling of the Zero build on non-JIT architectures which don't use CACAO or JamVM. + - RH902004: very bad performance with E-Porto Add-In für OpenOffice Writer installed (hs23 only) + - Fix get_stack_bounds memory leak (alternate fix for S7197906, bundled HotSpot only) + +New in release 1.12.4 (2013-03-04): + +* Security fixes + - S8007014, CVE-2013-0809: Improve image handling + - S8007675, CVE-2013-1493: Improve color conversion + +New in release 1.11.9 (2013-03-04): + +* Security fixes + - S8007014, CVE-2013-0809: Improve image handling + - S8007675, CVE-2013-1493: Improve color conversion + +New in release 1.12.3 (2013-02-19): + +* Security fixes + - S8006446, CVE-2013-1486: Restrict MBeanServer access + - S8006777, CVE-2013-0169: Improve TLS handling of invalid messages + - S8007688: Blacklist known bad certificate +* Backports + - S8007393: Possible race condition after JDK-6664509 + - S8007611: logging behavior in applet changed +* Bug fixes + - PR1319: Support GIF lib v5. + +New in release 1.11.8 (2013-02-19): + +* Security fixes + - S8006446, CVE-2013-1486: Restrict MBeanServer access + - S8006777, CVE-2013-0169: Improve TLS handling of invalid messages + - S8007688: Blacklist known bad certificate +* Backports + - S7123519: problems with certification path + - S8007393: Possible race condition after JDK-6664509 + - S8007611: logging behavior in applet changed +* Bug fixes + - PR1319: Support GIF lib v5. + +New in release 1.12.2 (2013-02-11): + +* Backports + - S8004341: Two JCK tests fails with 7u11 b06 + - S8005615: Java Logger fails to load tomcat logger implementation (JULI) +* Bug fixes + - PR1297: cacao and jamvm parallel unpack failures + - PR1301: PR1171 causes builds of Zero to fail + +New in release 1.11.7 (2013-02-11): + +* Backports + - S8004341: Two JCK tests fails with 7u11 b06 + - S8005615: Java Logger fails to load tomcat logger implementation (JULI) +* Bug fixes + - PR1297: cacao and jamvm parallel unpack failures + +New in release 1.12.1 (2013-02-04): + +* Security fixes + - S6563318, CVE-2013-0424: RMI data sanitization + - S6664509, CVE-2013-0425: Add logging context + - S6664528, CVE-2013-0426: Find log level matching its name or value given at construction time + - S6776941: CVE-2013-0427: Improve thread pool shutdown + - S7141694, CVE-2013-0429: Improving CORBA internals + - S7173145: Improve in-memory representation of splashscreens + - S7186945: Unpack200 improvement + - S7186946: Refine unpacker resource usage + - S7186948: Improve Swing data validation + - S7186952, CVE-2013-0432: Improve clipboard access + - S7186954: Improve connection performance + - S7186957: Improve Pack200 data validation + - S7192392, CVE-2013-0443: Better validation of client keys + - S7192393, CVE-2013-0440: Better Checking of order of TLS Messages + - S7192977, CVE-2013-0442: Issue in toolkit thread + - S7197546, CVE-2013-0428: (proxy) Reflect about creating reflective proxies + - S7200491: Tighten up JTable layout code + - S7200500: Launcher better input validation + - S7201064: Better dialogue checking + - S7201066, CVE-2013-0441: Change modifiers on unused fields + - S7201068, CVE-2013-0435: Better handling of UI elements + - S7201070: Serialization to conform to protocol + - S7201071, CVE-2013-0433: InetSocketAddress serialization issue + - S8000210: Improve JarFile code quality + - S8000537, CVE-2013-0450: Contextualize RequiredModelMBean class + - S8000540, CVE-2013-1475: Improve IIOP type reuse management + - S8000631, CVE-2013-1476: Restrict access to class constructor + - S8001235, CVE-2013-0434: Improve JAXP HTTP handling + - S8001242: Improve RMI HTTP conformance + - S8001307: Modify ACC_SUPER behavior + - S8001972, CVE-2013-1478: Improve image processing + - S8002325, CVE-2013-1480: Improve management of images +* Backports + - S7010849: 5/5 Extraneous javac source/target options when building sa-jdi + +New in release 1.11.6 (2012-02-03): + +* Security fixes + - S6563318, CVE-2013-0424: RMI data sanitization + - S6664509, CVE-2013-0425: Add logging context + - S6664528, CVE-2013-0426: Find log level matching its name or value given at construction time + - S6776941: CVE-2013-0427: Improve thread pool shutdown + - S7141694, CVE-2013-0429: Improving CORBA internals + - S7173145: Improve in-memory representation of splashscreens + - S7186945: Unpack200 improvement + - S7186946: Refine unpacker resource usage + - S7186948: Improve Swing data validation + - S7186952, CVE-2013-0432: Improve clipboard access + - S7186954: Improve connection performance + - S7186957: Improve Pack200 data validation + - S7192392, CVE-2013-0443: Better validation of client keys + - S7192393, CVE-2013-0440: Better Checking of order of TLS Messages + - S7192977, CVE-2013-0442: Issue in toolkit thread + - S7197546, CVE-2013-0428: (proxy) Reflect about creating reflective proxies + - S7200491: Tighten up JTable layout code + - S7200500: Launcher better input validation + - S7201064: Better dialogue checking + - S7201066, CVE-2013-0441: Change modifiers on unused fields + - S7201068, CVE-2013-0435: Better handling of UI elements + - S7201070: Serialization to conform to protocol + - S7201071, CVE-2013-0433: InetSocketAddress serialization issue + - S8000210: Improve JarFile code quality + - S8000537, CVE-2013-0450: Contextualize RequiredModelMBean class + - S8000540, CVE-2013-1475: Improve IIOP type reuse management + - S8000631, CVE-2013-1476: Restrict access to class constructor + - S8001235, CVE-2013-0434: Improve JAXP HTTP handling + - S8001242: Improve RMI HTTP conformance + - S8001307: Modify ACC_SUPER behavior + - S8001972, CVE-2013-1478: Improve image processing + - S8002325, CVE-2013-1480: Improve management of images +* Backports + - S7010849: 5/5 Extraneous javac source/target options when building sa-jdi + New in release 1.12.0 (2013-01-29): * Import of OpenJDK6 b27 (all changes already in security updates) @@ -101,7 +241,6 @@ * SystemTap - Addition of garbage collection probes - New in release 1.11.5 (2012-10-16): * Security fixes
--- a/acinclude.m4 Wed Feb 13 23:54:10 2013 +0000 +++ b/acinclude.m4 Tue Mar 19 00:21:31 2013 +0000 @@ -716,9 +716,12 @@ AC_SUBST([$1]) ]) -AC_DEFUN([IT_ENABLE_ZERO_BUILD], +AC_DEFUN_ONCE([IT_ENABLE_ZERO_BUILD], [ AC_REQUIRE([IT_SET_ARCH_SETTINGS]) + AC_REQUIRE([IT_ENABLE_CACAO]) + AC_REQUIRE([IT_ENABLE_JAMVM]) + AC_REQUIRE([IT_SET_SHARK_BUILD]) AC_MSG_CHECKING([whether to use the zero-assembler port]) use_zero=no AC_ARG_ENABLE([zero], @@ -794,7 +797,7 @@ AC_CONFIG_FILES([ergo.c]) ]) -AC_DEFUN([IT_SET_SHARK_BUILD], +AC_DEFUN_ONCE([IT_SET_SHARK_BUILD], [ AC_MSG_CHECKING(whether to use the Shark JIT) shark_selected=no @@ -818,7 +821,7 @@ AM_CONDITIONAL(SHARK_BUILD, test "x${use_shark}" = xyes) ]) -AC_DEFUN([IT_ENABLE_JAMVM], +AC_DEFUN_ONCE([IT_ENABLE_JAMVM], [ AC_MSG_CHECKING(whether to use JamVM as VM) AC_ARG_ENABLE([jamvm], @@ -857,7 +860,7 @@ AC_SUBST(ALT_JAMVM_SRC_ZIP) ]) -AC_DEFUN([IT_ENABLE_CACAO], +AC_DEFUN_ONCE([IT_ENABLE_CACAO], [ AC_MSG_CHECKING(whether to use CACAO as VM) AC_ARG_ENABLE([cacao], @@ -956,11 +959,16 @@ AC_SUBST([GCJ]) ]) -AC_DEFUN([IT_WITH_HOTSPOT_BUILD], +AC_DEFUN_ONCE([IT_WITH_HOTSPOT_BUILD], [ + AC_REQUIRE([IT_ENABLE_ZERO_BUILD]) ORIGINAL_BUILD="original" - ALTERNATE_BUILD="original" - DEFAULT_BUILD=${ORIGINAL_BUILD} + ALTERNATE_BUILD="hs23" + if test "x${use_zero}" = "xyes"; then + DEFAULT_BUILD=${ORIGINAL_BUILD} + else + DEFAULT_BUILD=${ALTERNATE_BUILD} + fi AC_MSG_CHECKING([which HotSpot build to use]) AC_ARG_WITH([hotspot-build], [AS_HELP_STRING(--with-hotspot-build,the HotSpot build to use (see hotspot.map))], @@ -978,6 +986,11 @@ AC_MSG_RESULT([${HSBUILD}]) AC_SUBST([HSBUILD]) AM_CONDITIONAL(WITH_ALT_HSBUILD, test "x${HSBUILD}" != "x${ORIGINAL_BUILD}") + if test "x${HSBUILD}" = "x${ALTERNATE_BUILD}" ; then + if test "x${use_zero}" = "xyes"; then + AC_MSG_ERROR([The ${ALTERNATE_BUILD} build of HotSpot is known not to work with Zero or Shark.]) + fi + fi ]) AC_DEFUN([IT_WITH_HOTSPOT_SRC_ZIP],
--- a/hotspot.map Wed Feb 13 23:54:10 2013 +0000 +++ b/hotspot.map Tue Mar 19 00:21:31 2013 +0000 @@ -1,1 +1,2 @@ # version url changeset sha256sum +hs23 http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot 23888f3dec52 6d77e26134d47e62621a35b259c70d8e98070724af9a718ec2b85cf84b954614
--- a/patches/arm-hsdis.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -2012-01-20 Andrew Haley <aph@redhat.com> - - * Makefile (ARCH): Add entry for armv7l. - (CFLAGS): Enable debugging. - ($(LIBRARIES)): Pass CFLAGS to sub-make. - * hsdis.c: Include string.h. - (parse_caller_options): Fix strncmp bug. - (native_arch_name): Add entry for ARM. - -diff -u openjdk/hotspot/src/share/tools/hsdis/hsdis.c ../icedtea6/openjdk/hotspot/src/share/tools/hsdis/hsdis.c ---- openjdk/hotspot/src/share/tools/hsdis/hsdis.c 2011-11-14 17:07:33.000000000 -0500 -+++ openjdk/hotspot/src/share/tools/hsdis/hsdis.c 2012-01-20 10:21:28.000000000 -0500 -@@ -22,8 +22,6 @@ - * - */ - --#include "precompiled.hpp" -- - /* hsdis.c -- dump a range of addresses as native instructions - This implements the plugin protocol required by the - HotSpot PrintAssembly option. -@@ -37,6 +35,8 @@ - #include <dis-asm.h> - #include <inttypes.h> - -+#include <string.h> -+ - #ifndef bool - #define bool int - #define true 1 -@@ -358,7 +358,7 @@ - if (plen > mach_size) plen = mach_size; - strncpy(mach_option, p, plen); - mach_option[plen] = '\0'; -- } else if (plen > 6 && strncmp(p, "hsdis-", 6)) { -+ } else if (plen > 6 && !strncmp(p, "hsdis-", 6)) { - // do not pass these to the next level - } else { - /* just copy it; {i386,sparc}-dis.c might like to see it */ -@@ -420,6 +420,9 @@ - #ifdef LIBARCH_sparcv9 - res = "sparc:v9b"; - #endif -+#ifdef LIBARCH_arm -+ res = "arm"; -+#endif - if (res == NULL) - res = "architecture not set in Makefile!"; - return res; -diff -u openjdk/hotspot/src/share/tools/hsdis/Makefile openjdk/hotspot/src/share/tools/hsdis/Makefile ---- openjdk/hotspot/src/share/tools/hsdis/Makefile 2011-11-14 17:07:33.000000000 -0500 -+++ openjdk/hotspot/src/share/tools/hsdis/Makefile 2012-01-20 10:20:32.000000000 -0500 -@@ -68,14 +68,18 @@ - CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW) - else - CPU = $(shell uname -m) -+ifneq ($(findstring arm,$(CPU)),) -+ARCH=arm -+else - ARCH1=$(CPU:x86_64=amd64) - ARCH=$(ARCH1:i686=i386) - CFLAGS/i386 += -m32 - CFLAGS/sparc += -m32 - CFLAGS/sparcv9 += -m64 - CFLAGS/amd64 += -m64 -+endif - CFLAGS += $(CFLAGS/$(ARCH)) --CFLAGS += -fPIC -+CFLAGS += -fPIC -g - OS = linux - LIB_EXT = .so - CC = gcc -@@ -118,7 +122,7 @@ - BINUTILSDIR = $(shell cd $(BINUTILS);pwd) - endif - --CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILS)/bfd -I$(TARGET_DIR)/bfd -+CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILSDIR)/bfd -I$(TARGET_DIR)/bfd - CPPFLAGS += -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\" - - TARGET_DIR = build/$(OS)-$(JDKARCH) -@@ -145,7 +149,7 @@ - demo: $(TARGET) $(DEMO_TARGET) - - $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile -- if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi -+ if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes "CFLAGS=$(CFLAGS)"; fi - - $(TARGET_DIR)/Makefile: - (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/cacao/hotspot/hs23/memory.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,36 @@ +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/rules.make openjdk/hotspot/make/linux/makefiles/rules.make +--- openjdk.orig/hotspot/make/linux/makefiles/rules.make 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/make/linux/makefiles/rules.make 2013-02-15 14:53:43.564311236 +0000 +@@ -128,7 +128,7 @@ + # Settings for javac + BOOT_SOURCE_LANGUAGE_VERSION = 6 + BOOT_TARGET_CLASS_VERSION = 6 +-JAVAC_FLAGS = -g -encoding ascii ++JAVAC_FLAGS = -g -encoding ascii -J-Xmx512m + BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) + + # With parallel makes, print a message at the end of compilation. +diff -Nru openjdk.orig/hotspot/make/solaris/makefiles/rules.make openjdk/hotspot/make/solaris/makefiles/rules.make +--- openjdk.orig/hotspot/make/solaris/makefiles/rules.make 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/make/solaris/makefiles/rules.make 2013-02-15 14:54:13.620795503 +0000 +@@ -120,7 +120,7 @@ + # Settings for javac + BOOT_SOURCE_LANGUAGE_VERSION = 6 + BOOT_TARGET_CLASS_VERSION = 6 +-JAVAC_FLAGS = -g -encoding ascii ++JAVAC_FLAGS = -g -encoding ascii -J-Xmx512m + BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) + + # With parallel makes, print a message at the end of compilation. +diff -Nru openjdk.orig/hotspot/make/windows/makefiles/rules.make openjdk/hotspot/make/windows/makefiles/rules.make +--- openjdk.orig/hotspot/make/windows/makefiles/rules.make 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/make/windows/makefiles/rules.make 2013-02-15 14:53:58.300548666 +0000 +@@ -45,7 +45,7 @@ + # Settings for javac + BOOT_SOURCE_LANGUAGE_VERSION=6 + BOOT_TARGET_CLASS_VERSION=6 +-JAVAC_FLAGS=-g -encoding ascii ++JAVAC_FLAGS=-g -encoding ascii -J-Xmx512m + BOOTSTRAP_JAVAC_FLAGS=$(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) + + ProjectFile=jvm.vcproj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/cacao/hotspot/original/memory.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,36 @@ +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/rules.make openjdk-ecj/hotspot/make/linux/makefiles/rules.make +--- openjdk.orig/hotspot/make/linux/makefiles/rules.make 2013-01-26 13:32:42.117831617 +0000 ++++ openjdk/hotspot/make/linux/makefiles/rules.make 2013-01-26 13:33:29.934595340 +0000 +@@ -133,7 +133,7 @@ + # Settings for javac + BOOT_SOURCE_LANGUAGE_VERSION = 5 + BOOT_TARGET_CLASS_VERSION = 5 +-JAVAC_FLAGS = -g -encoding ascii ++JAVAC_FLAGS = -g -encoding ascii -J-Xmx512m + BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) + + # With parallel makes, print a message at the end of compilation. +diff -Nru openjdk.orig/hotspot/make/solaris/makefiles/rules.make openjdk-ecj/hotspot/make/solaris/makefiles/rules.make +--- openjdk.orig/hotspot/make/solaris/makefiles/rules.make 2013-01-26 13:32:42.137831936 +0000 ++++ openjdk/hotspot/make/solaris/makefiles/rules.make 2013-01-26 13:33:41.934787007 +0000 +@@ -133,7 +133,7 @@ + # Settings for javac + BOOT_SOURCE_LANGUAGE_VERSION = 5 + BOOT_TARGET_CLASS_VERSION = 5 +-JAVAC_FLAGS = -g -encoding ascii ++JAVAC_FLAGS = -g -encoding ascii -J-Xmx512m + BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) + + # With parallel makes, print a message at the end of compilation. +diff -Nru openjdk.orig/hotspot/make/windows/makefiles/rules.make openjdk-ecj/hotspot/make/windows/makefiles/rules.make +--- openjdk.orig/hotspot/make/windows/makefiles/rules.make 2013-01-26 13:32:42.153832191 +0000 ++++ openjdk/hotspot/make/windows/makefiles/rules.make 2013-01-26 13:34:12.419273915 +0000 +@@ -45,7 +45,7 @@ + # Settings for javac + BOOT_SOURCE_LANGUAGE_VERSION=5 + BOOT_TARGET_CLASS_VERSION=5 +-JAVAC_FLAGS=-g -encoding ascii ++JAVAC_FLAGS=-g -encoding ascii -J-Xmx512m + BOOTSTRAP_JAVAC_FLAGS=$(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) + + ProjectFile=jvm.vcproj
--- a/patches/cacao/memory.patch Wed Feb 13 23:54:10 2013 +0000 +++ b/patches/cacao/memory.patch Tue Mar 19 00:21:31 2013 +0000 @@ -16,42 +16,6 @@ <compilerarg line="${javac.no.jdk.warnings}"/> <compilerarg line="${javac.version.opt}"/> <compilerarg line="${javac.lint.opts}"/> -diff -Nru openjdk.orig/hotspot/make/linux/makefiles/rules.make openjdk-ecj/hotspot/make/linux/makefiles/rules.make ---- openjdk.orig/hotspot/make/linux/makefiles/rules.make 2013-01-26 13:32:42.117831617 +0000 -+++ openjdk/hotspot/make/linux/makefiles/rules.make 2013-01-26 13:33:29.934595340 +0000 -@@ -133,7 +133,7 @@ - # Settings for javac - BOOT_SOURCE_LANGUAGE_VERSION = 5 - BOOT_TARGET_CLASS_VERSION = 5 --JAVAC_FLAGS = -g -encoding ascii -+JAVAC_FLAGS = -g -encoding ascii -J-Xmx512m - BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) - - # With parallel makes, print a message at the end of compilation. -diff -Nru openjdk.orig/hotspot/make/solaris/makefiles/rules.make openjdk-ecj/hotspot/make/solaris/makefiles/rules.make ---- openjdk.orig/hotspot/make/solaris/makefiles/rules.make 2013-01-26 13:32:42.137831936 +0000 -+++ openjdk/hotspot/make/solaris/makefiles/rules.make 2013-01-26 13:33:41.934787007 +0000 -@@ -133,7 +133,7 @@ - # Settings for javac - BOOT_SOURCE_LANGUAGE_VERSION = 5 - BOOT_TARGET_CLASS_VERSION = 5 --JAVAC_FLAGS = -g -encoding ascii -+JAVAC_FLAGS = -g -encoding ascii -J-Xmx512m - BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) - - # With parallel makes, print a message at the end of compilation. -diff -Nru openjdk.orig/hotspot/make/windows/makefiles/rules.make openjdk-ecj/hotspot/make/windows/makefiles/rules.make ---- openjdk.orig/hotspot/make/windows/makefiles/rules.make 2013-01-26 13:32:42.153832191 +0000 -+++ openjdk/hotspot/make/windows/makefiles/rules.make 2013-01-26 13:34:12.419273915 +0000 -@@ -45,7 +45,7 @@ - # Settings for javac - BOOT_SOURCE_LANGUAGE_VERSION=5 - BOOT_TARGET_CLASS_VERSION=5 --JAVAC_FLAGS=-g -encoding ascii -+JAVAC_FLAGS=-g -encoding ascii -J-Xmx512m - BOOTSTRAP_JAVAC_FLAGS=$(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) - - ProjectFile=jvm.vcproj diff -Nru openjdk.orig/jaxws/build.properties openjdk-ecj/jaxws/build.properties --- openjdk.orig/jaxws/build.properties 2013-01-26 06:52:34.544450267 +0000 +++ openjdk/jaxws/build.properties 2013-01-26 06:52:51.896729971 +0000
--- a/patches/ecj/hotspot-jdk-dependency.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -diff -Nru openjdk-ecj.orig/hotspot/make/linux/makefiles/sa.make openjdk-ecj/hotspot/make/linux/makefiles/sa.make ---- openjdk-ecj.orig/hotspot/make/linux/makefiles/sa.make 2012-05-01 22:15:06.000000000 +0100 -+++ openjdk-ecj/hotspot/make/linux/makefiles/sa.make 2012-08-15 19:43:49.830577295 +0100 -@@ -97,8 +97,8 @@ - $(foreach file,$(AGENT_FILES1),$(shell echo $(file) >> $(AGENT_FILES1_LIST))) - $(foreach file,$(AGENT_FILES2),$(shell echo $(file) >> $(AGENT_FILES2_LIST))) - -- $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES1_LIST) -- $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES2_LIST) -+ $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR):$(JDK_TOPDIR)/src/share/classes:$(JDK_TOPDIR)/src/solaris/classes:$(GENSRCDIR) -d $(SA_CLASSDIR) @$(AGENT_FILES1_LIST) -+ $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR):$(JDK_TOPDIR)/src/share/classes:$(JDK_TOPDIR)/src/solaris/classes:$(GENSRCDIR) -d $(SA_CLASSDIR) @$(AGENT_FILES2_LIST) - - $(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer - $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) -diff -Nru openjdk-ecj.orig/make/hotspot-rules.gmk openjdk-ecj/make/hotspot-rules.gmk ---- openjdk-ecj.orig/make/hotspot-rules.gmk 2012-05-01 22:13:57.000000000 +0100 -+++ openjdk-ecj/make/hotspot-rules.gmk 2012-08-15 19:44:23.215116331 +0100 -@@ -83,6 +83,7 @@ - HOTSPOT_BUILD_ARGUMENTS += $(COMMON_BUILD_ARGUMENTS) - HOTSPOT_BUILD_ARGUMENTS += ALT_OUTPUTDIR=$(HOTSPOT_OUTPUTDIR) - HOTSPOT_BUILD_ARGUMENTS += ALT_EXPORT_PATH=$(HOTSPOT_EXPORT_PATH) -+HOTSPOT_BUILD_ARGUMENTS += GENSRCDIR=$(GENSRCDIR) - - # Why do these need to be passed in? Because of windows nmake? and MAKEFLAGS=? - # Or is there something wrong with hotspot/make/Makefile?
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ecj/hotspot/hs23/hotspot-jdk-dependency.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,23 @@ +diff -Nru openjdk-ecj.orig/hotspot/make/linux/makefiles/sa.make openjdk-ecj/hotspot/make/linux/makefiles/sa.make +--- openjdk-ecj.orig/hotspot/make/linux/makefiles/sa.make 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk-ecj/hotspot/make/linux/makefiles/sa.make 2013-02-14 18:25:27.487892901 +0000 +@@ -91,7 +91,7 @@ + # are in AGENT_FILES, so use the shell to expand them. + # Be extra carefull to not produce too long command lines in the shell! + $(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST))) +- $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST) ++ $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR):$(JDK_TOPDIR)/src/share/classes:$(JDK_TOPDIR)/src/solaris/classes:$(GENSRCDIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST) + $(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer + $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) + $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js +diff -Nru openjdk-ecj.orig/make/hotspot-rules.gmk openjdk-ecj/make/hotspot-rules.gmk +--- openjdk-ecj.orig/make/hotspot-rules.gmk 2012-10-26 19:21:39.000000000 +0100 ++++ openjdk-ecj/make/hotspot-rules.gmk 2013-02-14 18:24:27.622929395 +0000 +@@ -83,6 +83,7 @@ + HOTSPOT_BUILD_ARGUMENTS += $(COMMON_BUILD_ARGUMENTS) + HOTSPOT_BUILD_ARGUMENTS += ALT_OUTPUTDIR=$(HOTSPOT_OUTPUTDIR) + HOTSPOT_BUILD_ARGUMENTS += ALT_EXPORT_PATH=$(HOTSPOT_EXPORT_PATH) ++HOTSPOT_BUILD_ARGUMENTS += GENSRCDIR=$(GENSRCDIR) + + # Why do these need to be passed in? Because of windows nmake? and MAKEFLAGS=? + # Or is there something wrong with hotspot/make/Makefile?
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ecj/hotspot/original/hotspot-jdk-dependency.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,25 @@ +diff -Nru openjdk-ecj.orig/hotspot/make/linux/makefiles/sa.make openjdk-ecj/hotspot/make/linux/makefiles/sa.make +--- openjdk-ecj.orig/hotspot/make/linux/makefiles/sa.make 2012-05-01 22:15:06.000000000 +0100 ++++ openjdk-ecj/hotspot/make/linux/makefiles/sa.make 2012-08-15 19:43:49.830577295 +0100 +@@ -97,8 +97,8 @@ + $(foreach file,$(AGENT_FILES1),$(shell echo $(file) >> $(AGENT_FILES1_LIST))) + $(foreach file,$(AGENT_FILES2),$(shell echo $(file) >> $(AGENT_FILES2_LIST))) + +- $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES1_LIST) +- $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES2_LIST) ++ $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR):$(JDK_TOPDIR)/src/share/classes:$(JDK_TOPDIR)/src/solaris/classes:$(GENSRCDIR) -d $(SA_CLASSDIR) @$(AGENT_FILES1_LIST) ++ $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR):$(JDK_TOPDIR)/src/share/classes:$(JDK_TOPDIR)/src/solaris/classes:$(GENSRCDIR) -d $(SA_CLASSDIR) @$(AGENT_FILES2_LIST) + + $(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer + $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) +diff -Nru openjdk-ecj.orig/make/hotspot-rules.gmk openjdk-ecj/make/hotspot-rules.gmk +--- openjdk-ecj.orig/make/hotspot-rules.gmk 2012-05-01 22:13:57.000000000 +0100 ++++ openjdk-ecj/make/hotspot-rules.gmk 2012-08-15 19:44:23.215116331 +0100 +@@ -83,6 +83,7 @@ + HOTSPOT_BUILD_ARGUMENTS += $(COMMON_BUILD_ARGUMENTS) + HOTSPOT_BUILD_ARGUMENTS += ALT_OUTPUTDIR=$(HOTSPOT_OUTPUTDIR) + HOTSPOT_BUILD_ARGUMENTS += ALT_EXPORT_PATH=$(HOTSPOT_EXPORT_PATH) ++HOTSPOT_BUILD_ARGUMENTS += GENSRCDIR=$(GENSRCDIR) + + # Why do these need to be passed in? Because of windows nmake? and MAKEFLAGS=? + # Or is there something wrong with hotspot/make/Makefile?
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/gcc-suffix-hotspot.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,31 @@ +diff -Nru openjdk.orig/hotspot/agent/src/os/linux/Makefile openjdk/hotspot/agent/src/os/linux/Makefile +--- openjdk.orig/hotspot/agent/src/os/linux/Makefile 2012-05-01 22:15:02.000000000 +0100 ++++ openjdk/hotspot/agent/src/os/linux/Makefile 2012-08-31 14:23:17.249256215 +0100 +@@ -23,7 +23,7 @@ + # + + ARCH := $(shell if ([ `uname -m` = "ia64" ]) ; then echo ia64 ; elif ([ `uname -m` = "x86_64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi ) +-GCC = gcc ++GCC = gcc$(GCC_SUFFIX) + + JAVAH = ${JAVA_HOME}/bin/javah + +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/gcc.make openjdk/hotspot/make/linux/makefiles/gcc.make +--- openjdk.orig/hotspot/make/linux/makefiles/gcc.make 2012-08-31 14:22:45.464733130 +0100 ++++ openjdk/hotspot/make/linux/makefiles/gcc.make 2012-08-31 14:23:17.249256215 +0100 +@@ -28,11 +28,11 @@ + # When cross-compiling the ALT_COMPILER_PATH points + # to the cross-compilation toolset + ifdef CROSS_COMPILE_ARCH +-CPP = $(ALT_COMPILER_PATH)/g++ +-CC = $(ALT_COMPILER_PATH)/gcc ++CPP = $(ALT_COMPILER_PATH)/g++$(GCC_SUFFIX) ++CC = $(ALT_COMPILER_PATH)/gcc$(GCC_SUFFIX) + else +-CPP = g++ +-CC = gcc ++CPP = g++$(GCC_SUFFIX) ++CC = gcc$(GCC_SUFFIX) + endif + + AS = $(CC) -c
--- a/patches/gcc-suffix.patch Wed Feb 13 23:54:10 2013 +0000 +++ b/patches/gcc-suffix.patch Tue Mar 19 00:21:31 2013 +0000 @@ -23,37 +23,6 @@ endif ifeq ($(ZERO_BUILD), true) # zero -diff -Nru openjdk.orig/hotspot/agent/src/os/linux/Makefile openjdk/hotspot/agent/src/os/linux/Makefile ---- openjdk.orig/hotspot/agent/src/os/linux/Makefile 2012-05-01 22:15:02.000000000 +0100 -+++ openjdk/hotspot/agent/src/os/linux/Makefile 2012-08-31 14:23:17.249256215 +0100 -@@ -23,7 +23,7 @@ - # - - ARCH := $(shell if ([ `uname -m` = "ia64" ]) ; then echo ia64 ; elif ([ `uname -m` = "x86_64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi ) --GCC = gcc -+GCC = gcc$(GCC_SUFFIX) - - JAVAH = ${JAVA_HOME}/bin/javah - -diff -Nru openjdk.orig/hotspot/make/linux/makefiles/gcc.make openjdk/hotspot/make/linux/makefiles/gcc.make ---- openjdk.orig/hotspot/make/linux/makefiles/gcc.make 2012-08-31 14:22:45.464733130 +0100 -+++ openjdk/hotspot/make/linux/makefiles/gcc.make 2012-08-31 14:23:17.249256215 +0100 -@@ -28,11 +28,11 @@ - # When cross-compiling the ALT_COMPILER_PATH points - # to the cross-compilation toolset - ifdef CROSS_COMPILE_ARCH --CPP = $(ALT_COMPILER_PATH)/g++ --CC = $(ALT_COMPILER_PATH)/gcc -+CPP = $(ALT_COMPILER_PATH)/g++$(GCC_SUFFIX) -+CC = $(ALT_COMPILER_PATH)/gcc$(GCC_SUFFIX) - else --CPP = g++ --CC = gcc -+CPP = g++$(GCC_SUFFIX) -+CC = gcc$(GCC_SUFFIX) - endif - - AS = $(CC) -c diff -Nru openjdk.orig/jdk/make/common/shared/Compiler-gcc.gmk openjdk/jdk/make/common/shared/Compiler-gcc.gmk --- openjdk.orig/jdk/make/common/shared/Compiler-gcc.gmk 2012-05-01 22:17:59.000000000 +0100 +++ openjdk/jdk/make/common/shared/Compiler-gcc.gmk 2012-08-31 14:23:17.241256083 +0100
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs23/arm-hsdis.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,72 @@ +diff -Nru openjdk.orig/hotspot/src/share/tools/hsdis/hsdis.c openjdk/hotspot/src/share/tools/hsdis/hsdis.c +--- openjdk.orig/hotspot/src/share/tools/hsdis/hsdis.c 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/tools/hsdis/hsdis.c 2013-02-14 18:06:25.372022803 +0000 +@@ -35,6 +35,8 @@ + #include <dis-asm.h> + #include <inttypes.h> + ++#include <string.h> ++ + #ifndef bool + #define bool int + #define true 1 +@@ -356,7 +358,7 @@ + if (plen > mach_size) plen = mach_size; + strncpy(mach_option, p, plen); + mach_option[plen] = '\0'; +- } else if (plen > 6 && strncmp(p, "hsdis-", 6) == 0) { ++ } else if (plen > 6 && !strncmp(p, "hsdis-", 6)) { + // do not pass these to the next level + } else { + /* just copy it; {i386,sparc}-dis.c might like to see it */ +@@ -418,6 +420,9 @@ + #ifdef LIBARCH_sparcv9 + res = "sparc:v9b"; + #endif ++#ifdef LIBARCH_arm ++ res = "arm"; ++#endif + if (res == NULL) + res = "architecture not set in Makefile!"; + return res; +diff -Nru openjdk.orig/hotspot/src/share/tools/hsdis/Makefile openjdk/hotspot/src/share/tools/hsdis/Makefile +--- openjdk.orig/hotspot/src/share/tools/hsdis/Makefile 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/tools/hsdis/Makefile 2013-02-14 18:05:21.514998150 +0000 +@@ -68,14 +68,18 @@ + CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW) + else + CPU = $(shell uname -m) ++ifneq ($(findstring arm,$(CPU)),) ++ARCH=arm ++else + ARCH1=$(CPU:x86_64=amd64) + ARCH=$(ARCH1:i686=i386) + CFLAGS/i386 += -m32 + CFLAGS/sparc += -m32 + CFLAGS/sparcv9 += -m64 + CFLAGS/amd64 += -m64 ++endif + CFLAGS += $(CFLAGS/$(ARCH)) +-CFLAGS += -fPIC ++CFLAGS += -fPIC -g + OS = linux + LIB_EXT = .so + CC = gcc +@@ -118,7 +122,7 @@ + BINUTILSDIR = $(shell cd $(BINUTILS);pwd) + endif + +-CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILS)/bfd -I$(TARGET_DIR)/bfd ++CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILSDIR)/bfd -I$(TARGET_DIR)/bfd + CPPFLAGS += -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\" + + TARGET_DIR = build/$(OS)-$(JDKARCH) +@@ -145,7 +149,7 @@ + demo: $(TARGET) $(DEMO_TARGET) + + $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile +- if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi ++ if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes "CFLAGS=$(CFLAGS)"; fi + + $(TARGET_DIR)/Makefile: + (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs23/pr639-broken_shark_build.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,27 @@ +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/launcher.make openjdk/hotspot/make/linux/makefiles/launcher.make +--- openjdk.orig/hotspot/make/linux/makefiles/launcher.make 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/make/linux/makefiles/launcher.make 2013-02-14 17:26:56.322081018 +0000 +@@ -52,6 +52,10 @@ + LAUNCHER.o = launcher.o + LFLAGS_LAUNCHER += -L `pwd` + LIBS_LAUNCHER += -l$(JVM) $(LIBS) ++ ifeq ($(SHARK_BUILD), true) ++ LFLAGS_LAUNCHER += $(LLVM_LDFLAGS) ++ LIBS_LAUNCHER += $(LLVM_LIBS) ++ endif + endif + + LINK_LAUNCHER = $(LINK.CC) +diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciTypeFlow.cpp openjdk/hotspot/src/share/vm/ci/ciTypeFlow.cpp +--- openjdk.orig/hotspot/src/share/vm/ci/ciTypeFlow.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/ci/ciTypeFlow.cpp 2013-02-14 17:26:10.377344366 +0000 +@@ -37,6 +37,9 @@ + #include "memory/allocation.inline.hpp" + #include "runtime/deoptimization.hpp" + #include "utilities/growableArray.hpp" ++#ifdef SHARK ++#include "shark/shark_globals.hpp" ++#endif + + // ciTypeFlow::JsrSet + //
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs23/remove_jsr292_tests.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,199 @@ +diff --git a/test/compiler/6990212/Test6990212.java b/test/compiler/6990212/Test6990212.java +deleted file mode 100644 +--- openjdk/hotspot/test/compiler/6990212/Test6990212.java ++++ /dev/null +@@ -1,56 +0,0 @@ +-/* +- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +- * or visit www.oracle.com if you need additional information or have any +- * questions. +- * +- */ +- +-/** +- * @test +- * @bug 6990212 +- * @summary JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods +- * +- * @run main Test6990212 +- */ +- +-import java.lang.invoke.*; +- +-interface intf { +- public Object target(); +-} +- +-public class Test6990212 implements intf { +- public Object target() { +- return null; +- } +- +- public static void main(String[] args) throws Throwable { +- // Build an interface invoke and then invoke it on something +- // that doesn't implement the interface to test the +- // raiseException path. +- MethodHandle target = MethodHandles.lookup().findVirtual(intf.class, "target", MethodType.methodType(Object.class)); +- try { +- target.invoke(new Object()); +- } catch (ClassCastException cce) { +- // everything is ok +- System.out.println("got expected ClassCastException"); +- } +- } +-} +diff --git a/test/compiler/7141637/SpreadNullArg.java b/test/compiler/7141637/SpreadNullArg.java +deleted file mode 100644 +--- openjdk/hotspot/test/compiler/7141637/SpreadNullArg.java ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* +- * Copyright 2011 SAP AG. All Rights Reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +- * or visit www.oracle.com if you need additional information or have any +- * questions. +- */ +- +-/* +- * @test SpreadNullArg +- * @bug 7141637 +- * @summary verifies that the MethodHandle spread adapter can gracefully handle null arguments. +- * @run main SpreadNullArg +- * @author volker.simonis@gmail.com +- */ +- +-import java.lang.invoke.MethodHandle; +-import java.lang.invoke.MethodHandles; +-import java.lang.invoke.MethodType; +- +-public class SpreadNullArg { +- +- public static void main(String args[]) { +- +- MethodType mt_ref_arg = MethodType.methodType(int.class, Integer.class); +- MethodHandle mh_spreadInvoker = MethodHandles.spreadInvoker(mt_ref_arg, 0); +- MethodHandle mh_spread_target; +- int result = 42; +- +- try { +- mh_spread_target = +- MethodHandles.lookup().findStatic(SpreadNullArg.class, "target_spread_arg", mt_ref_arg); +- result = (int) mh_spreadInvoker.invokeExact(mh_spread_target, (Object[]) null); +- } catch(NullPointerException e) { +- // Expected exception - do nothing! +- } catch(Throwable e) { +- throw new Error(e); +- } +- +- if (result != 42) throw new Error("Expected NullPointerException was not thrown"); +- } +- +- public static int target_spread_arg(Integer i1) { +- return i1.intValue(); +- } +- +-} +diff --git a/test/compiler/7158807/Test7158807.java b/test/compiler/7158807/Test7158807.java +deleted file mode 100644 +--- openjdk/hotspot/test/compiler/7158807/Test7158807.java ++++ /dev/null +@@ -1,66 +0,0 @@ +-/* +- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +- * or visit www.oracle.com if you need additional information or have any +- * questions. +- * +- */ +- +-/** +- * @test +- * @bug 7158807 +- * @summary Revise stack management with volatile call sites +- * @author Marc Schonefeld +- * +- * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss248k Test7158807 +- */ +- +-import java.lang.invoke.MethodHandle; +-import java.lang.invoke.MethodType; +-import java.lang.invoke.VolatileCallSite; +- +-public class Test7158807 { +- /** +- * @param args the command line arguments +- */ +- public static void main(String[] args) throws Throwable { +- for (int i = 0; i < 25600; i++) { +- MethodType mt = MethodType.methodType(java.lang.String.class); +- System.out.println(mt); +- MethodType mt3 = null; +- try { +- mt3 = MethodType.genericMethodType(i); +- } catch (IllegalArgumentException e) { +- System.out.println("Passed"); +- System.exit(95); +- } +- System.out.println(i+":"); +- try { +- VolatileCallSite vcs = new VolatileCallSite(mt3); +- System.out.println(vcs); +- MethodHandle mh = vcs.dynamicInvoker(); +- vcs.setTarget(mh); +- // System.out.println(mh); +- mh.invoke(mt, mh); +- } catch (Throwable e) { +- } +- } +- } +-} +-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs23/revert-7017193.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,138 @@ +diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp +--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp +@@ -2763,39 +2763,47 @@ + // writing thread stacks don't use growable mappings (i.e. those + // creeated with MAP_GROWSDOWN), and aren't marked "[stack]", so this + // only applies to the main thread. +- +-static +-bool get_stack_bounds(uintptr_t *bottom, uintptr_t *top) { +- +- char buf[128]; +- int fd, sz; +- +- if ((fd = ::open("/proc/self/maps", O_RDONLY)) < 0) { ++static bool ++get_stack_bounds(uintptr_t *bottom, uintptr_t *top) ++{ ++ FILE *f = fopen("/proc/self/maps", "r"); ++ if (f == NULL) + return false; +- } +- +- const char kw[] = "[stack]"; +- const int kwlen = sizeof(kw)-1; +- +- // Address part of /proc/self/maps couldn't be more than 128 bytes +- while ((sz = os::get_line_chars(fd, buf, sizeof(buf))) > 0) { +- if (sz > kwlen && ::memcmp(buf+sz-kwlen, kw, kwlen) == 0) { +- // Extract addresses +- if (sscanf(buf, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) { +- uintptr_t sp = (uintptr_t) __builtin_frame_address(0); +- if (sp >= *bottom && sp <= *top) { +- ::close(fd); +- return true; +- } ++ ++ while (!feof(f)) { ++ size_t dummy; ++ char *str = NULL; ++ ssize_t len = getline(&str, &dummy, f); ++ if (len == -1) { ++ fclose(f); ++ if (str != NULL) ++ free(str); ++ return false; ++ } ++ ++ if (len > 0 && str[len-1] == '\n') { ++ str[len-1] = 0; ++ len--; ++ } ++ ++ static const char *stack_str = "[stack]"; ++ if (len > (ssize_t)strlen(stack_str) ++ && (strcmp(str + len - strlen(stack_str), stack_str) == 0)) { ++ if (sscanf(str, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) { ++ uintptr_t sp = (uintptr_t)__builtin_frame_address(0); ++ if (sp >= *bottom && sp <= *top) { ++ free(str); ++ fclose(f); ++ return true; + } +- } +- } +- +- ::close(fd); ++ } ++ } ++ free(str); ++ } ++ fclose(f); + return false; + } + +- + // If the (growable) stack mapping already extends beyond the point + // where we're going to put our guard pages, truncate the mapping at + // that point by munmap()ping it. This ensures that when we later +diff --git a/src/share/vm/runtime/os.cpp b/src/share/vm/runtime/os.cpp +--- openjdk/hotspot/src/share/vm/runtime/os.cpp ++++ openjdk/hotspot/src/share/vm/runtime/os.cpp +@@ -1331,41 +1331,3 @@ + } + return result; + } +- +-// Read file line by line, if line is longer than bsize, +-// skip rest of line. +-int os::get_line_chars(int fd, char* buf, const size_t bsize){ +- size_t sz, i = 0; +- +- // read until EOF, EOL or buf is full +- while ((sz = (int) read(fd, &buf[i], 1)) == 1 && i < (bsize-2) && buf[i] != '\n') { +- ++i; +- } +- +- if (buf[i] == '\n') { +- // EOL reached so ignore EOL character and return +- +- buf[i] = 0; +- return (int) i; +- } +- +- buf[i+1] = 0; +- +- if (sz != 1) { +- // EOF reached. if we read chars before EOF return them and +- // return EOF on next call otherwise return EOF +- +- return (i == 0) ? -1 : (int) i; +- } +- +- // line is longer than size of buf, skip to EOL +- char ch; +- while (read(fd, &ch, 1) == 1 && ch != '\n') { +- // Do nothing +- } +- +- // return initial part of line that fits in buf. +- // If we reached EOF, it will be returned on next call. +- +- return (int) i; +-} +diff --git a/src/share/vm/runtime/os.hpp b/src/share/vm/runtime/os.hpp +--- openjdk/hotspot/src/share/vm/runtime/os.hpp ++++ openjdk/hotspot/src/share/vm/runtime/os.hpp +@@ -672,10 +672,6 @@ + // Hook for os specific jvm options that we don't want to abort on seeing + static bool obsolete_option(const JavaVMOption *option); + +- // Read file line by line. If line is longer than bsize, +- // rest of line is skipped. Returns number of bytes read or -1 on EOF +- static int get_line_chars(int fd, char *buf, const size_t bsize); +- + // Extensions + #include "runtime/os_ext.hpp" +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs23/systemtap-alloc-size-workaround.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,12 @@ +diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/sharedRuntime.cpp openjdk/hotspot/src/share/vm/runtime/sharedRuntime.cpp +--- openjdk.orig/hotspot/src/share/vm/runtime/sharedRuntime.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/runtime/sharedRuntime.cpp 2013-02-15 15:41:31.698499811 +0000 +@@ -966,7 +966,7 @@ + Symbol* name = klass->name(); + #ifndef USDT2 + HS_DTRACE_PROBE4(hotspot, object__alloc, get_java_tid(thread), +- name->bytes(), name->utf8_length(), size * HeapWordSize); ++ name->bytes(), name->utf8_length(), size); + #else /* USDT2 */ + HOTSPOT_OBJECT_ALLOC( + get_java_tid(thread),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs23/systemtap.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,140 @@ +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/dtrace.make openjdk/hotspot/make/linux/makefiles/dtrace.make +--- openjdk.orig/hotspot/make/linux/makefiles/dtrace.make 2012-02-22 14:54:31.000000000 +0000 ++++ openjdk/hotspot/make/linux/makefiles/dtrace.make 2012-03-18 18:54:13.482968139 +0000 +@@ -25,3 +25,7 @@ + # Linux does not build jvm_db + LIBJVM_DB = + ++# But it does have a Systemtap dtrace compatible sys/sdt.h ++CFLAGS += -DDTRACE_ENABLED ++ ++# It doesn't support HAVE_DTRACE_H though. +diff -Nru openjdk.orig/hotspot/src/share/vm/prims/jni.cpp openjdk/hotspot/src/share/vm/prims/jni.cpp +--- openjdk.orig/hotspot/src/share/vm/prims/jni.cpp 2012-02-22 14:54:31.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/prims/jni.cpp 2012-03-18 18:54:13.502968466 +0000 +@@ -2818,10 +2818,7 @@ + JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID fieldID, Argument value)) \ + JNIWrapper("Set" XSTR(Result) "Field"); \ + \ +- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, Set##Result##Field__entry, \ +- ( JNIEnv*, jobject, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ +- HS_DTRACE_PROBE_N(hotspot_jni, Set##Result##Field__entry, \ +- ( env, obj, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ ++ FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID, value),DTRACE_PROBE3(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID)); \ + \ + oop o = JNIHandles::resolve_non_null(obj); \ + klassOop k = o->klass(); \ +@@ -3128,10 +3125,7 @@ + \ + JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID fieldID, Argument value)) \ + JNIWrapper("SetStatic" XSTR(Result) "Field"); \ +- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, SetStatic##Result##Field__entry,\ +- ( JNIEnv*, jclass, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ +- HS_DTRACE_PROBE_N(hotspot_jni, SetStatic##Result##Field__entry, \ +- ( env, clazz, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ ++ FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID, value),DTRACE_PROBE3(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID)); \ + \ + JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); \ + assert(id->is_static_field_id(), "invalid static field id"); \ +--- openjdk.orig/hotspot/src/share/vm/utilities/dtrace.hpp 2012-02-22 15:54:31.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/utilities/dtrace.hpp 2012-03-27 13:12:15.857491730 +0200 +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2009, 2012 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -32,12 +33,15 @@ + #define DTRACE_ONLY(x) x + #define NOT_DTRACE(x) + ++#if defined(SOLARIS) + // Work around dtrace tail call bug 6672627 until it is fixed in solaris 10. + #define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() \ + do { volatile size_t dtrace_workaround_tail_call_bug = 1; } while (0) + +-#if defined(SOLARIS) + #define USDT1 1 ++#elif defined(LINUX) ++#define USDT1 1 ++#define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() + #elif defined(__APPLE__) + #define USDT2 1 + #include <sys/types.h> +@@ -63,6 +67,11 @@ + #define DTRACE_PROBE3(a,b,c,d,e) {;} + #define DTRACE_PROBE4(a,b,c,d,e,f) {;} + #define DTRACE_PROBE5(a,b,c,d,e,f,g) {;} ++#define DTRACE_PROBE6(a,b,c,d,e,f,g,h) {;} ++#define DTRACE_PROBE7(a,b,c,d,e,f,g,h,i) {;} ++#define DTRACE_PROBE8(a,b,c,d,e,f,g,h,i,j) {;} ++#define DTRACE_PROBE9(a,b,c,d,e,f,g,h,i,j,k) {;} ++#define DTRACE_PROBE10(a,b,c,d,e,f,g,h,i,j,k,l) {;} + + #else /* USDT2 */ + +@@ -76,10 +85,19 @@ + #define HS_DTRACE_PROBE_FN(provider,name)\ + __dtrace_##provider##___##name + ++#ifdef SOLARIS ++// Solaris dtrace needs actual extern function decls. + #define HS_DTRACE_PROBE_DECL_N(provider,name,args) \ + DTRACE_ONLY(extern "C" void HS_DTRACE_PROBE_FN(provider,name) args) + #define HS_DTRACE_PROBE_CDECL_N(provider,name,args) \ + DTRACE_ONLY(extern void HS_DTRACE_PROBE_FN(provider,name) args) ++#elif defined(LINUX) ++// Systemtap dtrace compatible probes on GNU/Linux don't. ++#define HS_DTRACE_PROBE_DECL_N(provider,name,args) ++#define HS_DTRACE_PROBE_CDECL_N(provider,name,args) ++#else ++#error "USDT1 enabled for unknown os" ++#endif + + /* Dtrace probe declarations */ + #define HS_DTRACE_PROBE_DECL(provider,name) \ +@@ -118,6 +136,8 @@ + uintptr_t,uintptr_t,uintptr_t)) + + /* Dtrace probe definitions */ ++#if defined(SOLARIS) ++// Solaris dtrace uses actual function calls. + #define HS_DTRACE_PROBE_N(provider,name, args) \ + DTRACE_ONLY(HS_DTRACE_PROBE_FN(provider,name) args) + +@@ -153,6 +173,34 @@ + HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ + (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7,\ + (uintptr_t)a8,(uintptr_t)a9)) ++#elif defined(LINUX) ++// Systemtap dtrace compatible probes on GNU/Linux use direct macros. ++#define HS_DTRACE_PROBE(provider,name) HS_DTRACE_PROBE0(provider,name) ++#define HS_DTRACE_PROBE0(provider,name)\ ++ DTRACE_PROBE(provider,name) ++#define HS_DTRACE_PROBE1(provider,name,a0)\ ++ DTRACE_PROBE1(provider,name,a0) ++#define HS_DTRACE_PROBE2(provider,name,a0,a1)\ ++ DTRACE_PROBE2(provider,name,a0,a1) ++#define HS_DTRACE_PROBE3(provider,name,a0,a1,a2)\ ++ DTRACE_PROBE3(provider,name,a0,a1,a2) ++#define HS_DTRACE_PROBE4(provider,name,a0,a1,a2,a3)\ ++ DTRACE_PROBE4(provider,name,a0,a1,a2,a3) ++#define HS_DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4)\ ++ DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4) ++#define HS_DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5)\ ++ DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5) ++#define HS_DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6)\ ++ DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6) ++#define HS_DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7)\ ++ DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7) ++#define HS_DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ ++ DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) ++#define HS_DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ ++ DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) ++#else ++#error "USDT1 enabled for unknown os" ++#endif + + #endif /* !USDT2 */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs23/systemtap_gc.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,378 @@ +diff -Nru openjdk.orig/hotspot/src/share/vm/compiler/oopMap.cpp openjdk/hotspot/src/share/vm/compiler/oopMap.cpp +--- openjdk.orig/hotspot/src/share/vm/compiler/oopMap.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/compiler/oopMap.cpp 2013-02-15 15:15:19.117174844 +0000 +@@ -33,9 +33,13 @@ + #include "memory/resourceArea.hpp" + #include "runtime/frame.inline.hpp" + #include "runtime/signature.hpp" ++#include "utilities/dtrace.hpp" + #ifdef COMPILER1 + #include "c1/c1_Defs.hpp" + #endif ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL1(provider, gc__collection__delete, *uintptr_t); ++#endif /* !USDT2 */ + + // OopMapStream + +@@ -677,6 +681,9 @@ + " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: %d)", + derived_loc, (address)*derived_loc, (address)base, offset); + } ++#ifndef USDT2 ++ HS_DTRACE_PROBE1(hotspot, gc__collection__delete, entry); ++#endif /* !USDT2 */ + + // Delete entry + delete entry; +diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2013-02-15 15:15:19.141175230 +0000 +@@ -55,6 +55,12 @@ + #include "runtime/vmThread.hpp" + #include "services/memoryService.hpp" + #include "services/runtimeService.hpp" ++#include "utilities/dtrace.hpp" ++ ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ + + // statics + CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; +@@ -1647,7 +1653,13 @@ + size_t size, + bool tlab) + { ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__begin, full, clear_all_soft_refs, size, tlab); ++#endif /* !USDT2 */ + collector()->collect(full, clear_all_soft_refs, size, tlab); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__end, full, clear_all_soft_refs, size, tlab); ++#endif /* !USDT2 */ + } + + void CMSCollector::collect(bool full, +diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2013-02-15 15:15:19.137175167 +0000 +@@ -45,8 +45,13 @@ + #include "runtime/thread.hpp" + #include "runtime/vmThread.hpp" + #include "utilities/copy.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/events.hpp" + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__G1__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__G1__end, *uintptr_t, *uintptr_t); ++ #endif /* !USDT2 */ + class HeapRegion; + + void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, +@@ -84,6 +89,9 @@ + // The marking doesn't preserve the marks of biased objects. + BiasedLocking::preserve_marks(); + ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__G1__begin, &sh, sh->gc_cause()); ++#endif /* !USDT2 */ + mark_sweep_phase1(marked_for_unloading, clear_all_softrefs); + + mark_sweep_phase2(); +@@ -103,6 +111,9 @@ + GenRemSet* rs = sh->rem_set(); + rs->invalidate(sh->perm_gen()->used_region(), true /*whole_heap*/); + ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__G1__end, &sh, sh->gc_cause()); ++#endif /* !USDT2 */ + // "free at last gc" is calculated from these. + // CHF: cheating for now!!! + // Universe::set_heap_capacity_at_last_gc(Universe::heap()->capacity()); +diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp 2013-02-15 15:15:19.157175488 +0000 +@@ -40,8 +40,14 @@ + #include "runtime/handles.inline.hpp" + #include "runtime/java.hpp" + #include "runtime/vmThread.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/vmError.hpp" + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parscavenge__heap__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parscavenge__heap__end, *uintptr_t, *uintptr_t); ++#endif /* !USDT2 */ ++ + PSYoungGen* ParallelScavengeHeap::_young_gen = NULL; + PSOldGen* ParallelScavengeHeap::_old_gen = NULL; + PSPermGen* ParallelScavengeHeap::_perm_gen = NULL; +@@ -806,7 +812,13 @@ + } + + VM_ParallelGCSystemGC op(gc_count, full_gc_count, cause); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__parscavenge__heap__begin, &op, cause); ++#endif /* !USDT2 */ + VMThread::execute(&op); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__parscavenge__heap__end, &op, cause); ++#endif /* !USDT2 */ + } + + // This interface assumes that it's being called by the +diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2013-02-15 15:15:19.137175167 +0000 +@@ -53,11 +53,18 @@ + #include "runtime/vmThread.hpp" + #include "services/management.hpp" + #include "services/memoryService.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/events.hpp" + #include "utilities/stack.inline.hpp" + + #include <math.h> + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__ParallelCompact__clear, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parallel__collect, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__move, *uintptr_t, *uintptr_t, *uintptr_t, *uintptr_t); ++#endif /* !USDT2 */ ++ + // All sizes are in HeapWords. + const size_t ParallelCompactData::Log2RegionSize = 9; // 512 words + const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize; +@@ -432,6 +439,9 @@ + + void ParallelCompactData::clear() + { ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__ParallelCompact__clear, &_region_data, _region_data->data_location()); ++#endif /* !USDT2 */ + memset(_region_data, 0, _region_vspace->committed_size()); + } + +@@ -1969,6 +1979,9 @@ + "should be in vm thread"); + + ParallelScavengeHeap* heap = gc_heap(); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__parallel__collect, heap, heap->gc_cause()); ++#endif /* !USDT2 */ + GCCause::Cause gc_cause = heap->gc_cause(); + assert(!heap->is_gc_active(), "not reentrant"); + +@@ -3375,6 +3388,9 @@ + // past the end of the partial object entering the region (if any). + HeapWord* const dest_addr = sd.partial_obj_end(dp_region); + HeapWord* const new_top = _space_info[space_id].new_top(); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__move, &beg_addr, &end_addr, &dest_addr, &new_top); ++#endif /* !USDT2 */ + assert(new_top >= dest_addr, "bad new_top value"); + const size_t words = pointer_delta(new_top, dest_addr); + +diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp 2013-02-15 15:17:54.795682059 +0000 +@@ -51,8 +51,17 @@ + #include "runtime/vmThread.hpp" + #include "runtime/vm_operations.hpp" + #include "services/memoryService.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/stack.inline.hpp" + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSScavenge__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSScavenge__end, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSParallelCompact__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSParallelCompact__end, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSMarkSweep__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSMarkSweep__end, *uintptr_t, *uintptr_t); ++#endif /* !USDT2 */ + + HeapWord* PSScavenge::_to_space_top_before_gc = NULL; + int PSScavenge::_consecutive_skipped_scavenges = 0; +@@ -226,7 +235,13 @@ + PSAdaptiveSizePolicy* policy = heap->size_policy(); + IsGCActiveMark mark; + ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSScavenge__begin, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + const bool scavenge_done = PSScavenge::invoke_no_policy(); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSScavenge__end, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + const bool need_full_gc = !scavenge_done || + policy->should_full_GC(heap->old_gen()->free_in_bytes()); + bool full_gc_done = false; +@@ -243,9 +258,21 @@ + const bool clear_all_softrefs = cp->should_clear_all_soft_refs(); + + if (UseParallelOldGC) { ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSParallelCompact__begin, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + full_gc_done = PSParallelCompact::invoke_no_policy(clear_all_softrefs); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSParallelCompact__end, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + } else { ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSMarkSweep__begin, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + full_gc_done = PSMarkSweep::invoke_no_policy(clear_all_softrefs); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSMarkSweep__end, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + } + } + +diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2013-02-15 15:15:19.141175230 +0000 +@@ -49,6 +49,12 @@ + #include "utilities/copy.hpp" + #include "utilities/globalDefinitions.hpp" + #include "utilities/workgroup.hpp" ++#include "utilities/dtrace.hpp" ++ ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__parnew__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__parnew__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ + + #ifdef _MSC_VER + #pragma warning( push ) +@@ -878,6 +884,9 @@ + bool clear_all_soft_refs, + size_t size, + bool is_tlab) { ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__parnew__begin, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + assert(full || size > 0, "otherwise we don't want to collect"); + GenCollectedHeap* gch = GenCollectedHeap::heap(); + assert(gch->kind() == CollectedHeap::GenCollectedHeap, +@@ -1032,6 +1041,10 @@ + gch->print_heap_change(gch_prev_used); + } + ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__parnew__end, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ ++ + if (PrintGCDetails && ParallelGCVerbose) { + TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats()); + TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats()); +diff -Nru openjdk.orig/hotspot/src/share/vm/memory/defNewGeneration.cpp openjdk/hotspot/src/share/vm/memory/defNewGeneration.cpp +--- openjdk.orig/hotspot/src/share/vm/memory/defNewGeneration.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/memory/defNewGeneration.cpp 2013-02-15 15:16:15.374080867 +0000 +@@ -38,6 +38,7 @@ + #include "oops/oop.inline.hpp" + #include "runtime/java.hpp" + #include "utilities/copy.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/stack.inline.hpp" + #ifdef TARGET_OS_FAMILY_linux + # include "thread_linux.inline.hpp" +@@ -52,6 +53,11 @@ + # include "thread_bsd.inline.hpp" + #endif + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__defnew__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__defnew__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ ++ + // + // DefNewGeneration functions. + +@@ -528,6 +534,9 @@ + bool clear_all_soft_refs, + size_t size, + bool is_tlab) { ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__defnew__begin, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + assert(full || size > 0, "otherwise we don't want to collect"); + GenCollectedHeap* gch = GenCollectedHeap::heap(); + _next_gen = gch->next_gen(this); +@@ -661,6 +670,9 @@ + // does not guarantee monotonicity. + jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; + update_time_of_last_gc(now); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__defnew__end, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + } + + class RemoveForwardPointerClosure: public ObjectClosure { +diff -Nru openjdk.orig/hotspot/src/share/vm/memory/generation.cpp openjdk/hotspot/src/share/vm/memory/generation.cpp +--- openjdk.orig/hotspot/src/share/vm/memory/generation.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/memory/generation.cpp 2013-02-15 15:15:19.157175488 +0000 +@@ -39,8 +39,14 @@ + #include "oops/oop.inline.hpp" + #include "runtime/java.hpp" + #include "utilities/copy.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/events.hpp" + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ ++ + Generation::Generation(ReservedSpace rs, size_t initial_size, int level) : + _level(level), + _ref_processor(NULL) { +@@ -470,7 +476,13 @@ + // refs discovery is over the entire heap, not just this generation + ReferenceProcessorSpanMutator + x(ref_processor(), GenCollectedHeap::heap()->reserved_region()); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__begin, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__end, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + SpecializationStats::print(); + } + +diff -Nru openjdk.orig/hotspot/src/share/vm/memory/tenuredGeneration.cpp openjdk/hotspot/src/share/vm/memory/tenuredGeneration.cpp +--- openjdk.orig/hotspot/src/share/vm/memory/tenuredGeneration.cpp 2013-02-11 23:08:47.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/memory/tenuredGeneration.cpp 2013-02-15 15:15:19.137175167 +0000 +@@ -33,6 +33,12 @@ + #include "memory/tenuredGeneration.hpp" + #include "oops/oop.inline.hpp" + #include "runtime/java.hpp" ++#include "utilities/dtrace.hpp" ++ ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__tenured__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__tenured__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ + + TenuredGeneration::TenuredGeneration(ReservedSpace rs, + size_t initial_byte_size, int level, +@@ -307,8 +313,14 @@ + size_t size, + bool is_tlab) { + retire_alloc_buffers_before_full_gc(); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__tenured__begin, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + OneContigSpaceCardGeneration::collect(full, clear_all_soft_refs, + size, is_tlab); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__tenured__end, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + } + + void TenuredGeneration::update_gc_stats(int current_level,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/7197906-handle_32_bit_shifts.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,33 @@ +--- openjdk/hotspot/src/share/vm/memory/blockOffsetTable.hpp 2012-09-13 21:22:37.897456500 +0200 ++++ openjdk/hotspot/src/share/vm/memory/blockOffsetTable.hpp 2012-09-13 21:22:34.345253300 +0200 +@@ -285,7 +285,7 @@ + }; + + static size_t power_to_cards_back(uint i) { +- return (size_t)(1 << (LogBase * i)); ++ return (size_t)1 << (LogBase * i); + } + static size_t power_to_words_back(uint i) { + return power_to_cards_back(i) * N_words; +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2012-09-13 21:22:37.901456800 +0200 ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2012-09-13 21:22:34.354253900 +0200 +@@ -110,7 +110,7 @@ + #ifndef PRODUCT + bool CMBitMapRO::covers(ReservedSpace rs) const { + // assert(_bm.map() == _virtual_space.low(), "map inconsistency"); +- assert(((size_t)_bm.size() * (size_t)(1 << _shifter)) == _bmWordSize, ++ assert(((size_t)_bm.size() * ((size_t)1 << _shifter)) == _bmWordSize, + "size inconsistency"); + return _bmStartWord == (HeapWord*)(rs.base()) && + _bmWordSize == rs.size()>>LogHeapWordSize; +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2012-09-13 21:22:37.898456600 +0200 ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2012-09-13 21:22:34.346253400 +0200 +@@ -273,7 +273,7 @@ + if (_max_fine_entries == 0) { + assert(_mod_max_fine_entries_mask == 0, "Both or none."); + size_t max_entries_log = (size_t)log2_long((jlong)G1RSetRegionEntries); +- _max_fine_entries = (size_t)(1 << max_entries_log); ++ _max_fine_entries = (size_t)1 << max_entries_log; + _mod_max_fine_entries_mask = _max_fine_entries - 1; + + assert(_fine_eviction_sample_size == 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/arm-hsdis.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,90 @@ +2012-01-20 Andrew Haley <aph@redhat.com> + + * Makefile (ARCH): Add entry for armv7l. + (CFLAGS): Enable debugging. + ($(LIBRARIES)): Pass CFLAGS to sub-make. + * hsdis.c: Include string.h. + (parse_caller_options): Fix strncmp bug. + (native_arch_name): Add entry for ARM. + +diff -u openjdk/hotspot/src/share/tools/hsdis/hsdis.c ../icedtea6/openjdk/hotspot/src/share/tools/hsdis/hsdis.c +--- openjdk/hotspot/src/share/tools/hsdis/hsdis.c 2011-11-14 17:07:33.000000000 -0500 ++++ openjdk/hotspot/src/share/tools/hsdis/hsdis.c 2012-01-20 10:21:28.000000000 -0500 +@@ -22,8 +22,6 @@ + * + */ + +-#include "precompiled.hpp" +- + /* hsdis.c -- dump a range of addresses as native instructions + This implements the plugin protocol required by the + HotSpot PrintAssembly option. +@@ -37,6 +35,8 @@ + #include <dis-asm.h> + #include <inttypes.h> + ++#include <string.h> ++ + #ifndef bool + #define bool int + #define true 1 +@@ -358,7 +358,7 @@ + if (plen > mach_size) plen = mach_size; + strncpy(mach_option, p, plen); + mach_option[plen] = '\0'; +- } else if (plen > 6 && strncmp(p, "hsdis-", 6)) { ++ } else if (plen > 6 && !strncmp(p, "hsdis-", 6)) { + // do not pass these to the next level + } else { + /* just copy it; {i386,sparc}-dis.c might like to see it */ +@@ -420,6 +420,9 @@ + #ifdef LIBARCH_sparcv9 + res = "sparc:v9b"; + #endif ++#ifdef LIBARCH_arm ++ res = "arm"; ++#endif + if (res == NULL) + res = "architecture not set in Makefile!"; + return res; +diff -u openjdk/hotspot/src/share/tools/hsdis/Makefile openjdk/hotspot/src/share/tools/hsdis/Makefile +--- openjdk/hotspot/src/share/tools/hsdis/Makefile 2011-11-14 17:07:33.000000000 -0500 ++++ openjdk/hotspot/src/share/tools/hsdis/Makefile 2012-01-20 10:20:32.000000000 -0500 +@@ -68,14 +68,18 @@ + CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW) + else + CPU = $(shell uname -m) ++ifneq ($(findstring arm,$(CPU)),) ++ARCH=arm ++else + ARCH1=$(CPU:x86_64=amd64) + ARCH=$(ARCH1:i686=i386) + CFLAGS/i386 += -m32 + CFLAGS/sparc += -m32 + CFLAGS/sparcv9 += -m64 + CFLAGS/amd64 += -m64 ++endif + CFLAGS += $(CFLAGS/$(ARCH)) +-CFLAGS += -fPIC ++CFLAGS += -fPIC -g + OS = linux + LIB_EXT = .so + CC = gcc +@@ -118,7 +122,7 @@ + BINUTILSDIR = $(shell cd $(BINUTILS);pwd) + endif + +-CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILS)/bfd -I$(TARGET_DIR)/bfd ++CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILSDIR)/bfd -I$(TARGET_DIR)/bfd + CPPFLAGS += -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\" + + TARGET_DIR = build/$(OS)-$(JDKARCH) +@@ -145,7 +149,7 @@ + demo: $(TARGET) $(DEMO_TARGET) + + $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile +- if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi ++ if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes "CFLAGS=$(CFLAGS)"; fi + + $(TARGET_DIR)/Makefile: + (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/fix_get_stack_bounds_leak.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,12 @@ +diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp +--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp +@@ -2650,6 +2650,8 @@ + ssize_t len = getline(&str, &dummy, f); + if (len == -1) { + fclose(f); ++ if (str != NULL) ++ free(str); + return false; + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/pr639-broken_shark_build.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,44 @@ +--- openjdk.orig/hotspot/src/share/vm/ci/ciTypeFlow.cpp 2011-01-25 22:57:24.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/ci/ciTypeFlow.cpp 2011-02-24 00:28:58.000000000 +0000 +@@ -37,6 +37,9 @@ + #include "memory/allocation.inline.hpp" + #include "runtime/deoptimization.hpp" + #include "utilities/growableArray.hpp" ++#ifdef SHARK ++#include "shark/shark_globals.hpp" ++#endif + + // ciTypeFlow::JsrSet + // +--- openjdk.orig/hotspot/make/linux/makefiles/vm.make 2011-02-23 21:28:45.000000000 +0000 ++++ openjdk/hotspot/make/linux/makefiles/vm.make 2011-02-24 02:17:30.000000000 +0000 +@@ -139,13 +139,15 @@ + COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt + COMPILER2_PATHS += $(GENERATED)/adfiles + ++SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark ++ + # Include dirs per type. + Src_Dirs/CORE := $(CORE_PATHS) + Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) + Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) + Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) + Src_Dirs/ZERO := $(CORE_PATHS) +-Src_Dirs/SHARK := $(CORE_PATHS) ++Src_Dirs/SHARK := $(CORE_PATHS) $(SHARK_PATHS) + Src_Dirs := $(Src_Dirs/$(TYPE)) + + COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp chaitin\* c2_\* runtime_\* +--- openjdk.orig/hotspot/make/linux/makefiles/launcher.make 2011-02-22 16:51:24.000000000 +0000 ++++ openjdk/hotspot/make/linux/makefiles/launcher.make 2011-02-24 03:01:36.000000000 +0000 +@@ -52,6 +52,10 @@ + LAUNCHER.o = launcher.o + LFLAGS_LAUNCHER += -L `pwd` + LIBS_LAUNCHER += -l$(JVM) $(LIBS) ++ ifeq ($(SHARK_BUILD), true) ++ LFLAGS_LAUNCHER += $(LLVM_LDFLAGS) ++ LIBS_LAUNCHER += $(LLVM_LIBS) ++ endif + endif + + LINK_LAUNCHER = $(LINK.c)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/sdt-arguments.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,24 @@ +diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp openjdk/hotspot/src/share/vm/runtime/arguments.cpp +--- openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp 2010-08-27 20:30:51.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp 2010-08-27 22:37:45.261818795 +0100 +@@ -2460,16 +2460,16 @@ + FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); + FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true); + } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) { +-#ifdef SOLARIS ++#ifdef DTRACE_ENABLED + FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true); + FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true); + FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true); + FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true); +-#else // ndef SOLARIS ++#else // ndef DTRACE_ENABLED + jio_fprintf(defaultStream::error_stream(), +- "ExtendedDTraceProbes flag is only applicable on Solaris\n"); ++ "ExtendedDTraceProbes flag is only applicable on dtrace enabled builds\n"); + return JNI_EINVAL; +-#endif // ndef SOLARIS ++#endif // ndef DTRACE_ENABLED + #ifdef ASSERT + } else if (match_option(option, "-XX:+FullGCALot", &tail)) { + FLAG_SET_CMDLINE(bool, FullGCALot, true);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/sdt-dtrace-hpp.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,103 @@ +# 7170638: Define DTRACE macros for use with GNU/Linux SystemTap sys/sdt.h. +# Summary: LINUX also uses USDT1, but with macros instead of function decls. +# Contributed-by: Mark Wielaard <mjw@redhat.com> + +--- openjdk/hotspot/src/share/vm/utilities/dtrace.hpp 2012-07-21 11:01:40.836101766 +0200 ++++ openjdk/hotspot/src/share/vm/utilities/dtrace.hpp 2012-07-21 11:01:40.741100325 +0200 +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2009, 2012 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,7 +26,7 @@ + #ifndef SHARE_VM_UTILITIES_DTRACE_HPP + #define SHARE_VM_UTILITIES_DTRACE_HPP + +-#if defined(SOLARIS) && defined(DTRACE_ENABLED) ++#if defined(DTRACE_ENABLED) + + #include <sys/sdt.h> + +@@ -36,7 +37,7 @@ + #define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() \ + do { volatile size_t dtrace_workaround_tail_call_bug = 1; } while (0) + +-#else // ndef SOLARIS || ndef DTRACE_ENABLED ++#else // ndef DTRACE_ENABLED + + #define DTRACE_ONLY(x) + #define NOT_DTRACE(x) x +@@ -47,11 +48,18 @@ + #define DTRACE_PROBE3(a,b,c,d,e) {;} + #define DTRACE_PROBE4(a,b,c,d,e,f) {;} + #define DTRACE_PROBE5(a,b,c,d,e,f,g) {;} ++#define DTRACE_PROBE6(a,b,c,d,e,f,g,h) {;} ++#define DTRACE_PROBE7(a,b,c,d,e,f,g,h,i) {;} ++#define DTRACE_PROBE8(a,b,c,d,e,f,g,h,i,j) {;} ++#define DTRACE_PROBE9(a,b,c,d,e,f,g,h,i,j,k) {;} ++#define DTRACE_PROBE10(a,b,c,d,e,f,g,h,i,j,k,l) {;} + + #define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() + + #endif + ++#if defined(SOLARIS) ++// Solaris dtrace needs actual extern function decls. + #define HS_DTRACE_PROBE_FN(provider,name)\ + __dtrace_##provider##___##name + +@@ -59,6 +67,11 @@ + DTRACE_ONLY(extern "C" void HS_DTRACE_PROBE_FN(provider,name) args) + #define HS_DTRACE_PROBE_CDECL_N(provider,name,args) \ + DTRACE_ONLY(extern void HS_DTRACE_PROBE_FN(provider,name) args) ++#else ++// Systemtap dtrace compatible probes on GNU/Linux don't. ++#define HS_DTRACE_PROBE_DECL_N(provider,name,args) ++#define HS_DTRACE_PROBE_CDECL_N(provider,name,args) ++#endif + + /* Dtrace probe declarations */ + #define HS_DTRACE_PROBE_DECL(provider,name) \ +@@ -97,6 +110,8 @@ + uintptr_t,uintptr_t,uintptr_t)) + + /* Dtrace probe definitions */ ++#if defined(SOLARIS) ++// Solaris dtrace uses actual function calls. + #define HS_DTRACE_PROBE_N(provider,name, args) \ + DTRACE_ONLY(HS_DTRACE_PROBE_FN(provider,name) args) + +@@ -132,5 +147,31 @@ + HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ + (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7,\ + (uintptr_t)a8,(uintptr_t)a9)) ++#else ++// Systemtap dtrace compatible probes on GNU/Linux use direct macros. ++#define HS_DTRACE_PROBE(provider,name) HS_DTRACE_PROBE0(provider,name) ++#define HS_DTRACE_PROBE0(provider,name)\ ++ DTRACE_PROBE(provider,name) ++#define HS_DTRACE_PROBE1(provider,name,a0)\ ++ DTRACE_PROBE1(provider,name,a0) ++#define HS_DTRACE_PROBE2(provider,name,a0,a1)\ ++ DTRACE_PROBE2(provider,name,a0,a1) ++#define HS_DTRACE_PROBE3(provider,name,a0,a1,a2)\ ++ DTRACE_PROBE3(provider,name,a0,a1,a2) ++#define HS_DTRACE_PROBE4(provider,name,a0,a1,a2,a3)\ ++ DTRACE_PROBE4(provider,name,a0,a1,a2,a3) ++#define HS_DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4)\ ++ DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4) ++#define HS_DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5)\ ++ DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5) ++#define HS_DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6)\ ++ DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6) ++#define HS_DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7)\ ++ DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7) ++#define HS_DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ ++ DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) ++#define HS_DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ ++ DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) ++#endif + + #endif // SHARE_VM_UTILITIES_DTRACE_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/sdt-jni.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,37 @@ +# 7170638: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field. +# Summary: Don't use HS_DTRACE_PROBE_CDECL_N and HS_DTRACE_PROBE_N directly. +# Contributed-by: Mark Wielaard <mjw@redhat.com> + +--- openjdk/hotspot/src/share/vm/prims/jni.cpp 2012-07-21 11:00:27.793993673 +0200 ++++ openjdk/hotspot/src/share/vm/prims/jni.cpp 2012-07-21 11:00:27.685992034 +0200 +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2012 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -1817,10 +1818,7 @@ + JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID fieldID, Argument value)) \ + JNIWrapper("Set" XSTR(Result) "Field"); \ + \ +- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, Set##Result##Field__entry, \ +- ( JNIEnv*, jobject, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ +- HS_DTRACE_PROBE_N(hotspot_jni, Set##Result##Field__entry, \ +- ( env, obj, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ ++ FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID, value),DTRACE_PROBE3(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID)); \ + \ + oop o = JNIHandles::resolve_non_null(obj); \ + klassOop k = o->klass(); \ +@@ -1992,10 +1990,7 @@ + \ + JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID fieldID, Argument value)) \ + JNIWrapper("SetStatic" XSTR(Result) "Field"); \ +- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, SetStatic##Result##Field__entry,\ +- ( JNIEnv*, jclass, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ +- HS_DTRACE_PROBE_N(hotspot_jni, SetStatic##Result##Field__entry, \ +- ( env, clazz, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ ++ FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID, value),DTRACE_PROBE3(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID)); \ + \ + JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); \ + assert(id->is_static_field_id(), "invalid static field id"); \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/sdt-make.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,51 @@ +# 7170638: Enable dtrace compatible sdt probes on GNU/Linux builds. +# Summary: If sys/sdt.h is found, then enable dtrace compatible sdt probes. +# Contributed-by: Mark Wielaard <mjw@redhat.com> + +--- openjdk/hotspot/make/linux/makefiles/dtrace.make 2012-07-21 11:02:17.926664397 +0200 ++++ openjdk/hotspot/make/linux/makefiles/dtrace.make 2012-07-21 11:02:17.829662925 +0200 +@@ -1,5 +1,6 @@ + # + # Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2012 Red Hat, Inc. + # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + # + # This code is free software; you can redistribute it and/or modify it +@@ -25,3 +26,26 @@ + # Linux does not build jvm_db + LIBJVM_DB = + ++# But it does have a SystemTap dtrace compatible sys/sdt.h ++ifneq ($(ALT_SDT_H),) ++ SDT_H_FILE = $(ALT_SDT_H) ++else ++ SDT_H_FILE = /usr/include/sys/sdt.h ++endif ++DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE)) ++ ++ifneq ($(DTRACE_ENABLED),) ++ CFLAGS += -DDTRACE_ENABLED ++endif ++ ++# Phone target used in vm.make build target to check whether enabled. ++.PHONY: dtraceCheck ++ifeq ($(DTRACE_ENABLED),) ++dtraceCheck: ++ $(QUIETLY) echo "**NOTICE** Dtrace support disabled $(SDT_H_FILE) not found" ++else ++dtraceCheck: ++endif ++ ++# It doesn't support HAVE_DTRACE_H though. ++ +--- openjdk/hotspot/make/linux/makefiles/vm.make 2012-07-21 11:02:18.480672801 +0200 ++++ openjdk/hotspot/make/linux/makefiles/vm.make 2012-07-21 11:02:18.384671344 +0200 +@@ -387,7 +387,7 @@ + + #---------------------------------------------------------------------- + +-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) ++build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck + + install: install_jvm install_jsig install_saproc +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/systemtap-alloc-size-workaround.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,17 @@ +Generating a dwarf location expression for variable * "constant" as used +in this probe argument triggers unforseen complications. See +https://bugzilla.redhat.com/show_bug.cgi?id=613824 +Workaround for now by passing the size without HeapWordSize adjustment. +See also the hotspot.object_alloc in tapset/hotspot.stp[.in]. + +--- openjdk.orig/hotspot/src/share/vm/runtime/sharedRuntime.cpp 2010-05-18 20:00:22.130618755 +0200 ++++ openjdk/hotspot/src/share/vm/runtime/sharedRuntime.cpp 2010-07-28 22:53:23.662310007 +0200 +@@ -711,7 +711,7 @@ + int size = o->size(); + symbolOop name = klass->name(); + HS_DTRACE_PROBE4(hotspot, object__alloc, get_java_tid(thread), +- name->bytes(), name->utf8_length(), size * HeapWordSize); ++ name->bytes(), name->utf8_length(), size); + return 0; + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/systemtap_gc.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,369 @@ +--- openjdk.orig/hotspot/src/share/vm/compiler/oopMap.cpp 2012-06-26 09:24:22.390325184 -0400 ++++ openjdk/hotspot/src/share/vm/compiler/oopMap.cpp 2012-07-06 10:12:44.981413003 -0400 +@@ -33,9 +33,13 @@ + #include "memory/resourceArea.hpp" + #include "runtime/frame.inline.hpp" + #include "runtime/signature.hpp" ++#include "utilities/dtrace.hpp" + #ifdef COMPILER1 + #include "c1/c1_Defs.hpp" + #endif ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL1(provider, gc__collection__delete, *uintptr_t); ++#endif /* !USDT2 */ + + // OopMapStream + +@@ -677,6 +681,9 @@ + " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: %d)", + derived_loc, (address)*derived_loc, (address)base, offset); + } ++#ifndef USDT2 ++ HS_DTRACE_PROBE1(hotspot, gc__collection__delete, entry); ++#endif /* !USDT2 */ + + // Delete entry + delete entry; +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2012-07-12 09:48:40.349999515 -0400 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2012-07-19 18:38:07.560757426 -0400 +@@ -53,11 +53,18 @@ + #include "runtime/vmThread.hpp" + #include "services/management.hpp" + #include "services/memoryService.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/events.hpp" + #include "utilities/stack.inline.hpp" + + #include <math.h> + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__ParallelCompact__clear, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parallel__collect, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__move, *uintptr_t, *uintptr_t, *uintptr_t, *uintptr_t); ++#endif /* !USDT2 */ ++ + // All sizes are in HeapWords. + const size_t ParallelCompactData::Log2RegionSize = 9; // 512 words + const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize; +@@ -433,6 +439,9 @@ + + void ParallelCompactData::clear() + { ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__ParallelCompact__clear, &_region_data, _region_data->data_location()); ++#endif /* !USDT2 */ + memset(_region_data, 0, _region_vspace->committed_size()); + } + +@@ -1970,6 +1979,9 @@ + "should be in vm thread"); + + ParallelScavengeHeap* heap = gc_heap(); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__parallel__collect, heap, heap->gc_cause()); ++#endif /* !USDT2 */ + GCCause::Cause gc_cause = heap->gc_cause(); + assert(!heap->is_gc_active(), "not reentrant"); + +@@ -3376,6 +3388,9 @@ + // past the end of the partial object entering the region (if any). + HeapWord* const dest_addr = sd.partial_obj_end(dp_region); + HeapWord* const new_top = _space_info[space_id].new_top(); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__move, &beg_addr, &end_addr, &dest_addr, &new_top); ++#endif /* !USDT2 */ + assert(new_top >= dest_addr, "bad new_top value"); + const size_t words = pointer_delta(new_top, dest_addr); + +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2012-08-15 12:04:43.837439833 -0400 ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2012-08-15 12:01:47.897745719 -0400 +@@ -45,8 +45,13 @@ + #include "runtime/thread.hpp" + #include "runtime/vmThread.hpp" + #include "utilities/copy.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/events.hpp" + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__G1__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__G1__end, *uintptr_t, *uintptr_t); ++ #endif /* !USDT2 */ + class HeapRegion; + + void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, +@@ -84,6 +89,9 @@ + // The marking doesn't preserve the marks of biased objects. + BiasedLocking::preserve_marks(); + ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__G1__begin, &sh, sh->gc_cause()); ++#endif /* !USDT2 */ + mark_sweep_phase1(marked_for_unloading, clear_all_softrefs); + + mark_sweep_phase2(); +@@ -103,6 +111,9 @@ + GenRemSet* rs = sh->rem_set(); + rs->invalidate(sh->perm_gen()->used_region(), true /*whole_heap*/); + ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__G1__end, &sh, sh->gc_cause()); ++#endif /* !USDT2 */ + // "free at last gc" is calculated from these. + // CHF: cheating for now!!! + // Universe::set_heap_capacity_at_last_gc(Universe::heap()->capacity()); +--- openjdk.orig/hotspot/src/share/vm/memory/tenuredGeneration.cpp 2012-08-15 12:03:43.009543167 -0400 ++++ openjdk/hotspot/src/share/vm/memory/tenuredGeneration.cpp 2012-08-15 12:14:25.414381449 -0400 +@@ -33,6 +33,12 @@ + #include "memory/tenuredGeneration.hpp" + #include "oops/oop.inline.hpp" + #include "runtime/java.hpp" ++#include "utilities/dtrace.hpp" ++ ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__tenured__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__tenured__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ + + TenuredGeneration::TenuredGeneration(ReservedSpace rs, + size_t initial_byte_size, int level, +@@ -307,8 +313,14 @@ + size_t size, + bool is_tlab) { + retire_alloc_buffers_before_full_gc(); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__tenured__begin, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + OneContigSpaceCardGeneration::collect(full, clear_all_soft_refs, + size, is_tlab); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__tenured__end, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + } + + void TenuredGeneration::update_gc_stats(int current_level, +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2012-08-15 12:03:43.039543116 -0400 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2012-08-15 12:18:57.181932342 -0400 +@@ -49,6 +49,12 @@ + #include "utilities/copy.hpp" + #include "utilities/globalDefinitions.hpp" + #include "utilities/workgroup.hpp" ++#include "utilities/dtrace.hpp" ++ ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__parnew__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__parnew__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ + + #ifdef _MSC_VER + #pragma warning( push ) +@@ -878,6 +884,9 @@ + bool clear_all_soft_refs, + size_t size, + bool is_tlab) { ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__parnew__begin, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + assert(full || size > 0, "otherwise we don't want to collect"); + GenCollectedHeap* gch = GenCollectedHeap::heap(); + assert(gch->kind() == CollectedHeap::GenCollectedHeap, +@@ -1032,6 +1041,10 @@ + gch->print_heap_change(gch_prev_used); + } + ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__parnew__end, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ ++ + if (PrintGCDetails && ParallelGCVerbose) { + TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats()); + TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats()); +--- openjdk.orig/hotspot/src/share/vm/memory/defNewGeneration.cpp 2012-08-15 12:03:43.010543164 -0400 ++++ openjdk/hotspot/src/share/vm/memory/defNewGeneration.cpp 2012-08-15 12:21:41.076673646 -0400 +@@ -38,6 +38,7 @@ + #include "oops/oop.inline.hpp" + #include "runtime/java.hpp" + #include "utilities/copy.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/stack.inline.hpp" + #ifdef TARGET_OS_FAMILY_linux + # include "thread_linux.inline.hpp" +@@ -51,7 +52,10 @@ + #ifdef TARGET_OS_FAMILY_windows + # include "thread_windows.inline.hpp" + #endif +- ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__defnew__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__defnew__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ + // + // DefNewGeneration functions. + +@@ -528,6 +532,9 @@ + bool clear_all_soft_refs, + size_t size, + bool is_tlab) { ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__defnew__begin, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + assert(full || size > 0, "otherwise we don't want to collect"); + GenCollectedHeap* gch = GenCollectedHeap::heap(); + _next_gen = gch->next_gen(this); +@@ -661,6 +668,10 @@ + to()->set_concurrent_iteration_safe_limit(to()->top()); + SpecializationStats::print(); + update_time_of_last_gc(os::javaTimeMillis()); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__defnew__end, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ ++ + } + + class RemoveForwardPointerClosure: public ObjectClosure { +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2012-08-15 12:03:43.044543106 -0400 ++++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2012-08-15 12:25:26.632316692 -0400 +@@ -55,6 +55,12 @@ + #include "runtime/vmThread.hpp" + #include "services/memoryService.hpp" + #include "services/runtimeService.hpp" ++#include "utilities/dtrace.hpp" ++ ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ + + // statics + CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; +@@ -1647,7 +1653,13 @@ + size_t size, + bool tlab) + { ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__begin, full, clear_all_soft_refs, size, tlab); ++#endif /* !USDT2 */ + collector()->collect(full, clear_all_soft_refs, size, tlab); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__end, full, clear_all_soft_refs, size, tlab); ++#endif /* !USDT2 */ + } + + void CMSCollector::collect(bool full, +--- openjdk.orig/hotspot/src/share/vm/memory/generation.cpp 2012-08-15 12:03:43.009543167 -0400 ++++ openjdk/hotspot/src/share/vm/memory/generation.cpp 2012-08-15 12:27:46.378095083 -0400 +@@ -39,8 +39,14 @@ + #include "oops/oop.inline.hpp" + #include "runtime/java.hpp" + #include "utilities/copy.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/events.hpp" + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__begin, bool, bool, size_t, bool); ++ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__end, bool, bool, size_t, bool); ++#endif /* !USDT2 */ ++ + Generation::Generation(ReservedSpace rs, size_t initial_size, int level) : + _level(level), + _ref_processor(NULL) { +@@ -470,7 +476,13 @@ + // refs discovery is over the entire heap, not just this generation + ReferenceProcessorSpanMutator + x(ref_processor(), GenCollectedHeap::heap()->reserved_region()); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__begin, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs); ++#ifndef USDT2 ++ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__end, full, clear_all_soft_refs, size, is_tlab); ++#endif /* !USDT2 */ + SpecializationStats::print(); + } + +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp 2012-07-25 13:24:07.000000000 -0400 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp 2012-08-17 10:26:44.181117802 -0400 +@@ -51,8 +51,17 @@ + #include "runtime/vmThread.hpp" + #include "runtime/vm_operations.hpp" + #include "services/memoryService.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/stack.inline.hpp" + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSScavenge__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSScavenge__end, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSParallelCompact__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSParallelCompact__end, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSMarkSweep__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSMarkSweep__end, *uintptr_t, *uintptr_t); ++#endif /* !USDT2 */ + + HeapWord* PSScavenge::_to_space_top_before_gc = NULL; + int PSScavenge::_consecutive_skipped_scavenges = 0; +@@ -226,7 +235,13 @@ + PSAdaptiveSizePolicy* policy = heap->size_policy(); + IsGCActiveMark mark; + ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSScavenge__begin, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + bool scavenge_was_done = PSScavenge::invoke_no_policy(); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSScavenge__end, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + + PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); + if (UsePerfData) +@@ -243,9 +258,21 @@ + const bool clear_all_softrefs = cp->should_clear_all_soft_refs(); + + if (UseParallelOldGC) { ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSParallelCompact__begin, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + PSParallelCompact::invoke_no_policy(clear_all_softrefs); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSParallelCompact__end, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + } else { ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSMarkSweep__begin, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + PSMarkSweep::invoke_no_policy(clear_all_softrefs); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__PSMarkSweep__end, &heap, heap->gc_cause()); ++#endif /* !USDT2 */ + } + } + } +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp 2012-07-25 13:24:07.000000000 -0400 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp 2012-08-31 15:14:23.936576341 -0400 +@@ -40,8 +40,14 @@ + #include "runtime/handles.inline.hpp" + #include "runtime/java.hpp" + #include "runtime/vmThread.hpp" ++#include "utilities/dtrace.hpp" + #include "utilities/vmError.hpp" + ++#ifndef USDT2 ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parscavenge__heap__begin, *uintptr_t, *uintptr_t); ++ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parscavenge__heap__end, *uintptr_t, *uintptr_t); ++#endif /* !USDT2 */ ++ + PSYoungGen* ParallelScavengeHeap::_young_gen = NULL; + PSOldGen* ParallelScavengeHeap::_old_gen = NULL; + PSPermGen* ParallelScavengeHeap::_perm_gen = NULL; +@@ -806,7 +812,13 @@ + } + + VM_ParallelGCSystemGC op(gc_count, full_gc_count, cause); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__parscavenge__heap__begin, &op, cause); ++#endif /* !USDT2 */ + VMThread::execute(&op); ++#ifndef USDT2 ++ HS_DTRACE_PROBE2(hotspot, gc__collection__parscavenge__heap__end, &op, cause); ++#endif /* !USDT2 */ + } + + // This interface assumes that it's being called by the
--- a/patches/no-static-linking.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -diff -r f7afe7a5e086 make/common/shared/Compiler-gcc.gmk ---- openjdk.orig/jdk/make/common/shared/Compiler-gcc.gmk Fri Jan 21 16:21:28 2011 -0800 -+++ openjdk/jdk/make/common/shared/Compiler-gcc.gmk Thu Feb 03 11:34:13 2011 +0000 -@@ -61,7 +61,7 @@ - CC = $(COMPILER_PATH)gcc - CPP = $(COMPILER_PATH)gcc -E - # statically link libstdc++ before C++ ABI is stablized on Linux -- STATIC_CXX = true -+ STATIC_CXX = false - ifeq ($(STATIC_CXX),true) - # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++" - # We need to use gcc to statically link the C++ runtime. gcc and g++ use -diff -r 9797bcda6c12 make/linux/makefiles/vm.make ---- openjdk.orig/hotspot/make/linux/makefiles/vm.make Fri Jan 21 16:20:02 2011 -0800 -+++ openjdk/hotspot/make/linux/makefiles/vm.make Thu Feb 03 15:01:10 2011 +0000 -@@ -137,15 +137,7 @@ - vm.def: $(Res_Files) $(Obj_Files) - sh $(GAMMADIR)/make/linux/makefiles/build_vm_def.sh *.o > $@ - --ifeq ($(SHARK_BUILD), true) -- STATIC_CXX = false --else -- ifeq ($(ZERO_LIBARCH), ppc64) -- STATIC_CXX = false -- else -- STATIC_CXX = true -- endif --endif -+STATIC_CXX = false - - ifeq ($(LINK_INTO),AOUT) - LIBJVM.o = -diff -r 05436b84e93a make/common/shared/Compiler-gcc.gmk ---- openjdk.orig/corba/make/common/shared/Compiler-gcc.gmk Sat Jan 16 01:04:04 2010 +0000 -+++ openjdk/corba/make/common/shared/Compiler-gcc.gmk Thu Feb 03 16:01:37 2011 +0000 -@@ -61,7 +61,7 @@ - CC = $(COMPILER_PATH)gcc - CPP = $(COMPILER_PATH)gcc -E - # statically link libstdc++ before C++ ABI is stablized on Linux -- STATIC_CXX = true -+ STATIC_CXX = false - ifeq ($(STATIC_CXX),true) - # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++" - # We need to use gcc to statically link the C++ runtime. gcc and g++ use
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8007393.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,78 @@ + +# HG changeset patch +# User coffeys +# Date 1360860659 0 +# Node ID 828b93329939ec20530ed98f42b2966b2ea53048 +# Parent cff0241d217f7b463d58ddcd0add8d41de9eb280 +8007393: Possible race condition after JDK-6664509 +Reviewed-by: mchung + +--- openjdk/jdk/src/share/classes/java/util/logging/LogManager.java Tue Feb 05 23:33:50 2013 +0000 ++++ openjdk/jdk/src/share/classes/java/util/logging/LogManager.java Thu Feb 14 16:50:59 2013 +0000 +@@ -411,7 +411,40 @@ public class LogManager { + } + + Logger demandSystemLogger(String name, String resourceBundleName) { +- return systemContext.demandLogger(name, resourceBundleName); ++ // Add a system logger in the system context's namespace ++ final Logger sysLogger = systemContext.demandLogger(name, resourceBundleName); ++ ++ // Add the system logger to the LogManager's namespace if not exist ++ // so that there is only one single logger of the given name. ++ // System loggers are visible to applications unless a logger of ++ // the same name has been added. ++ Logger logger; ++ do { ++ // First attempt to call addLogger instead of getLogger ++ // This would avoid potential bug in custom LogManager.getLogger ++ // implementation that adds a logger if not exists ++ if (addLogger(sysLogger)) { ++ // successfully added the new system logger ++ logger = sysLogger; ++ } else { ++ logger = getLogger(name); ++ } ++ } while (logger == null); ++ ++ // LogManager will set the sysLogger's handlers via LogManager.addLogger method. ++ if (logger != sysLogger && sysLogger.getHandlers().length == 0) { ++ // if logger already exists but handlers not set ++ final Logger l = logger; ++ AccessController.doPrivileged(new PrivilegedAction<Void>() { ++ public Void run() { ++ for (Handler hdl : l.getHandlers()) { ++ sysLogger.addHandler(hdl); ++ } ++ return null; ++ } ++ }); ++ } ++ return sysLogger; + } + + // LoggerContext maintains the logger namespace per context. +@@ -619,22 +652,7 @@ public class LogManager { + } + } while (result == null); + } +- // Add the system logger to the LogManager's namespace if not exists +- // The LogManager will set its handlers via the LogManager.addLogger method. +- if (!manager.addLogger(result) && result.getHandlers().length == 0) { +- // if logger already exists but handlers not set +- final Logger l = manager.getLogger(name); +- final Logger logger = result; +- AccessController.doPrivileged(new PrivilegedAction<Void>() { +- public Void run() { +- for (Handler hdl : l.getHandlers()) { +- logger.addHandler(hdl); +- } +- return null; +- } +- }); +- } +- return result; ++ return result; + } + } + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8007611.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,24 @@ + +# HG changeset patch +# User coffeys +# Date 1360861865 0 +# Node ID 25e83b78298b71abb46eb5a337ed7bddef418ca4 +# Parent 828b93329939ec20530ed98f42b2966b2ea53048 +8007611: logging behavior in applet changed +Reviewed-by: mchung + +--- openjdk/jdk/src/share/classes/java/util/logging/LogManager.java Thu Feb 14 16:50:59 2013 +0000 ++++ openjdk/jdk/src/share/classes/java/util/logging/LogManager.java Thu Feb 14 17:11:05 2013 +0000 +@@ -351,7 +351,10 @@ public class LogManager { + context = userContext; + } else { + context = new LoggerContext(); +- context.addLocalLogger(manager.rootLogger); ++ // during initialization, rootLogger is null when ++ // instantiating itself RootLogger ++ if (manager.rootLogger != null) ++ context.addLocalLogger(manager.rootLogger); + } + javaAwtAccess.put(ecx, LoggerContext.class, context); + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8009641-8007675_build_fix.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,49 @@ +# HG changeset patch +# User bae +# Date 1362669637 -10800 +# Node ID c73944a23b44ead9aa552ffaa4346bda08940ed3 +# Parent 9714f53ef17344fbcb6dc2249a7b238e6292f726 +8009641: OpenJDK 6 build broken via 8007675 fix +Reviewed-by: andrew + +diff --git a/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java b/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java +--- openjdk/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java ++++ openjdk/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java +@@ -572,14 +572,14 @@ + dst, dst.length/getNumOutComponents(), + LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | + LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); ++ ++ synchronized(this) { ++ LCMS.colorConvert(this, srcIL, dstIL); ++ } + } catch (ImageLayoutException e) { + throw new CMMException("Unable to convert data"); + } + +- synchronized(this) { +- LCMS.colorConvert(this, srcIL, dstIL); +- } +- + return dst; + } + +@@ -598,14 +598,14 @@ + dst, dst.length/getNumOutComponents(), + LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | + LCMSImageLayout.BYTES_SH(1), getNumOutComponents()); ++ ++ synchronized(this) { ++ LCMS.colorConvert(this, srcIL, dstIL); ++ } + } catch (ImageLayoutException e) { + throw new CMMException("Unable to convert data"); + } + +- synchronized(this) { +- LCMS.colorConvert(this, srcIL, dstIL); +- } +- + return dst; + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr1319-support_giflib_5.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,29 @@ +# HG changeset patch +# User andrew +# Date 1360886106 0 +# Node ID fd2187713a998a312ee76405f58df3719ec04db1 +# Parent bbfd732ae37d02301b065722f9c7a930118adde3 +PR1319: Support building with giflib 5 + +diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_gif.c b/src/share/native/sun/awt/splashscreen/splashscreen_gif.c +--- openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c ++++ openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c +@@ -316,9 +316,18 @@ + int + SplashDecodeGifStream(Splash * splash, SplashStream * stream) + { ++#ifdef GIFLIB_MAJOR >= 5 ++ int error = 0; ++ GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, &error); ++ ++ if (error) ++ return 0; ++#else + GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc); + + if (!gif) + return 0; ++#endif ++ + return SplashDecodeGif(splash, gif); + }
--- a/patches/pr639-broken_shark_build.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ ---- openjdk.orig/hotspot/src/share/vm/ci/ciTypeFlow.cpp 2011-01-25 22:57:24.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/ci/ciTypeFlow.cpp 2011-02-24 00:28:58.000000000 +0000 -@@ -37,6 +37,9 @@ - #include "memory/allocation.inline.hpp" - #include "runtime/deoptimization.hpp" - #include "utilities/growableArray.hpp" -+#ifdef SHARK -+#include "shark/shark_globals.hpp" -+#endif - - // ciTypeFlow::JsrSet - // ---- openjdk.orig/hotspot/make/linux/makefiles/vm.make 2011-02-23 21:28:45.000000000 +0000 -+++ openjdk/hotspot/make/linux/makefiles/vm.make 2011-02-24 02:17:30.000000000 +0000 -@@ -139,13 +139,15 @@ - COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt - COMPILER2_PATHS += $(GENERATED)/adfiles - -+SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark -+ - # Include dirs per type. - Src_Dirs/CORE := $(CORE_PATHS) - Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) - Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) - Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) - Src_Dirs/ZERO := $(CORE_PATHS) --Src_Dirs/SHARK := $(CORE_PATHS) -+Src_Dirs/SHARK := $(CORE_PATHS) $(SHARK_PATHS) - Src_Dirs := $(Src_Dirs/$(TYPE)) - - COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp chaitin\* c2_\* runtime_\* ---- openjdk.orig/hotspot/make/linux/makefiles/launcher.make 2011-02-22 16:51:24.000000000 +0000 -+++ openjdk/hotspot/make/linux/makefiles/launcher.make 2011-02-24 03:01:36.000000000 +0000 -@@ -52,6 +52,10 @@ - LAUNCHER.o = launcher.o - LFLAGS_LAUNCHER += -L `pwd` - LIBS_LAUNCHER += -l$(JVM) $(LIBS) -+ ifeq ($(SHARK_BUILD), true) -+ LFLAGS_LAUNCHER += $(LLVM_LDFLAGS) -+ LIBS_LAUNCHER += $(LLVM_LIBS) -+ endif - endif - - LINK_LAUNCHER = $(LINK.c)
--- a/patches/sdt-arguments.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp openjdk/hotspot/src/share/vm/runtime/arguments.cpp ---- openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp 2010-08-27 20:30:51.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp 2010-08-27 22:37:45.261818795 +0100 -@@ -2460,16 +2460,16 @@ - FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); - FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true); - } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) { --#ifdef SOLARIS -+#ifdef DTRACE_ENABLED - FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true); - FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true); - FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true); - FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true); --#else // ndef SOLARIS -+#else // ndef DTRACE_ENABLED - jio_fprintf(defaultStream::error_stream(), -- "ExtendedDTraceProbes flag is only applicable on Solaris\n"); -+ "ExtendedDTraceProbes flag is only applicable on dtrace enabled builds\n"); - return JNI_EINVAL; --#endif // ndef SOLARIS -+#endif // ndef DTRACE_ENABLED - #ifdef ASSERT - } else if (match_option(option, "-XX:+FullGCALot", &tail)) { - FLAG_SET_CMDLINE(bool, FullGCALot, true);
--- a/patches/sdt-dtrace-hpp.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -# 7170638: Define DTRACE macros for use with GNU/Linux SystemTap sys/sdt.h. -# Summary: LINUX also uses USDT1, but with macros instead of function decls. -# Contributed-by: Mark Wielaard <mjw@redhat.com> - ---- openjdk/hotspot/src/share/vm/utilities/dtrace.hpp 2012-07-21 11:01:40.836101766 +0200 -+++ openjdk/hotspot/src/share/vm/utilities/dtrace.hpp 2012-07-21 11:01:40.741100325 +0200 -@@ -1,5 +1,6 @@ - /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2009, 2012 Red Hat, Inc. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -25,7 +26,7 @@ - #ifndef SHARE_VM_UTILITIES_DTRACE_HPP - #define SHARE_VM_UTILITIES_DTRACE_HPP - --#if defined(SOLARIS) && defined(DTRACE_ENABLED) -+#if defined(DTRACE_ENABLED) - - #include <sys/sdt.h> - -@@ -36,7 +37,7 @@ - #define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() \ - do { volatile size_t dtrace_workaround_tail_call_bug = 1; } while (0) - --#else // ndef SOLARIS || ndef DTRACE_ENABLED -+#else // ndef DTRACE_ENABLED - - #define DTRACE_ONLY(x) - #define NOT_DTRACE(x) x -@@ -47,11 +48,18 @@ - #define DTRACE_PROBE3(a,b,c,d,e) {;} - #define DTRACE_PROBE4(a,b,c,d,e,f) {;} - #define DTRACE_PROBE5(a,b,c,d,e,f,g) {;} -+#define DTRACE_PROBE6(a,b,c,d,e,f,g,h) {;} -+#define DTRACE_PROBE7(a,b,c,d,e,f,g,h,i) {;} -+#define DTRACE_PROBE8(a,b,c,d,e,f,g,h,i,j) {;} -+#define DTRACE_PROBE9(a,b,c,d,e,f,g,h,i,j,k) {;} -+#define DTRACE_PROBE10(a,b,c,d,e,f,g,h,i,j,k,l) {;} - - #define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() - - #endif - -+#if defined(SOLARIS) -+// Solaris dtrace needs actual extern function decls. - #define HS_DTRACE_PROBE_FN(provider,name)\ - __dtrace_##provider##___##name - -@@ -59,6 +67,11 @@ - DTRACE_ONLY(extern "C" void HS_DTRACE_PROBE_FN(provider,name) args) - #define HS_DTRACE_PROBE_CDECL_N(provider,name,args) \ - DTRACE_ONLY(extern void HS_DTRACE_PROBE_FN(provider,name) args) -+#else -+// Systemtap dtrace compatible probes on GNU/Linux don't. -+#define HS_DTRACE_PROBE_DECL_N(provider,name,args) -+#define HS_DTRACE_PROBE_CDECL_N(provider,name,args) -+#endif - - /* Dtrace probe declarations */ - #define HS_DTRACE_PROBE_DECL(provider,name) \ -@@ -97,6 +110,8 @@ - uintptr_t,uintptr_t,uintptr_t)) - - /* Dtrace probe definitions */ -+#if defined(SOLARIS) -+// Solaris dtrace uses actual function calls. - #define HS_DTRACE_PROBE_N(provider,name, args) \ - DTRACE_ONLY(HS_DTRACE_PROBE_FN(provider,name) args) - -@@ -132,5 +147,31 @@ - HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ - (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7,\ - (uintptr_t)a8,(uintptr_t)a9)) -+#else -+// Systemtap dtrace compatible probes on GNU/Linux use direct macros. -+#define HS_DTRACE_PROBE(provider,name) HS_DTRACE_PROBE0(provider,name) -+#define HS_DTRACE_PROBE0(provider,name)\ -+ DTRACE_PROBE(provider,name) -+#define HS_DTRACE_PROBE1(provider,name,a0)\ -+ DTRACE_PROBE1(provider,name,a0) -+#define HS_DTRACE_PROBE2(provider,name,a0,a1)\ -+ DTRACE_PROBE2(provider,name,a0,a1) -+#define HS_DTRACE_PROBE3(provider,name,a0,a1,a2)\ -+ DTRACE_PROBE3(provider,name,a0,a1,a2) -+#define HS_DTRACE_PROBE4(provider,name,a0,a1,a2,a3)\ -+ DTRACE_PROBE4(provider,name,a0,a1,a2,a3) -+#define HS_DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4)\ -+ DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4) -+#define HS_DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5)\ -+ DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5) -+#define HS_DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6)\ -+ DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6) -+#define HS_DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7)\ -+ DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7) -+#define HS_DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ -+ DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) -+#define HS_DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ -+ DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) -+#endif - - #endif // SHARE_VM_UTILITIES_DTRACE_HPP
--- a/patches/sdt-jni.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -# 7170638: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field. -# Summary: Don't use HS_DTRACE_PROBE_CDECL_N and HS_DTRACE_PROBE_N directly. -# Contributed-by: Mark Wielaard <mjw@redhat.com> - ---- openjdk/hotspot/src/share/vm/prims/jni.cpp 2012-07-21 11:00:27.793993673 +0200 -+++ openjdk/hotspot/src/share/vm/prims/jni.cpp 2012-07-21 11:00:27.685992034 +0200 -@@ -1,5 +1,6 @@ - /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2012 Red Hat, Inc. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -1817,10 +1818,7 @@ - JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID fieldID, Argument value)) \ - JNIWrapper("Set" XSTR(Result) "Field"); \ - \ -- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, Set##Result##Field__entry, \ -- ( JNIEnv*, jobject, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ -- HS_DTRACE_PROBE_N(hotspot_jni, Set##Result##Field__entry, \ -- ( env, obj, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ -+ FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID, value),DTRACE_PROBE3(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID)); \ - \ - oop o = JNIHandles::resolve_non_null(obj); \ - klassOop k = o->klass(); \ -@@ -1992,10 +1990,7 @@ - \ - JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID fieldID, Argument value)) \ - JNIWrapper("SetStatic" XSTR(Result) "Field"); \ -- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, SetStatic##Result##Field__entry,\ -- ( JNIEnv*, jclass, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ -- HS_DTRACE_PROBE_N(hotspot_jni, SetStatic##Result##Field__entry, \ -- ( env, clazz, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ -+ FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID, value),DTRACE_PROBE3(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID)); \ - \ - JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); \ - assert(id->is_static_field_id(), "invalid static field id"); \
--- a/patches/sdt-make.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -# 7170638: Enable dtrace compatible sdt probes on GNU/Linux builds. -# Summary: If sys/sdt.h is found, then enable dtrace compatible sdt probes. -# Contributed-by: Mark Wielaard <mjw@redhat.com> - ---- openjdk/hotspot/make/linux/makefiles/dtrace.make 2012-07-21 11:02:17.926664397 +0200 -+++ openjdk/hotspot/make/linux/makefiles/dtrace.make 2012-07-21 11:02:17.829662925 +0200 -@@ -1,5 +1,6 @@ - # - # Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. -+# Copyright (c) 2012 Red Hat, Inc. - # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - # - # This code is free software; you can redistribute it and/or modify it -@@ -25,3 +26,26 @@ - # Linux does not build jvm_db - LIBJVM_DB = - -+# But it does have a SystemTap dtrace compatible sys/sdt.h -+ifneq ($(ALT_SDT_H),) -+ SDT_H_FILE = $(ALT_SDT_H) -+else -+ SDT_H_FILE = /usr/include/sys/sdt.h -+endif -+DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE)) -+ -+ifneq ($(DTRACE_ENABLED),) -+ CFLAGS += -DDTRACE_ENABLED -+endif -+ -+# Phone target used in vm.make build target to check whether enabled. -+.PHONY: dtraceCheck -+ifeq ($(DTRACE_ENABLED),) -+dtraceCheck: -+ $(QUIETLY) echo "**NOTICE** Dtrace support disabled $(SDT_H_FILE) not found" -+else -+dtraceCheck: -+endif -+ -+# It doesn't support HAVE_DTRACE_H though. -+ ---- openjdk/hotspot/make/linux/makefiles/vm.make 2012-07-21 11:02:18.480672801 +0200 -+++ openjdk/hotspot/make/linux/makefiles/vm.make 2012-07-21 11:02:18.384671344 +0200 -@@ -387,7 +387,7 @@ - - #---------------------------------------------------------------------- - --build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) -+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck - - install: install_jvm install_jsig install_saproc -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/security/20130219/8006446.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,395 @@ +diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java +--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java 2011-11-14 22:11:44.000000000 +0000 ++++ openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java 2013-02-15 03:40:40.511587149 +0000 +@@ -36,6 +36,7 @@ + + import javax.management.ObjectName; + import javax.management.loading.PrivateClassLoader; ++import sun.reflect.misc.ReflectUtil; + + /** + * This class keeps the list of Class Loaders registered in the MBean Server. +@@ -192,6 +193,7 @@ + final ClassLoader without, + final ClassLoader stop) + throws ClassNotFoundException { ++ ReflectUtil.checkPackageAccess(className); + final int size = list.length; + for(int i=0; i<size; i++) { + try { +diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java +--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java 2011-11-14 22:11:44.000000000 +0000 ++++ openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java 2013-02-15 03:40:40.511587149 +0000 +@@ -57,6 +57,7 @@ + import javax.management.RuntimeOperationsException; + import javax.management.MBeanServer; + import javax.management.MBeanServerDelegate; ++import javax.management.MBeanServerPermission; + import javax.management.loading.ClassLoaderRepository; + + import static com.sun.jmx.defaults.JmxProperties.MBEANSERVER_LOGGER; +@@ -1413,6 +1414,8 @@ + // Default is true. + final boolean fairLock = DEFAULT_FAIR_LOCK_POLICY; + ++ checkNewMBeanServerPermission(); ++ + // This constructor happens to disregard the value of the interceptors + // flag - that is, it always uses the default value - false. + // This is admitedly a bug, but we chose not to fix it for now +@@ -1499,4 +1502,11 @@ + } + } + ++ private static void checkNewMBeanServerPermission() { ++ SecurityManager sm = System.getSecurityManager(); ++ if (sm != null) { ++ Permission perm = new MBeanServerPermission("newMBeanServer"); ++ sm.checkPermission(perm); ++ } ++ } + } +diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java +--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java 2011-11-14 22:11:44.000000000 +0000 ++++ openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java 2013-02-15 03:40:40.511587149 +0000 +@@ -32,11 +32,13 @@ + import java.io.ObjectInputStream; + import java.lang.reflect.Constructor; + import java.lang.reflect.InvocationTargetException; ++import java.security.Permission; + import java.util.Map; + import java.util.logging.Level; + + import javax.management.InstanceNotFoundException; + import javax.management.MBeanException; ++import javax.management.MBeanPermission; + import javax.management.NotCompliantMBeanException; + import javax.management.ObjectName; + import javax.management.OperationsException; +@@ -44,7 +46,7 @@ + import javax.management.RuntimeErrorException; + import javax.management.RuntimeMBeanException; + import javax.management.RuntimeOperationsException; +- ++import sun.reflect.misc.ConstructorUtil; + import sun.reflect.misc.ReflectUtil; + + /** +@@ -56,7 +58,6 @@ + * @since 1.5 + */ + public class MBeanInstantiator { +- + private final ModifiableClassLoaderRepository clr; + // private MetaData meta = null; + +@@ -88,6 +89,7 @@ + "Exception occurred during object instantiation"); + } + ++ ReflectUtil.checkPackageAccess(className); + try { + if (clr == null) throw new ClassNotFoundException(className); + theClass = clr.loadClass(className); +@@ -162,6 +164,7 @@ + continue; + } + ++ ReflectUtil.checkPackageAccess(signature[i]); + // Ok we do not have a primitive type ! We need to build + // the signature of the method + // +@@ -205,6 +208,9 @@ + */ + public Object instantiate(Class theClass) + throws ReflectionException, MBeanException { ++ ++ checkMBeanPermission(theClass, null, null, "instantiate"); ++ + Object moi = null; + + +@@ -260,6 +266,9 @@ + public Object instantiate(Class theClass, Object params[], + String signature[], ClassLoader loader) + throws ReflectionException, MBeanException { ++ ++ checkMBeanPermission(theClass, null, null, "instantiate"); ++ + // Instantiate the new object + + // ------------------------------ +@@ -408,6 +417,8 @@ + throw new RuntimeOperationsException(new + IllegalArgumentException(), "Null className passed in parameter"); + } ++ ++ ReflectUtil.checkPackageAccess(className); + Class theClass = null; + if (loaderName == null) { + // Load the class using the agent class loader +@@ -620,13 +631,13 @@ + **/ + static Class loadClass(String className, ClassLoader loader) + throws ReflectionException { +- + Class theClass = null; + if (className == null) { + throw new RuntimeOperationsException(new + IllegalArgumentException("The class name cannot be null"), + "Exception occurred during object instantiation"); + } ++ ReflectUtil.checkPackageAccess(className); + try { + if (loader == null) + loader = MBeanInstantiator.class.getClassLoader(); +@@ -677,6 +688,7 @@ + // We need to load the class through the class + // loader of the target object. + // ++ ReflectUtil.checkPackageAccess(signature[i]); + tab[i] = Class.forName(signature[i], false, aLoader); + } + } catch (ClassNotFoundException e) { +@@ -702,7 +714,7 @@ + + private Constructor<?> findConstructor(Class<?> c, Class<?>[] params) { + try { +- return c.getConstructor(params); ++ return ConstructorUtil.getConstructor(c, params); + } catch (Exception e) { + return null; + } +@@ -716,4 +728,18 @@ + char.class, boolean.class}) + primitiveClasses.put(c.getName(), c); + } ++ ++ private static void checkMBeanPermission(Class<?> clazz, ++ String member, ++ ObjectName objectName, ++ String actions) { ++ SecurityManager sm = System.getSecurityManager(); ++ if (clazz != null && sm != null) { ++ Permission perm = new MBeanPermission(clazz.getName(), ++ member, ++ objectName, ++ actions); ++ sm.checkPermission(perm); ++ } ++ } + } +diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanSupport.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanSupport.java +--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanSupport.java 2011-11-14 22:11:44.000000000 +0000 ++++ openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanSupport.java 2013-02-15 03:40:40.511587149 +0000 +@@ -38,6 +38,7 @@ + import javax.management.NotCompliantMBeanException; + import javax.management.ObjectName; + import javax.management.ReflectionException; ++import sun.reflect.misc.ReflectUtil; + + /** + * Base class for MBeans. There is one instance of this class for +@@ -131,6 +132,7 @@ + " is not an instance of " + mbeanInterface.getName(); + throw new NotCompliantMBeanException(msg); + } ++ ReflectUtil.checkPackageAccess(mbeanInterface); + this.resource = resource; + MBeanIntrospector<M> introspector = getMBeanIntrospector(); + this.perInterface = introspector.getPerInterface(mbeanInterface); +diff -Nru openjdk.orig/jdk/src/share/classes/sun/management/LockDataConverter.java openjdk/jdk/src/share/classes/sun/management/LockDataConverter.java +--- openjdk.orig/jdk/src/share/classes/sun/management/LockDataConverter.java 2011-11-14 22:12:00.000000000 +0000 ++++ openjdk/jdk/src/share/classes/sun/management/LockDataConverter.java 2013-02-15 03:40:40.511587149 +0000 +@@ -27,6 +27,8 @@ + + import java.lang.management.LockInfo; + import java.lang.management.ThreadInfo; ++import java.security.AccessController; ++import java.security.PrivilegedAction; + import javax.management.Attribute; + import javax.management.StandardMBean; + import javax.management.openmbean.CompositeData; +@@ -40,13 +42,13 @@ + private LockInfo lockInfo; + private LockInfo[] lockedSyncs; + +- LockDataConverter() { ++ private LockDataConverter() { + super(LockDataConverterMXBean.class, true); + this.lockInfo = null; + this.lockedSyncs = null; + } + +- LockDataConverter(ThreadInfo ti) { ++ private LockDataConverter(ThreadInfo ti) { + super(LockDataConverterMXBean.class, true); + this.lockInfo = ti.getLockInfo(); + this.lockedSyncs = ti.getLockedSynchronizers(); +@@ -104,8 +106,24 @@ + } + + static CompositeData toLockInfoCompositeData(LockInfo l) { +- LockDataConverter ldc = new LockDataConverter(); ++ LockDataConverter ldc = newLockDataConverter(); + ldc.setLockInfo(l); + return ldc.toLockInfoCompositeData(); + } ++ ++ static LockDataConverter newLockDataConverter() { ++ return AccessController.doPrivileged(new PrivilegedAction<LockDataConverter>() { ++ public LockDataConverter run() { ++ return new LockDataConverter(); ++ } ++ }); ++ } ++ ++ static LockDataConverter newLockDataConverter(final ThreadInfo ti) { ++ LockDataConverter result = newLockDataConverter(); ++ result.lockInfo = ti.getLockInfo(); ++ result.lockedSyncs = ti.getLockedSynchronizers(); ++ return result; ++ } + } ++ +diff -Nru openjdk.orig/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java openjdk/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java +--- openjdk.orig/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java 2011-11-14 22:12:01.000000000 +0000 ++++ openjdk/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java 2013-02-15 03:40:40.511587149 +0000 +@@ -85,7 +85,7 @@ + } + + // Convert MonitorInfo[] and LockInfo[] to CompositeData[] +- LockDataConverter converter = new LockDataConverter(threadInfo); ++ LockDataConverter converter = LockDataConverter.newLockDataConverter(threadInfo); + CompositeData lockInfoData = converter.toLockInfoCompositeData(); + CompositeData[] lockedSyncsData = converter.toLockedSynchronizersCompositeData(); + +@@ -315,7 +315,7 @@ + + // 6.0 new attributes + public LockInfo lockInfo() { +- LockDataConverter converter = new LockDataConverter(); ++ LockDataConverter converter = LockDataConverter.newLockDataConverter(); + CompositeData lockInfoData = (CompositeData) cdata.get(LOCK_INFO); + return converter.toLockInfo(lockInfoData); + } +@@ -336,7 +336,7 @@ + } + + public LockInfo[] lockedSynchronizers() { +- LockDataConverter converter = new LockDataConverter(); ++ LockDataConverter converter = LockDataConverter.newLockDataConverter(); + CompositeData[] lockedSyncsData = + (CompositeData[]) cdata.get(LOCKED_SYNCS); + +diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security openjdk/jdk/src/share/lib/security/java.security +--- openjdk.orig/jdk/src/share/lib/security/java.security 2013-02-15 03:39:56.922892783 +0000 ++++ openjdk/jdk/src/share/lib/security/java.security 2013-02-15 03:40:40.511587149 +0000 +@@ -131,8 +131,7 @@ + com.sun.xml.internal.,\ + com.sun.imageio.,\ + com.sun.istack.internal.,\ +- com.sun.jmx.defaults.,\ +- com.sun.jmx.remote.util. ++ com.sun.jmx. + + # + # List of comma-separated packages that start with or equal this string +@@ -148,8 +147,7 @@ + com.sun.xml.internal.,\ + com.sun.imageio.,\ + com.sun.istack.internal.,\ +- com.sun.jmx.defaults.,\ +- com.sun.jmx.remote.util. ++ com.sun.jmx. + + # + # Determines whether this properties file can be appended to +diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security-solaris openjdk/jdk/src/share/lib/security/java.security-solaris +--- openjdk.orig/jdk/src/share/lib/security/java.security-solaris 2013-02-15 03:39:56.902892466 +0000 ++++ openjdk/jdk/src/share/lib/security/java.security-solaris 2013-02-15 03:41:36.996489851 +0000 +@@ -131,6 +131,8 @@ + package.access=sun.,\ + com.sun.xml.internal.,\ + com.sun.imageio. ++ com.sun.istack.internal.,\ ++ com.sun.jmx. + + # + # List of comma-separated packages that start with or equal this string +@@ -145,6 +147,8 @@ + package.definition=sun.,\ + com.sun.xml.internal.,\ + com.sun.imageio. ++ com.sun.istack.internal.,\ ++ com.sun.jmx. + + # + # Determines whether this properties file can be appended to +diff -Nru openjdk.orig/jdk/src/share/lib/security/java.security-windows openjdk/jdk/src/share/lib/security/java.security-windows +--- openjdk.orig/jdk/src/share/lib/security/java.security-windows 2013-02-15 03:39:56.902892466 +0000 ++++ openjdk/jdk/src/share/lib/security/java.security-windows 2013-02-15 03:42:05.304943135 +0000 +@@ -131,6 +131,8 @@ + package.access=sun.,\ + com.sun.xml.internal.,\ + com.sun.imageio. ++ com.sun.istack.internal.,\ ++ com.sun.jmx. + + # + # List of comma-separated packages that start with or equal this string +@@ -145,6 +147,8 @@ + package.definition=sun.,\ + com.sun.xml.internal.,\ + com.sun.imageio. ++ com.sun.istack.internal.,\ ++ com.sun.jmx. + + # + # Determines whether this properties file can be appended to +diff -Nru openjdk.orig/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java openjdk/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java +--- openjdk.orig/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java 2011-11-14 22:12:28.000000000 +0000 ++++ openjdk/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java 2013-02-15 03:40:40.511587149 +0000 +@@ -119,9 +119,6 @@ + System.out.println("Create SimpleStandard MBean"); + SimpleStandard s = new SimpleStandard("monitorRole"); + mbs.registerMBean(s, new ObjectName("MBeans:type=SimpleStandard")); +- // Set Security Manager +- // +- System.setSecurityManager(new SecurityManager()); + // Create Properties containing the username/password entries + // + Properties props = new Properties(); +@@ -132,6 +129,9 @@ + HashMap env = new HashMap(); + env.put("jmx.remote.authenticator", + new JMXPluggableAuthenticator(props)); ++ // Set Security Manager ++ // ++ System.setSecurityManager(new SecurityManager()); + // Create an RMI connector server + // + System.out.println("Create an RMI connector server"); +diff -Nru openjdk.orig/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java openjdk/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java +--- openjdk.orig/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java 2011-11-14 22:12:28.000000000 +0000 ++++ openjdk/jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java 2013-02-15 03:40:40.511587149 +0000 +@@ -120,9 +120,6 @@ + System.out.println("Create SimpleStandard MBean"); + SimpleStandard s = new SimpleStandard("delegate"); + mbs.registerMBean(s, new ObjectName("MBeans:type=SimpleStandard")); +- // Set Security Manager +- // +- System.setSecurityManager(new SecurityManager()); + // Create Properties containing the username/password entries + // + Properties props = new Properties(); +@@ -133,6 +130,9 @@ + HashMap env = new HashMap(); + env.put("jmx.remote.authenticator", + new JMXPluggableAuthenticator(props)); ++ // Set Security Manager ++ // ++ System.setSecurityManager(new SecurityManager()); + // Create an RMI connector server + // + System.out.println("Create an RMI connector server");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/security/20130219/8006777.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,1036 @@ +# HG changeset patch +# User coffeys +# Date 1360882104 0 +# Node ID 85b3b034fdecdc94f082efa8d74e014366502deb +# Parent 617e68a3948824283f15c36fcd8cf264c1dd0a99 +8006777: Improve TLS handling of invalid messages +Reviewed-by: wetmore + +diff --git a/src/share/classes/sun/security/ssl/CipherBox.java b/src/share/classes/sun/security/ssl/CipherBox.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/CipherBox.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/CipherBox.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -244,7 +244,8 @@ final class CipherBox { + * Decrypts a block of data, returning the size of the + * resulting block if padding was required. + */ +- int decrypt(byte[] buf, int offset, int len) throws BadPaddingException { ++ int decrypt(byte[] buf, int offset, int len, ++ int tagLen) throws BadPaddingException { + if (cipher == null) { + return len; + } +@@ -268,8 +269,8 @@ final class CipherBox { + } catch (IOException e) { } + } + if (blockSize != 0) { +- newLen = removePadding(buf, offset, newLen, +- blockSize, protocolVersion); ++ newLen = removePadding( ++ buf, offset, newLen, tagLen, blockSize, protocolVersion); + } + return newLen; + } catch (ShortBufferException e) { +@@ -285,7 +286,7 @@ final class CipherBox { + * limit and new limit may be different, given we may + * have stripped off some padding bytes. + */ +- int decrypt(ByteBuffer bb) throws BadPaddingException { ++ int decrypt(ByteBuffer bb, int tagLen) throws BadPaddingException { + + int len = bb.remaining(); + +@@ -309,7 +310,6 @@ final class CipherBox { + } + + if (debug != null && Debug.isOn("plaintext")) { +- bb.position(pos); + try { + HexDumpEncoder hd = new HexDumpEncoder(); + +@@ -317,7 +317,8 @@ final class CipherBox { + "Padded plaintext after DECRYPTION: len = " + + newLen); + +- hd.encodeBuffer(bb, System.out); ++ hd.encodeBuffer( ++ (ByteBuffer)bb.duplicate().position(pos), System.out); + } catch (IOException e) { } + } + +@@ -326,7 +327,8 @@ final class CipherBox { + */ + if (blockSize != 0) { + bb.position(pos); +- newLen = removePadding(bb, blockSize, protocolVersion); ++ newLen = removePadding( ++ bb, tagLen, blockSize, protocolVersion); + } + return newLen; + } catch (ShortBufferException e) { +@@ -400,6 +402,65 @@ final class CipherBox { + return newlen; + } + ++ /* ++ * A constant-time check of the padding. ++ * ++ * NOTE that we are checking both the padding and the padLen bytes here. ++ * ++ * The caller MUST ensure that the len parameter is a positive number. ++ */ ++ private static int[] checkPadding( ++ byte[] buf, int offset, int len, byte pad) { ++ ++ if (len <= 0) { ++ throw new RuntimeException("padding len must be positive"); ++ } ++ ++ // An array of hits is used to prevent Hotspot optimization for ++ // the purpose of a constant-time check ++ int[] results = {0, 0}; // {missed #, matched #} ++ for (int i = 0; i <= 256;) { ++ for (int j = 0; j < len && i <= 256; j++, i++) { // j <= i ++ if (buf[offset + j] != pad) { ++ results[0]++; // mismatched padding data ++ } else { ++ results[1]++; // matched padding data ++ } ++ } ++ } ++ ++ return results; ++ } ++ ++ /* ++ * A constant-time check of the padding. ++ * ++ * NOTE that we are checking both the padding and the padLen bytes here. ++ * ++ * The caller MUST ensure that the bb parameter has remaining. ++ */ ++ private static int[] checkPadding(ByteBuffer bb, byte pad) { ++ ++ if (!bb.hasRemaining()) { ++ throw new RuntimeException("hasRemaining() must be positive"); ++ } ++ ++ // An array of hits is used to prevent Hotspot optimization for ++ // the purpose of a constant-time check. ++ int[] results = {0, 0}; // {missed #, matched #} ++ bb.mark(); ++ for (int i = 0; i <= 256; bb.reset()) { ++ for (; bb.hasRemaining() && i <= 256; i++) { ++ if (bb.get() != pad) { ++ results[0]++; // mismatched padding data ++ } else { ++ results[1]++; // matched padding data ++ } ++ } ++ } ++ ++ return results; ++ } + + /* + * Typical TLS padding format for a 64 bit block cipher is as follows: +@@ -412,86 +473,95 @@ final class CipherBox { + * as it makes the data a multiple of the block size + */ + private static int removePadding(byte[] buf, int offset, int len, +- int blockSize, ProtocolVersion protocolVersion) +- throws BadPaddingException { ++ int tagLen, int blockSize, ++ ProtocolVersion protocolVersion) throws BadPaddingException { ++ + // last byte is length byte (i.e. actual padding length - 1) + int padOffset = offset + len - 1; +- int pad = buf[padOffset] & 0x0ff; ++ int padLen = buf[padOffset] & 0xFF; + +- int newlen = len - (pad + 1); +- if (newlen < 0) { +- throw new BadPaddingException("Padding length invalid: " + pad); ++ int newLen = len - (padLen + 1); ++ if ((newLen - tagLen) < 0) { ++ // If the buffer is not long enough to contain the padding plus ++ // a MAC tag, do a dummy constant-time padding check. ++ // ++ // Note that it is a dummy check, so we won't care about what is ++ // the actual padding data. ++ checkPadding(buf, offset, len, (byte)(padLen & 0xFF)); ++ ++ throw new BadPaddingException("Invalid Padding length: " + padLen); + } + ++ // The padding data should be filled with the padding length value. ++ int[] results = checkPadding(buf, offset + newLen, ++ padLen + 1, (byte)(padLen & 0xFF)); + if (protocolVersion.v >= ProtocolVersion.TLS10.v) { +- for (int i = 1; i <= pad; i++) { +- int val = buf[padOffset - i] & 0xff; +- if (val != pad) { +- throw new BadPaddingException +- ("Invalid TLS padding: " + val); +- } ++ if (results[0] != 0) { // padding data has invalid bytes ++ throw new BadPaddingException("Invalid TLS padding data"); + } + } else { // SSLv3 + // SSLv3 requires 0 <= length byte < block size + // some implementations do 1 <= length byte <= block size, + // so accept that as well + // v3 does not require any particular value for the other bytes +- if (pad > blockSize) { +- throw new BadPaddingException("Invalid SSLv3 padding: " + pad); ++ if (padLen > blockSize) { ++ throw new BadPaddingException("Invalid SSLv3 padding"); + } + } +- return newlen; ++ return newLen; + } + + /* + * Position/limit is equal the removed padding. + */ + private static int removePadding(ByteBuffer bb, +- int blockSize, ProtocolVersion protocolVersion) +- throws BadPaddingException { ++ int tagLen, int blockSize, ++ ProtocolVersion protocolVersion) throws BadPaddingException { + + int len = bb.remaining(); + int offset = bb.position(); + + // last byte is length byte (i.e. actual padding length - 1) + int padOffset = offset + len - 1; +- int pad = bb.get(padOffset) & 0x0ff; ++ int padLen = bb.get(padOffset) & 0xFF; + +- int newlen = len - (pad + 1); +- if (newlen < 0) { +- throw new BadPaddingException("Padding length invalid: " + pad); ++ int newLen = len - (padLen + 1); ++ if ((newLen - tagLen) < 0) { ++ // If the buffer is not long enough to contain the padding plus ++ // a MAC tag, do a dummy constant-time padding check. ++ // ++ // Note that it is a dummy check, so we won't care about what is ++ // the actual padding data. ++ checkPadding(bb.duplicate(), (byte)(padLen & 0xFF)); ++ ++ throw new BadPaddingException("Invalid Padding length: " + padLen); + } + +- /* +- * We could zero the padding area, but not much useful +- * information there. +- */ ++ // The padding data should be filled with the padding length value. ++ int[] results = checkPadding( ++ (ByteBuffer)bb.duplicate().position(offset + newLen), ++ (byte)(padLen & 0xFF)); + if (protocolVersion.v >= ProtocolVersion.TLS10.v) { +- bb.put(padOffset, (byte)0); // zero the padding. +- for (int i = 1; i <= pad; i++) { +- int val = bb.get(padOffset - i) & 0xff; +- if (val != pad) { +- throw new BadPaddingException +- ("Invalid TLS padding: " + val); +- } ++ if (results[0] != 0) { // padding data has invalid bytes ++ throw new BadPaddingException("Invalid TLS padding data"); + } + } else { // SSLv3 + // SSLv3 requires 0 <= length byte < block size + // some implementations do 1 <= length byte <= block size, + // so accept that as well + // v3 does not require any particular value for the other bytes +- if (pad > blockSize) { +- throw new BadPaddingException("Invalid SSLv3 padding: " + pad); ++ if (padLen > blockSize) { ++ throw new BadPaddingException("Invalid SSLv3 padding"); + } + } + + /* + * Reset buffer limit to remove padding. + */ +- bb.position(offset + newlen); +- bb.limit(offset + newlen); ++ bb.position(offset + newLen); ++ bb.limit(offset + newLen); + +- return newlen; ++ return newLen; + } + + /* +@@ -502,4 +572,40 @@ final class CipherBox { + boolean isCBCMode() { + return isCBCMode; + } ++ ++ /** ++ * Is the cipher null? ++ * ++ * @return true if the cipher is null, false otherwise. ++ */ ++ boolean isNullCipher() { ++ return cipher == null; ++ } ++ ++ /** ++ * Sanity check the length of a fragment before decryption. ++ * ++ * In CBC mode, check that the fragment length is one or multiple times ++ * of the block size of the cipher suite, and is at least one (one is the ++ * smallest size of padding in CBC mode) bigger than the tag size of the ++ * MAC algorithm. ++ * ++ * In non-CBC mode, check that the fragment length is not less than the ++ * tag size of the MAC algorithm. ++ * ++ * @return true if the length of a fragment matches above requirements ++ */ ++ boolean sanityCheck(int tagLen, int fragmentLen) { ++ if (!isCBCMode) { ++ return fragmentLen >= tagLen; ++ } ++ ++ if ((fragmentLen % blockSize) == 0) { ++ int minimal = tagLen + 1; ++ minimal = (minimal >= blockSize) ? minimal : blockSize; ++ return (fragmentLen >= minimal); ++ } ++ ++ return false; ++ } + } +diff --git a/src/share/classes/sun/security/ssl/CipherSuite.java b/src/share/classes/sun/security/ssl/CipherSuite.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/CipherSuite.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/CipherSuite.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -451,9 +451,18 @@ final class CipherSuite implements Compa + // size of the MAC value (and MAC key) in bytes + final int size; + +- MacAlg(String name, int size) { ++ // block size of the underlying hash algorithm ++ final int hashBlockSize; ++ ++ // minimal padding size of the underlying hash algorithm ++ final int minimalPaddingSize; ++ ++ MacAlg(String name, int size, ++ int hashBlockSize, int minimalPaddingSize) { + this.name = name; + this.size = size; ++ this.hashBlockSize = hashBlockSize; ++ this.minimalPaddingSize = minimalPaddingSize; + } + + /** +@@ -497,9 +506,9 @@ final class CipherSuite implements Compa + new BulkCipher(CIPHER_AES, 32, 16, true); + + // MACs +- final static MacAlg M_NULL = new MacAlg("NULL", 0); +- final static MacAlg M_MD5 = new MacAlg("MD5", 16); +- final static MacAlg M_SHA = new MacAlg("SHA", 20); ++ final static MacAlg M_NULL = new MacAlg("NULL", 0, 0, 0); ++ final static MacAlg M_MD5 = new MacAlg("MD5", 16, 64, 9); ++ final static MacAlg M_SHA = new MacAlg("SHA", 20, 64, 9); + + static { + idMap = new HashMap<Integer,CipherSuite>(); +diff --git a/src/share/classes/sun/security/ssl/EngineInputRecord.java b/src/share/classes/sun/security/ssl/EngineInputRecord.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/EngineInputRecord.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/EngineInputRecord.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -177,71 +177,6 @@ final class EngineInputRecord extends In + } + + /* +- * Verifies and removes the MAC value. Returns true if +- * the MAC checks out OK. +- * +- * On entry: +- * position = beginning of app/MAC data +- * limit = end of MAC data. +- * +- * On return: +- * position = beginning of app data +- * limit = end of app data +- */ +- boolean checkMAC(MAC signer, ByteBuffer bb) { +- if (internalData) { +- return checkMAC(signer); +- } +- +- int len = signer.MAClen(); +- if (len == 0) { // no mac +- return true; +- } +- +- /* +- * Grab the original limit +- */ +- int lim = bb.limit(); +- +- /* +- * Delineate the area to apply a MAC on. +- */ +- int macData = lim - len; +- bb.limit(macData); +- +- byte[] mac = signer.compute(contentType(), bb); +- +- if (len != mac.length) { +- throw new RuntimeException("Internal MAC error"); +- } +- +- /* +- * Delineate the MAC values, position was already set +- * by doing the compute above. +- * +- * We could zero the MAC area, but not much useful information +- * there anyway. +- */ +- bb.position(macData); +- bb.limit(lim); +- +- try { +- for (int i = 0; i < len; i++) { +- if (bb.get() != mac[i]) { // No BB.equals(byte []); ! +- return false; +- } +- } +- return true; +- } finally { +- /* +- * Position to the data. +- */ +- bb.rewind(); +- bb.limit(macData); +- } +- } +- +- /* + * Pass the data down if it's internally cached, otherwise + * do it here. + * +@@ -250,18 +185,161 @@ final class EngineInputRecord extends In + * If external data(app), return a new ByteBuffer with data to + * process. + */ +- ByteBuffer decrypt(CipherBox box, ByteBuffer bb) +- throws BadPaddingException { ++ ByteBuffer decrypt(MAC signer, ++ CipherBox box, ByteBuffer bb) throws BadPaddingException { + + if (internalData) { +- decrypt(box); ++ decrypt(signer, box); // MAC is checked during decryption + return tmpBB; + } + +- box.decrypt(bb); +- bb.rewind(); ++ BadPaddingException reservedBPE = null; ++ int tagLen = signer.MAClen(); ++ int cipheredLength = bb.remaining(); ++ ++ if (!box.isNullCipher()) { ++ // sanity check length of the ciphertext ++ if (!box.sanityCheck(tagLen, cipheredLength)) { ++ throw new BadPaddingException( ++ "ciphertext sanity check failed"); ++ } ++ ++ try { ++ // Note that the CipherBox.decrypt() does not change ++ // the capacity of the buffer. ++ box.decrypt(bb, tagLen); ++ } catch (BadPaddingException bpe) { ++ // RFC 2246 states that decryption_failed should be used ++ // for this purpose. However, that allows certain attacks, ++ // so we just send bad record MAC. We also need to make ++ // sure to always check the MAC to avoid a timing attack ++ // for the same issue. See paper by Vaudenay et al and the ++ // update in RFC 4346/5246. ++ // ++ // Failover to message authentication code checking. ++ reservedBPE = bpe; ++ } finally { ++ bb.rewind(); ++ } ++ } ++ ++ if (tagLen != 0) { ++ int macOffset = bb.limit() - tagLen; ++ ++ // Note that although it is not necessary, we run the same MAC ++ // computation and comparison on the payload for both stream ++ // cipher and CBC block cipher. ++ if (bb.remaining() < tagLen) { ++ // negative data length, something is wrong ++ if (reservedBPE == null) { ++ reservedBPE = new BadPaddingException("bad record"); ++ } ++ ++ // set offset of the dummy MAC ++ macOffset = cipheredLength - tagLen; ++ bb.limit(cipheredLength); ++ } ++ ++ // Run MAC computation and comparison on the payload. ++ if (checkMacTags(contentType(), bb, signer, false)) { ++ if (reservedBPE == null) { ++ reservedBPE = new BadPaddingException("bad record MAC"); ++ } ++ } ++ ++ // Run MAC computation and comparison on the remainder. ++ // ++ // It is only necessary for CBC block cipher. It is used to get a ++ // constant time of MAC computation and comparison on each record. ++ if (box.isCBCMode()) { ++ int remainingLen = calculateRemainingLen( ++ signer, cipheredLength, macOffset); ++ ++ // NOTE: here we use the InputRecord.buf because I did not find ++ // an effective way to work on ByteBuffer when its capacity is ++ // less than remainingLen. ++ ++ // NOTE: remainingLen may be bigger (less than 1 block of the ++ // hash algorithm of the MAC) than the cipheredLength. However, ++ // We won't need to worry about it because we always use a ++ // maximum buffer for every record. We need a change here if ++ // we use small buffer size in the future. ++ if (remainingLen > buf.length) { ++ // unlikely to happen, just a placehold ++ throw new RuntimeException( ++ "Internal buffer capacity error"); ++ } ++ ++ // Won't need to worry about the result on the remainder. And ++ // then we won't need to worry about what's actual data to ++ // check MAC tag on. We start the check from the header of the ++ // buffer so that we don't need to construct a new byte buffer. ++ checkMacTags(contentType(), buf, 0, remainingLen, signer, true); ++ } ++ ++ bb.limit(macOffset); ++ } ++ ++ // Is it a failover? ++ if (reservedBPE != null) { ++ throw reservedBPE; ++ } + + return bb.slice(); ++ } ++ ++ /* ++ * Run MAC computation and comparison ++ * ++ * Please DON'T change the content of the ByteBuffer parameter! ++ */ ++ private static boolean checkMacTags(byte contentType, ByteBuffer bb, ++ MAC signer, boolean isSimulated) { ++ ++ int tagLen = signer.MAClen(); ++ int lim = bb.limit(); ++ int macData = lim - tagLen; ++ ++ bb.limit(macData); ++ byte[] hash = signer.compute(contentType, bb, isSimulated); ++ if (hash == null || tagLen != hash.length) { ++ // Something is wrong with MAC implementation. ++ throw new RuntimeException("Internal MAC error"); ++ } ++ ++ bb.position(macData); ++ bb.limit(lim); ++ try { ++ int[] results = compareMacTags(bb, hash); ++ return (results[0] != 0); ++ } finally { ++ bb.rewind(); ++ bb.limit(macData); ++ } ++ } ++ ++ /* ++ * A constant-time comparison of the MAC tags. ++ * ++ * Please DON'T change the content of the ByteBuffer parameter! ++ */ ++ private static int[] compareMacTags(ByteBuffer bb, byte[] tag) { ++ ++ // An array of hits is used to prevent Hotspot optimization for ++ // the purpose of a constant-time check. ++ int[] results = {0, 0}; // {missed #, matched #} ++ ++ // The caller ensures there are enough bytes available in the buffer. ++ // So we won't need to check the remaining of the buffer. ++ for (int i = 0; i < tag.length; i++) { ++ if (bb.get() != tag[i]) { ++ results[0]++; // mismatched bytes ++ } else { ++ results[1]++; // matched bytes ++ } ++ } ++ ++ return results; + } + + /* +diff --git a/src/share/classes/sun/security/ssl/EngineOutputRecord.java b/src/share/classes/sun/security/ssl/EngineOutputRecord.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -120,7 +120,7 @@ final class EngineOutputRecord extends O + throws IOException { + + if (signer.MAClen() != 0) { +- byte[] hash = signer.compute(contentType(), bb); ++ byte[] hash = signer.compute(contentType(), bb, false); + + /* + * position was advanced to limit in compute above. +diff --git a/src/share/classes/sun/security/ssl/InputRecord.java b/src/share/classes/sun/security/ssl/InputRecord.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/InputRecord.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/InputRecord.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -135,43 +135,173 @@ class InputRecord extends ByteArrayInput + return handshakeHash; + } + +- /* +- * Verify and remove the MAC ... used for all records. +- */ +- boolean checkMAC(MAC signer) { +- int len = signer.MAClen(); +- if (len == 0) { // no mac +- return true; ++ void decrypt(MAC signer, CipherBox box) throws BadPaddingException { ++ ++ BadPaddingException reservedBPE = null; ++ int tagLen = signer.MAClen(); ++ int cipheredLength = count - headerSize; ++ ++ if (!box.isNullCipher()) { ++ // sanity check length of the ciphertext ++ if (!box.sanityCheck(tagLen, cipheredLength)) { ++ throw new BadPaddingException( ++ "ciphertext sanity check failed"); ++ } ++ ++ try { ++ // Note that the CipherBox.decrypt() does not change ++ // the capacity of the buffer. ++ count = headerSize + ++ box.decrypt(buf, headerSize, cipheredLength, tagLen); ++ } catch (BadPaddingException bpe) { ++ // RFC 2246 states that decryption_failed should be used ++ // for this purpose. However, that allows certain attacks, ++ // so we just send bad record MAC. We also need to make ++ // sure to always check the MAC to avoid a timing attack ++ // for the same issue. See paper by Vaudenay et al and the ++ // update in RFC 4346/5246. ++ // ++ // Failover to message authentication code checking. ++ reservedBPE = bpe; ++ } + } + +- int offset = count - len; ++ if (tagLen != 0) { ++ int macOffset = count - tagLen; ++ int contentLen = macOffset - headerSize; + +- if (offset < headerSize) { +- // data length would be negative, something is wrong +- return false; ++ // Note that although it is not necessary, we run the same MAC ++ // computation and comparison on the payload for both stream ++ // cipher and CBC block cipher. ++ if (contentLen < 0) { ++ // negative data length, something is wrong ++ if (reservedBPE == null) { ++ reservedBPE = new BadPaddingException("bad record"); ++ } ++ ++ // set offset of the dummy MAC ++ macOffset = headerSize + cipheredLength - tagLen; ++ contentLen = macOffset - headerSize; ++ } ++ ++ count -= tagLen; // Set the count before any MAC checking ++ // exception occurs, so that the following ++ // process can read the actual decrypted ++ // content (minus the MAC) in the fragment ++ // if necessary. ++ ++ // Run MAC computation and comparison on the payload. ++ if (checkMacTags(contentType(), ++ buf, headerSize, contentLen, signer, false)) { ++ if (reservedBPE == null) { ++ reservedBPE = new BadPaddingException("bad record MAC"); ++ } ++ } ++ ++ // Run MAC computation and comparison on the remainder. ++ // ++ // It is only necessary for CBC block cipher. It is used to get a ++ // constant time of MAC computation and comparison on each record. ++ if (box.isCBCMode()) { ++ int remainingLen = calculateRemainingLen( ++ signer, cipheredLength, contentLen); ++ ++ // NOTE: remainingLen may be bigger (less than 1 block of the ++ // hash algorithm of the MAC) than the cipheredLength. However, ++ // We won't need to worry about it because we always use a ++ // maximum buffer for every record. We need a change here if ++ // we use small buffer size in the future. ++ if (remainingLen > buf.length) { ++ // unlikely to happen, just a placehold ++ throw new RuntimeException( ++ "Internal buffer capacity error"); ++ } ++ ++ // Won't need to worry about the result on the remainder. And ++ // then we won't need to worry about what's actual data to ++ // check MAC tag on. We start the check from the header of the ++ // buffer so that we don't need to construct a new byte buffer. ++ checkMacTags(contentType(), buf, 0, remainingLen, signer, true); ++ } + } + +- byte[] mac = signer.compute(contentType(), buf, +- headerSize, offset - headerSize); ++ // Is it a failover? ++ if (reservedBPE != null) { ++ throw reservedBPE; ++ } ++ } + +- if (len != mac.length) { ++ /* ++ * Run MAC computation and comparison ++ * ++ * Please DON'T change the content of the byte buffer parameter! ++ */ ++ static boolean checkMacTags(byte contentType, byte[] buffer, ++ int offset, int contentLen, MAC signer, boolean isSimulated) { ++ ++ int tagLen = signer.MAClen(); ++ byte[] hash = signer.compute( ++ contentType, buffer, offset, contentLen, isSimulated); ++ if (hash == null || tagLen != hash.length) { ++ // Something is wrong with MAC implementation. + throw new RuntimeException("Internal MAC error"); + } + +- for (int i = 0; i < len; i++) { +- if (buf[offset + i] != mac[i]) { +- return false; ++ int[] results = compareMacTags(buffer, offset + contentLen, hash); ++ return (results[0] != 0); ++ } ++ ++ /* ++ * A constant-time comparison of the MAC tags. ++ * ++ * Please DON'T change the content of the byte buffer parameter! ++ */ ++ private static int[] compareMacTags( ++ byte[] buffer, int offset, byte[] tag) { ++ ++ // An array of hits is used to prevent Hotspot optimization for ++ // the purpose of a constant-time check. ++ int[] results = {0, 0}; // {missed #, matched #} ++ ++ // The caller ensures there are enough bytes available in the buffer. ++ // So we won't need to check the length of the buffer. ++ for (int i = 0; i < tag.length; i++) { ++ if (buffer[offset + i] != tag[i]) { ++ results[0]++; // mismatched bytes ++ } else { ++ results[1]++; // matched bytes + } + } +- count -= len; +- return true; ++ ++ return results; + } + +- void decrypt(CipherBox box) throws BadPaddingException { +- int len = count - headerSize; +- count = headerSize + box.decrypt(buf, headerSize, len); ++ /* ++ * Calculate the length of a dummy buffer to run MAC computation ++ * and comparison on the remainder. ++ * ++ * The caller MUST ensure that the fullLen is not less than usedLen. ++ */ ++ static int calculateRemainingLen( ++ MAC signer, int fullLen, int usedLen) { ++ ++ int blockLen = signer.hashBlockLen(); ++ int minimalPaddingLen = signer.minimalPaddingLen(); ++ ++ // (blockLen - minimalPaddingLen) is the maximum message size of ++ // the last block of hash function operation. See FIPS 180-4, or ++ // MD5 specification. ++ fullLen += 13 - (blockLen - minimalPaddingLen); ++ usedLen += 13 - (blockLen - minimalPaddingLen); ++ ++ // Note: fullLen is always not less than usedLen, and blockLen ++ // is always bigger than minimalPaddingLen, so we don't worry ++ // about negative values. 0x01 is added to the result to ensure ++ // that the return value is positive. The extra one byte does ++ // not impact the overall MAC compression function evaluations. ++ return 0x01 + (int)(Math.ceil(fullLen/(1.0d * blockLen)) - ++ Math.ceil(usedLen/(1.0d * blockLen))) * signer.hashBlockLen(); + } +- + + /* + * Well ... hello_request messages are _never_ hashed since we can't +diff --git a/src/share/classes/sun/security/ssl/MAC.java b/src/share/classes/sun/security/ssl/MAC.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/MAC.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/MAC.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -44,7 +44,8 @@ import static sun.security.ssl.CipherSui + * one of several keyed hashes, as associated with the cipher suite and + * protocol version. (SSL v3.0 uses one construct, TLS uses another.) + * +- * <P>NOTE: MAC computation is the only place in the SSL protocol that the ++ * <P> ++ * NOTE: MAC computation is the only place in the SSL protocol that the + * sequence number is used. It's also reset to zero with each change of + * a cipher spec, so this is the only place this state is needed. + * +@@ -129,15 +130,31 @@ final class MAC { + } + + /** ++ * Returns the hash function block length of the MAC alorithm. ++ */ ++ int hashBlockLen() { ++ return macAlg.hashBlockSize; ++ } ++ ++ /** ++ * Returns the hash function minimal padding length of the MAC alorithm. ++ */ ++ int minimalPaddingLen() { ++ return macAlg.minimalPaddingSize; ++ } ++ ++ /** + * Computes and returns the MAC for the data in this byte array. + * + * @param type record type + * @param buf compressed record on which the MAC is computed + * @param offset start of compressed record data + * @param len the size of the compressed record ++ * @param isSimulated if true, simulate the the MAC computation + */ +- final byte[] compute(byte type, byte buf[], int offset, int len) { +- return compute(type, null, buf, offset, len); ++ final byte[] compute(byte type, byte buf[], ++ int offset, int len, boolean isSimulated) { ++ return compute(type, null, buf, offset, len, isSimulated); + } + + /** +@@ -150,9 +167,10 @@ final class MAC { + * @param type record type + * @param bb a ByteBuffer in which the position and limit + * demarcate the data to be MAC'd. ++ * @param isSimulated if true, simulate the the MAC computation + */ +- final byte[] compute(byte type, ByteBuffer bb) { +- return compute(type, bb, null, 0, bb.remaining()); ++ final byte[] compute(byte type, ByteBuffer bb, boolean isSimulated) { ++ return compute(type, bb, null, 0, bb.remaining(), isSimulated); + } + + // increment the sequence number in the block array +@@ -168,18 +186,22 @@ final class MAC { + * Compute based on either buffer type, either bb.position/limit + * or buf/offset/len. + */ +- private byte[] compute(byte type, ByteBuffer bb, byte[] buf, int offset, int len) { ++ private byte[] compute(byte type, ByteBuffer bb, byte[] buf, ++ int offset, int len, boolean isSimulated) { + + if (macSize == 0) { + return nullMAC; + } + +- block[BLOCK_OFFSET_TYPE] = type; +- block[block.length - 2] = (byte)(len >> 8); +- block[block.length - 1] = (byte)(len ); ++ // MUST NOT increase the sequence number for a simulated computation. ++ if (!isSimulated) { ++ block[BLOCK_OFFSET_TYPE] = type; ++ block[block.length - 2] = (byte)(len >> 8); ++ block[block.length - 1] = (byte)(len ); + +- mac.update(block); +- incrementSequenceNumber(); ++ mac.update(block); ++ incrementSequenceNumber(); ++ } + + // content + if (bb != null) { +diff --git a/src/share/classes/sun/security/ssl/OutputRecord.java b/src/share/classes/sun/security/ssl/OutputRecord.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/OutputRecord.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/OutputRecord.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -204,7 +204,7 @@ class OutputRecord extends ByteArrayOutp + } + if (signer.MAClen() != 0) { + byte[] hash = signer.compute(contentType, buf, +- headerSize, count - headerSize); ++ headerSize, count - headerSize, false); + write(hash); + } + } +diff --git a/src/share/classes/sun/security/ssl/SSLEngineImpl.java b/src/share/classes/sun/security/ssl/SSLEngineImpl.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -919,34 +919,13 @@ final public class SSLEngineImpl extends + * throw a fatal alert if the integrity check fails. + */ + try { +- decryptedBB = inputRecord.decrypt(readCipher, readBB); ++ decryptedBB = inputRecord.decrypt(readMAC, readCipher, readBB); + } catch (BadPaddingException e) { +- // RFC 2246 states that decryption_failed should be used +- // for this purpose. However, that allows certain attacks, +- // so we just send bad record MAC. We also need to make +- // sure to always check the MAC to avoid a timing attack +- // for the same issue. See paper by Vaudenay et al. +- // +- // rewind the BB if necessary. +- readBB.rewind(); +- +- inputRecord.checkMAC(readMAC, readBB); +- +- // use the same alert types as for MAC failure below + byte alertType = (inputRecord.contentType() == + Record.ct_handshake) ? + Alerts.alert_handshake_failure : + Alerts.alert_bad_record_mac; +- fatal(alertType, "Invalid padding", e); +- } +- +- if (!inputRecord.checkMAC(readMAC, decryptedBB)) { +- if (inputRecord.contentType() == Record.ct_handshake) { +- fatal(Alerts.alert_handshake_failure, +- "bad handshake record MAC"); +- } else { +- fatal(Alerts.alert_bad_record_mac, "bad record MAC"); +- } ++ fatal(alertType, e.getMessage(), e); + } + + // if (!inputRecord.decompress(c)) +diff --git a/src/share/classes/sun/security/ssl/SSLSocketImpl.java b/src/share/classes/sun/security/ssl/SSLSocketImpl.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -922,27 +922,12 @@ final public class SSLSocketImpl extends + * throw a fatal alert if the integrity check fails. + */ + try { +- r.decrypt(readCipher); ++ r.decrypt(readMAC, readCipher); + } catch (BadPaddingException e) { +- // RFC 2246 states that decryption_failed should be used +- // for this purpose. However, that allows certain attacks, +- // so we just send bad record MAC. We also need to make +- // sure to always check the MAC to avoid a timing attack +- // for the same issue. See paper by Vaudenay et al. +- r.checkMAC(readMAC); +- // use the same alert types as for MAC failure below + byte alertType = (r.contentType() == Record.ct_handshake) + ? Alerts.alert_handshake_failure + : Alerts.alert_bad_record_mac; +- fatal(alertType, "Invalid padding", e); +- } +- if (!r.checkMAC(readMAC)) { +- if (r.contentType() == Record.ct_handshake) { +- fatal(Alerts.alert_handshake_failure, +- "bad handshake record MAC"); +- } else { +- fatal(Alerts.alert_bad_record_mac, "bad record MAC"); +- } ++ fatal(alertType, e.getMessage(), e); + } + + // if (!r.decompress(c))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/security/20130219/8007688.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,130 @@ +# HG changeset patch +# User coffeys +# Date 1360873966 0 +# Node ID 617e68a3948824283f15c36fcd8cf264c1dd0a99 +# Parent 25e83b78298b71abb46eb5a337ed7bddef418ca4 +8007688: Blacklist known bad certificate +Reviewed-by: mullan + +diff --git a/src/share/classes/sun/security/util/UntrustedCertificates.java b/src/share/classes/sun/security/util/UntrustedCertificates.java +--- openjdk/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java ++++ openjdk/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -739,5 +739,111 @@ public final class UntrustedCertificates + "B8WfedLHjFW/TMcnXlEWKz4=\n" + + "-----END CERTIFICATE-----"); + ++ // ++ // Revoked DigiCert code signing certificates used to sign malware ++ // ++ ++ // Subject: CN=Buster Paper Comercial Ltda, ++ // O=Buster Paper Comercial Ltda, ++ // L=S?o Jos? Dos Campos, ++ // ST=S?o Paulo, ++ // C=BR ++ // Issuer: CN=DigiCert Assured ID Code Signing CA-1, ++ // OU=www.digicert.com, ++ // O=DigiCert Inc, ++ // C=US ++ // Serial: 07:b4:4c:db:ff:fb:78:de:05:f4:26:16:72:a6:73:12 ++ add("buster-paper-comercial-ltda-72A67312", ++ "-----BEGIN CERTIFICATE-----\n" + ++ "MIIGwzCCBaugAwIBAgIQB7RM2//7eN4F9CYWcqZzEjANBgkqhkiG9w0BAQUFADBv\n" + ++ "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" + ++ "d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv\n" + ++ "ZGUgU2lnbmluZyBDQS0xMB4XDTEzMDExNzAwMDAwMFoXDTE0MDEyMjEyMDAwMFow\n" + ++ "gY4xCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMR4wHAYDVQQHDBVT\n" + ++ "w6NvIEpvc8OpIERvcyBDYW1wb3MxJDAiBgNVBAoTG0J1c3RlciBQYXBlciBDb21l\n" + ++ "cmNpYWwgTHRkYTEkMCIGA1UEAxMbQnVzdGVyIFBhcGVyIENvbWVyY2lhbCBMdGRh\n" + ++ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzO0l6jWIpEfO2oUpVHpL\n" + ++ "HETj5lzivNb0S9jKHgGJax917czh81PnGTxwxFXd6gLJuy/XFHvmiSi8g8jzlymn\n" + ++ "2Ji5zQ3CPaz7nomJokSUDlMVJ2qYWtctw4jrdjuI4qtn+koXXUFkWjkf8h8251I4\n" + ++ "tUs7S49HE2Go5owCYP3byajj7fsFAYR/Xb7TdVtndkZsUB/YgOjHovyACjouaNCi\n" + ++ "mDiRyQ6zLLjZGiyeD65Yiseuhp5b8/BL5h1p7w76QYMYMVQNAdtDKut2R8MBpuWf\n" + ++ "Ny7Eoi0x/gm1p9X5Rcl5aN7K0G4UtTAJKbkuUfXddsyFoM0Nx8uo8SgNQ8Y/X5Jx\n" + ++ "BwIDAQABo4IDOTCCAzUwHwYDVR0jBBgwFoAUe2jOKarAF75JeuHlP9an90WPNTIw\n" + ++ "HQYDVR0OBBYEFFLZ3n5nt/Eer7n1bvtOqMb1qKO5MA4GA1UdDwEB/wQEAwIHgDAT\n" + ++ "BgNVHSUEDDAKBggrBgEFBQcDAzBzBgNVHR8EbDBqMDOgMaAvhi1odHRwOi8vY3Js\n" + ++ "My5kaWdpY2VydC5jb20vYXNzdXJlZC1jcy0yMDExYS5jcmwwM6AxoC+GLWh0dHA6\n" + ++ "Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9hc3N1cmVkLWNzLTIwMTFhLmNybDCCAcQGA1Ud\n" + ++ "IASCAbswggG3MIIBswYJYIZIAYb9bAMBMIIBpDA6BggrBgEFBQcCARYuaHR0cDov\n" + ++ "L3d3dy5kaWdpY2VydC5jb20vc3NsLWNwcy1yZXBvc2l0b3J5Lmh0bTCCAWQGCCsG\n" + ++ "AQUFBwICMIIBVh6CAVIAQQBuAHkAIAB1AHMAZQAgAG8AZgAgAHQAaABpAHMAIABD\n" + ++ "AGUAcgB0AGkAZgBpAGMAYQB0AGUAIABjAG8AbgBzAHQAaQB0AHUAdABlAHMAIABh\n" + ++ "AGMAYwBlAHAAdABhAG4AYwBlACAAbwBmACAAdABoAGUAIABEAGkAZwBpAEMAZQBy\n" + ++ "AHQAIABDAFAALwBDAFAAUwAgAGEAbgBkACAAdABoAGUAIABSAGUAbAB5AGkAbgBn\n" + ++ "ACAAUABhAHIAdAB5ACAAQQBnAHIAZQBlAG0AZQBuAHQAIAB3AGgAaQBjAGgAIABs\n" + ++ "AGkAbQBpAHQAIABsAGkAYQBiAGkAbABpAHQAeQAgAGEAbgBkACAAYQByAGUAIABp\n" + ++ "AG4AYwBvAHIAcABvAHIAYQB0AGUAZAAgAGgAZQByAGUAaQBuACAAYgB5ACAAcgBl\n" + ++ "AGYAZQByAGUAbgBjAGUALjCBggYIKwYBBQUHAQEEdjB0MCQGCCsGAQUFBzABhhho\n" + ++ "dHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTAYIKwYBBQUHMAKGQGh0dHA6Ly9jYWNl\n" + ++ "cnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3VyZWRJRENvZGVTaWduaW5nQ0Et\n" + ++ "MS5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQUFAAOCAQEAPTTQvpOIikXI\n" + ++ "hTLnNbajaFRR5GhQpTzUNgBfF9VYSlNw/wMjpGsrh5RxaJCip52jbehmTgjMRhft\n" + ++ "jRYyml44PAVsCcR9uEoDpCZYpI1fHI1R+F8jd1C9rqprbSwwOG4xlg4SmvTHYs6e\n" + ++ "gBItQ/1p9XY+Sf4Wv1qOuOFL1qvV/5VyR2zdlOQCmKCeMgxt6a/tHLBDiAA67D44\n" + ++ "/vfdoNJl0CU2It0PO60jdCPFNWIRcxL+OSDqAoePeUC7xQ+JsTEIxuUE8+d6w6fc\n" + ++ "BV2mYb1flh22t46GLjh4gyo7xw3aL6L0L0jzlTT6IcEw6NIbaPbIKj/npQnHobYj\n" + ++ "XMuKLxbh7g==\n" + ++ "-----END CERTIFICATE-----"); ++ ++ // Subject: CN=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME, ++ // O=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME, ++ // L=S?o Paulo, ++ // ST=S?o Paulo, ++ // C=BR ++ // Issuer: CN=DigiCert Assured ID Code Signing CA-1, ++ // OU=www.digicert.com, ++ // O=DigiCert Inc, ++ // C=US ++ // Serial: 0a:38:9b:95:ee:73:6d:d1:3b:c0:ed:74:3f:d7:4d:2f ++ add("buster-assistencia-tecnica-electronica-ltda-3FD74D2F", ++ "-----BEGIN CERTIFICATE-----\n" + ++ "MIIG4DCCBcigAwIBAgIQCjible5zbdE7wO10P9dNLzANBgkqhkiG9w0BAQUFADBv\n" + ++ "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" + ++ "d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv\n" + ++ "ZGUgU2lnbmluZyBDQS0xMB4XDTEyMTEwOTAwMDAwMFoXDTEzMTExNDEyMDAwMFow\n" + ++ "gasxCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMRMwEQYDVQQHDApT\n" + ++ "w6NvIFBhdWxvMTgwNgYDVQQKEy9CVVNURVIgQVNTSVNURU5DSUEgVEVDTklDQSBF\n" + ++ "TEVUUk9OSUNBIExUREEgLSBNRTE4MDYGA1UEAxMvQlVTVEVSIEFTU0lTVEVOQ0lB\n" + ++ "IFRFQ05JQ0EgRUxFVFJPTklDQSBMVERBIC0gTUUwggEiMA0GCSqGSIb3DQEBAQUA\n" + ++ "A4IBDwAwggEKAoIBAQDAqNeEs5/B2CTXGjTOkUIdu6jV6qulOZwdw4sefHWYj1UR\n" + ++ "4z6zPk9kjpUgbnb402RFq88QtfInwddZ/wXn9OxMtDd/3TnC7HrhNS7ga79ZFL2V\n" + ++ "JnmzKHum2Yvh0q82QEJ9tHBR2X9VdKpUIH08Zs3k6cWWM1H0YX0cxA/HohhesQJW\n" + ++ "kwJ3urOIJiH/HeByDk8a1NS8safcCxk5vxvW4WvCg43iT09LeHY5Aa8abKw8lqVb\n" + ++ "0tD5ZSIjdmdj3TT1U37iAHLLRM2DXbxfdbhouUX1c5U1ZHAMA67HwjKiseOiDaHj\n" + ++ "NUGbC37C+cgbc9VVM/cURD8WvS0Kj6fQv7F2QtJDAgMBAAGjggM5MIIDNTAfBgNV\n" + ++ "HSMEGDAWgBR7aM4pqsAXvkl64eU/1qf3RY81MjAdBgNVHQ4EFgQU88EXKAyDsh30\n" + ++ "o9+Gu9a4xUy+FSMwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMD\n" + ++ "MHMGA1UdHwRsMGowM6AxoC+GLWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9hc3N1\n" + ++ "cmVkLWNzLTIwMTFhLmNybDAzoDGgL4YtaHR0cDovL2NybDQuZGlnaWNlcnQuY29t\n" + ++ "L2Fzc3VyZWQtY3MtMjAxMWEuY3JsMIIBxAYDVR0gBIIBuzCCAbcwggGzBglghkgB\n" + ++ "hv1sAwEwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9z\n" + ++ "c2wtY3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUHAgIwggFWHoIBUgBBAG4A\n" + ++ "eQAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQByAHQAaQBmAGkAYwBhAHQA\n" + ++ "ZQAgAGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEAbgBjAGUA\n" + ++ "IABvAGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMAUABTACAA\n" + ++ "YQBuAGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkAIABBAGcA\n" + ++ "cgBlAGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBtAGkAdAAgAGwAaQBhAGIA\n" + ++ "aQBsAGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8AcgBhAHQA\n" + ++ "ZQBkACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMIGC\n" + ++ "BggrBgEFBQcBAQR2MHQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0\n" + ++ "LmNvbTBMBggrBgEFBQcwAoZAaHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29tL0Rp\n" + ++ "Z2lDZXJ0QXNzdXJlZElEQ29kZVNpZ25pbmdDQS0xLmNydDAMBgNVHRMBAf8EAjAA\n" + ++ "MA0GCSqGSIb3DQEBBQUAA4IBAQAei1QmiXepje8OIfo/WonD4MIXgpPr2dfRaquQ\n" + ++ "A8q63OpTRSveyqdQDCSPpDRF/nvO1Y30yksZvIH1tNBsW5LBdxAKN3lFdBlqBwtE\n" + ++ "Q3jHc0KVVYRJ0FBaGE/PJHmRajscdAhYIcMPhTga0u0tDK+wOHEq3993dfl6yHjA\n" + ++ "XHU2iW5pnk75ZoE39zALD5eKXT8ZXrET5c3XUFJKWA+XuGmdmyzqo0Au49PanBv9\n" + ++ "UlZnabYfqoMArqMS0tGSX4cGgi9/2E+pHG9BX4sFW+ZDumroOA2pxyMWEKjxePEL\n" + ++ "zCOfhbsRWdMLYepauaNZOIMZXmFwcrIl0TGMkTAtATz+XmZc\n" + ++ "-----END CERTIFICATE-----"); ++ + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/security/20130304/8007014.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,477 @@ +# HG changeset patch +# User bae +# Date 1360857111 -14400 +# Node ID 44c99b68e36c57648829320843fbc77cf2d4c4d1 +# Parent b8b3916e20ed651fa6ad9da6ae96b2548a13f96c +8007014: Improve image handling +Reviewed-by: prr, mschoene, jgodinez + +diff --git a/src/share/classes/sun/awt/image/ByteComponentRaster.java b/src/share/classes/sun/awt/image/ByteComponentRaster.java +--- openjdk/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java ++++ openjdk/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java +@@ -868,6 +868,15 @@ + * or if data buffer has not enough capacity. + */ + protected final void verify() { ++ /* Need to re-verify the dimensions since a sample model may be ++ * specified to the constructor ++ */ ++ if (width <= 0 || height <= 0 || ++ height > (Integer.MAX_VALUE / width)) ++ { ++ throw new RasterFormatException("Invalid raster dimension"); ++ } ++ + for (int i = 0; i < dataOffsets.length; i++) { + if (dataOffsets[i] < 0) { + throw new RasterFormatException("Data offsets for band " + i +@@ -905,13 +914,14 @@ + lastPixelOffset += lastScanOffset; + + for (int i = 0; i < numDataElements; i++) { +- size = lastPixelOffset + dataOffsets[i]; + if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) { + throw new RasterFormatException("Incorrect band offset: " + + dataOffsets[i]); + + } + ++ size = lastPixelOffset + dataOffsets[i]; ++ + if (size > maxSize) { + maxSize = size; + } +diff --git a/src/share/classes/sun/awt/image/BytePackedRaster.java b/src/share/classes/sun/awt/image/BytePackedRaster.java +--- openjdk/jdk/src/share/classes/sun/awt/image/BytePackedRaster.java ++++ openjdk/jdk/src/share/classes/sun/awt/image/BytePackedRaster.java +@@ -1368,11 +1368,35 @@ + throw new RasterFormatException("Data offsets must be >= 0"); + } + ++ /* Need to re-verify the dimensions since a sample model may be ++ * specified to the constructor ++ */ ++ if (width <= 0 || height <= 0 || ++ height > (Integer.MAX_VALUE / width)) ++ { ++ throw new RasterFormatException("Invalid raster dimension"); ++ } ++ ++ ++ /* ++ * pixelBitstride was verified in constructor, so just make ++ * sure that it is safe to multiply it by width. ++ */ ++ if ((width - 1) > Integer.MAX_VALUE / pixelBitStride) { ++ throw new RasterFormatException("Invalid raster dimension"); ++ } ++ ++ if (scanlineStride < 0 || ++ scanlineStride > (Integer.MAX_VALUE / height)) ++ { ++ throw new RasterFormatException("Invalid scanline stride"); ++ } ++ + int lastbit = (dataBitOffset + + (height-1) * scanlineStride * 8 + + (width-1) * pixelBitStride + + pixelBitStride - 1); +- if (lastbit / 8 >= data.length) { ++ if (lastbit < 0 || lastbit / 8 >= data.length) { + throw new RasterFormatException("raster dimensions overflow " + + "array bounds"); + } +diff --git a/src/share/classes/sun/awt/image/IntegerComponentRaster.java b/src/share/classes/sun/awt/image/IntegerComponentRaster.java +--- openjdk/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java ++++ openjdk/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java +@@ -208,7 +208,7 @@ + " SinglePixelPackedSampleModel"); + } + +- verify(false); ++ verify(); + } + + +@@ -629,16 +629,26 @@ + } + + /** +- * Verify that the layout parameters are consistent with +- * the data. If strictCheck +- * is false, this method will check for ArrayIndexOutOfBounds conditions. If +- * strictCheck is true, this method will check for additional error +- * conditions such as line wraparound (width of a line greater than +- * the scanline stride). +- * @return String Error string, if the layout is incompatible with +- * the data. Otherwise returns null. ++ * Verify that the layout parameters are consistent with the data. ++ * ++ * The method verifies whether scanline stride and pixel stride do not ++ * cause an integer overflow during calculation of a position of the pixel ++ * in data buffer. It also verifies whether the data buffer has enough data ++ * to correspond the raster layout attributes. ++ * ++ * @throws RasterFormatException if an integer overflow is detected, ++ * or if data buffer has not enough capacity. + */ +- private void verify (boolean strictCheck) { ++ protected final void verify() { ++ /* Need to re-verify the dimensions since a sample model may be ++ * specified to the constructor ++ */ ++ if (width <= 0 || height <= 0 || ++ height > (Integer.MAX_VALUE / width)) ++ { ++ throw new RasterFormatException("Invalid raster dimension"); ++ } ++ + if (dataOffsets[0] < 0) { + throw new RasterFormatException("Data offset ("+dataOffsets[0]+ + ") must be >= 0"); +@@ -647,17 +657,46 @@ + int maxSize = 0; + int size; + +- for (int i=0; i < numDataElements; i++) { +- size = (height-1)*scanlineStride + (width-1)*pixelStride + +- dataOffsets[i]; ++ // we can be sure that width and height are greater than 0 ++ if (scanlineStride < 0 || ++ scanlineStride > (Integer.MAX_VALUE / height)) ++ { ++ // integer overflow ++ throw new RasterFormatException("Incorrect scanline stride: " ++ + scanlineStride); ++ } ++ int lastScanOffset = (height - 1) * scanlineStride; ++ ++ if (pixelStride < 0 || ++ pixelStride > (Integer.MAX_VALUE / width)) ++ { ++ // integer overflow ++ throw new RasterFormatException("Incorrect pixel stride: " ++ + pixelStride); ++ } ++ int lastPixelOffset = (width - 1) * pixelStride; ++ ++ if (lastPixelOffset > (Integer.MAX_VALUE - lastScanOffset)) { ++ // integer overflow ++ throw new RasterFormatException("Incorrect raster attributes"); ++ } ++ lastPixelOffset += lastScanOffset; ++ ++ for (int i = 0; i < numDataElements; i++) { ++ if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) { ++ throw new RasterFormatException("Incorrect band offset: " ++ + dataOffsets[i]); ++ } ++ ++ size = lastPixelOffset + dataOffsets[i]; ++ + if (size > maxSize) { + maxSize = size; + } + } + if (data.length < maxSize) { +- throw new RasterFormatException("Data array too small (should be "+ +- maxSize +- +" but is "+data.length+" )"); ++ throw new RasterFormatException("Data array too small (should be " ++ + maxSize + " )"); + } + } + +diff --git a/src/share/classes/sun/awt/image/IntegerInterleavedRaster.java b/src/share/classes/sun/awt/image/IntegerInterleavedRaster.java +--- openjdk/jdk/src/share/classes/sun/awt/image/IntegerInterleavedRaster.java ++++ openjdk/jdk/src/share/classes/sun/awt/image/IntegerInterleavedRaster.java +@@ -151,7 +151,7 @@ + throw new RasterFormatException("IntegerInterleavedRasters must have"+ + " SinglePixelPackedSampleModel"); + } +- verify(false); ++ verify(); + } + + +@@ -540,31 +540,6 @@ + return createCompatibleWritableRaster(width,height); + } + +- /** +- * Verify that the layout parameters are consistent with +- * the data. If strictCheck +- * is false, this method will check for ArrayIndexOutOfBounds conditions. If +- * strictCheck is true, this method will check for additional error +- * conditions such as line wraparound (width of a line greater than +- * the scanline stride). +- * @return String Error string, if the layout is incompatible with +- * the data. Otherwise returns null. +- */ +- private void verify (boolean strictCheck) { +- int maxSize = 0; +- int size; +- +- size = (height-1)*scanlineStride + (width-1) + dataOffsets[0]; +- if (size > maxSize) { +- maxSize = size; +- } +- if (data.length < maxSize) { +- throw new RasterFormatException("Data array too small (should be "+ +- maxSize +- +" but is "+data.length+" )"); +- } +- } +- + public String toString() { + return new String ("IntegerInterleavedRaster: width = "+width + +" height = " + height +diff --git a/src/share/classes/sun/awt/image/ShortComponentRaster.java b/src/share/classes/sun/awt/image/ShortComponentRaster.java +--- openjdk/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java ++++ openjdk/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java +@@ -802,6 +802,15 @@ + * or if data buffer has not enough capacity. + */ + protected final void verify() { ++ /* Need to re-verify the dimensions since a sample model may be ++ * specified to the constructor ++ */ ++ if (width <= 0 || height <= 0 || ++ height > (Integer.MAX_VALUE / width)) ++ { ++ throw new RasterFormatException("Invalid raster dimension"); ++ } ++ + for (int i = 0; i < dataOffsets.length; i++) { + if (dataOffsets[i] < 0) { + throw new RasterFormatException("Data offsets for band " + i +@@ -839,12 +848,13 @@ + lastPixelOffset += lastScanOffset; + + for (int i = 0; i < numDataElements; i++) { +- size = lastPixelOffset + dataOffsets[i]; + if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) { + throw new RasterFormatException("Incorrect band offset: " + + dataOffsets[i]); + } + ++ size = lastPixelOffset + dataOffsets[i]; ++ + if (size > maxSize) { + maxSize = size; + } +diff --git a/src/share/native/sun/awt/image/awt_parseImage.c b/src/share/native/sun/awt/image/awt_parseImage.c +--- openjdk/jdk/src/share/native/sun/awt/image/awt_parseImage.c ++++ openjdk/jdk/src/share/native/sun/awt/image/awt_parseImage.c +@@ -34,6 +34,7 @@ + #include "java_awt_color_ColorSpace.h" + #include "awt_Mlib.h" + #include "safe_alloc.h" ++#include "safe_math.h" + + static int setHints(JNIEnv *env, BufImageS_t *imageP); + +diff --git a/src/share/native/sun/awt/medialib/awt_ImagingLib.c b/src/share/native/sun/awt/medialib/awt_ImagingLib.c +--- openjdk/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c ++++ openjdk/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c +@@ -42,6 +42,7 @@ + #include "awt_Mlib.h" + #include "gdefs.h" + #include "safe_alloc.h" ++#include "safe_math.h" + + /*************************************************************************** + * Definitions * +@@ -1970,13 +1971,23 @@ + unsigned char *dP = dataP; + #define NUM_LINES 10 + int numLines = NUM_LINES; +- int nbytes = rasterP->width*4*NUM_LINES; ++ /* it is safe to calculate the scan length, because width has been verified ++ * on creation of the mlib image ++ */ ++ int scanLength = rasterP->width * 4; ++ ++ int nbytes = 0; ++ if (!SAFE_TO_MULT(numLines, scanLength)) { ++ return -1; ++ } ++ ++ nbytes = numLines * scanLength; + + for (y=0; y < rasterP->height; y+=numLines) { + /* getData, one scanline at a time */ + if (y+numLines > rasterP->height) { + numLines = rasterP->height - y; +- nbytes = rasterP->width*4*numLines; ++ nbytes = numLines * scanLength; + } + jpixels = (*env)->CallObjectMethod(env, imageP->jimage, + g_BImgGetRGBMID, 0, y, +@@ -2106,8 +2117,14 @@ + if (cvtToDefault) { + int status = 0; + *mlibImagePP = (*sMlibSysFns.createFP)(MLIB_BYTE, 4, width, height); ++ if (*mlibImagePP == NULL) { ++ return -1; ++ } + cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP); +- /* Make sure the image is cleared */ ++ /* Make sure the image is cleared. ++ * NB: the image dimension is already verified, so we can ++ * safely calculate the length of the buffer. ++ */ + memset(cDataP, 0, width*height*4); + + if (!isSrc) { +@@ -2357,6 +2374,9 @@ + case sun_awt_image_IntegerComponentRaster_TYPE_BYTE_PACKED_SAMPLES: + *mlibImagePP = (*sMlibSysFns.createFP)(MLIB_BYTE, rasterP->numBands, + width, height); ++ if (*mlibImagePP == NULL) { ++ return -1; ++ } + if (!isSrc) return 0; + cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP); + return expandPackedBCR(env, rasterP, -1, cDataP); +@@ -2365,6 +2385,9 @@ + if (rasterP->sppsm.maxBitSize <= 8) { + *mlibImagePP = (*sMlibSysFns.createFP)(MLIB_BYTE, rasterP->numBands, + width, height); ++ if (*mlibImagePP == NULL) { ++ return -1; ++ } + if (!isSrc) return 0; + cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP); + return expandPackedSCR(env, rasterP, -1, cDataP); +@@ -2374,6 +2397,9 @@ + if (rasterP->sppsm.maxBitSize <= 8) { + *mlibImagePP = (*sMlibSysFns.createFP)(MLIB_BYTE, rasterP->numBands, + width, height); ++ if (*mlibImagePP == NULL) { ++ return -1; ++ } + if (!isSrc) return 0; + cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP); + return expandPackedICR(env, rasterP, -1, cDataP); +diff --git a/src/share/native/sun/awt/medialib/mlib_ImageCreate.c b/src/share/native/sun/awt/medialib/mlib_ImageCreate.c +--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c ++++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c +@@ -120,6 +120,7 @@ + #include "mlib_image.h" + #include "mlib_ImageRowTable.h" + #include "mlib_ImageCreate.h" ++#include "safe_math.h" + + /***************************************************************/ + mlib_image* mlib_ImageSet(mlib_image *image, +@@ -247,28 +248,50 @@ + return NULL; + }; + ++ if (!SAFE_TO_MULT(width, channels)) { ++ return NULL; ++ } ++ ++ wb = width * channels; ++ + switch (type) { + case MLIB_DOUBLE: +- wb = width * channels * 8; ++ if (!SAFE_TO_MULT(wb, 8)) { ++ return NULL; ++ } ++ wb *= 8; + break; + case MLIB_FLOAT: + case MLIB_INT: +- wb = width * channels * 4; ++ if (!SAFE_TO_MULT(wb, 4)) { ++ return NULL; ++ } ++ wb *= 4; + break; + case MLIB_USHORT: + case MLIB_SHORT: +- wb = width * channels * 2; ++ if (!SAFE_TO_MULT(wb, 4)) { ++ return NULL; ++ } ++ wb *= 2; + break; + case MLIB_BYTE: +- wb = width * channels; ++ // wb is ready + break; + case MLIB_BIT: +- wb = (width * channels + 7) / 8; ++ if (!SAFE_TO_ADD(7, wb)) { ++ return NULL; ++ } ++ wb = (wb + 7) / 8; + break; + default: + return NULL; + } + ++ if (!SAFE_TO_MULT(wb, height)) { ++ return NULL; ++ } ++ + data = mlib_malloc(wb * height); + if (data == NULL) { + return NULL; +diff --git a/src/share/native/sun/awt/medialib/safe_alloc.h b/src/share/native/sun/awt/medialib/safe_alloc.h +--- openjdk/jdk/src/share/native/sun/awt/medialib/safe_alloc.h ++++ openjdk/jdk/src/share/native/sun/awt/medialib/safe_alloc.h +@@ -41,10 +41,4 @@ + (((w) > 0) && ((h) > 0) && ((sz) > 0) && \ + (((0xffffffffu / ((juint)(w))) / ((juint)(h))) > ((juint)(sz)))) + +-#define SAFE_TO_MULT(a, b) \ +- (((a) > 0) && ((b) >= 0) && ((0x7fffffff / (a)) > (b))) +- +-#define SAFE_TO_ADD(a, b) \ +- (((a) >= 0) && ((b) >= 0) && ((0x7fffffff - (a)) > (b))) +- + #endif // __SAFE_ALLOC_H__ +diff --git a/src/share/native/sun/awt/medialib/safe_math.h b/src/share/native/sun/awt/medialib/safe_math.h +new file mode 100644 +--- /dev/null ++++ openjdk/jdk/src/share/native/sun/awt/medialib/safe_math.h +@@ -0,0 +1,35 @@ ++/* ++ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. Oracle designates this ++ * particular file as subject to the "Classpath" exception as provided ++ * by Oracle in the LICENSE file that accompanied this code. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++#ifndef __SAFE_MATH_H__ ++#define __SAFE_MATH_H__ ++ ++#define SAFE_TO_MULT(a, b) \ ++ (((a) > 0) && ((b) >= 0) && ((0x7fffffff / (a)) > (b))) ++ ++#define SAFE_TO_ADD(a, b) \ ++ (((a) >= 0) && ((b) >= 0) && ((0x7fffffff - (a)) > (b))) ++ ++#endif // __SAFE_MATH_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/security/20130304/8007675.patch Tue Mar 19 00:21:31 2013 +0000 @@ -0,0 +1,416 @@ +# HG changeset patch +# User bae +# Date 1362257363 -10800 +# Node ID 9714f53ef17344fbcb6dc2249a7b238e6292f726 +# Parent 44c99b68e36c57648829320843fbc77cf2d4c4d1 +8007675: Improve color conversion +Reviewed-by: prr, jgodinez + +diff --git a/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java b/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java +--- openjdk/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java ++++ openjdk/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java +@@ -99,50 +99,75 @@ + int offset; + + Object dataArray; +- private LCMSImageLayout(int np, int pixelType, int pixelSize) { ++ private int dataArrayLength; /* in bytes */ ++ ++ private LCMSImageLayout(int np, int pixelType, int pixelSize) ++ throws ImageLayoutException ++ { + this.pixelType = pixelType; + width = np; + height = 1; +- nextRowOffset = np*pixelSize; ++ nextRowOffset = safeMult(pixelSize, np); + offset = 0; + } + + private LCMSImageLayout(int width, int height, int pixelType, +- int pixelSize) { ++ int pixelSize) ++ throws ImageLayoutException ++ { + this.pixelType = pixelType; + this.width = width; + this.height = height; +- nextRowOffset = width*pixelSize; ++ nextRowOffset = safeMult(pixelSize, width); + offset = 0; + } + + +- public LCMSImageLayout(byte[] data, int np, int pixelType, int pixelSize) { ++ public LCMSImageLayout(byte[] data, int np, int pixelType, int pixelSize) ++ throws ImageLayoutException ++ { + this(np, pixelType, pixelSize); + dataType = DT_BYTE; + dataArray = data; ++ dataArrayLength = data.length; ++ ++ verify(); + } + +- public LCMSImageLayout(short[] data, int np, int pixelType, int pixelSize) { ++ public LCMSImageLayout(short[] data, int np, int pixelType, int pixelSize) ++ throws ImageLayoutException ++ { + this(np, pixelType, pixelSize); + dataType = DT_SHORT; + dataArray = data; ++ dataArrayLength = 2 * data.length; ++ ++ verify(); + } + +- public LCMSImageLayout(int[] data, int np, int pixelType, int pixelSize) { ++ public LCMSImageLayout(int[] data, int np, int pixelType, int pixelSize) ++ throws ImageLayoutException ++ { + this(np, pixelType, pixelSize); + dataType = DT_INT; + dataArray = data; ++ dataArrayLength = 4 * data.length; ++ ++ verify(); + } + + public LCMSImageLayout(double[] data, int np, int pixelType, int pixelSize) ++ throws ImageLayoutException + { + this(np, pixelType, pixelSize); + dataType = DT_DOUBLE; + dataArray = data; ++ dataArrayLength = 8 * data.length; ++ ++ verify(); + } + +- public LCMSImageLayout(BufferedImage image) { ++ public LCMSImageLayout(BufferedImage image) throws ImageLayoutException { + ShortComponentRaster shortRaster; + IntegerComponentRaster intRaster; + ByteComponentRaster byteRaster; +@@ -186,9 +211,13 @@ + case BufferedImage.TYPE_INT_ARGB: + case BufferedImage.TYPE_INT_BGR: + intRaster = (IntegerComponentRaster)image.getRaster(); +- nextRowOffset = intRaster.getScanlineStride()*4; +- offset = intRaster.getDataOffset(0)*4; ++ ++ nextRowOffset = safeMult(4, intRaster.getScanlineStride()); ++ ++ offset = safeMult(4, intRaster.getDataOffset(0)); ++ + dataArray = intRaster.getDataStorage(); ++ dataArrayLength = 4 * intRaster.getDataStorage().length; + dataType = DT_INT; + break; + +@@ -196,8 +225,10 @@ + case BufferedImage.TYPE_4BYTE_ABGR: + byteRaster = (ByteComponentRaster)image.getRaster(); + nextRowOffset = byteRaster.getScanlineStride(); +- offset = byteRaster.getDataOffset(0); ++ int firstBand = image.getSampleModel().getNumBands() - 1; ++ offset = byteRaster.getDataOffset(firstBand); + dataArray = byteRaster.getDataStorage(); ++ dataArrayLength = byteRaster.getDataStorage().length; + dataType = DT_BYTE; + break; + +@@ -206,17 +237,20 @@ + nextRowOffset = byteRaster.getScanlineStride(); + offset = byteRaster.getDataOffset(0); + dataArray = byteRaster.getDataStorage(); ++ dataArrayLength = byteRaster.getDataStorage().length; + dataType = DT_BYTE; + break; + + case BufferedImage.TYPE_USHORT_GRAY: + shortRaster = (ShortComponentRaster)image.getRaster(); +- nextRowOffset = shortRaster.getScanlineStride()*2; +- offset = shortRaster.getDataOffset(0) * 2; ++ nextRowOffset = safeMult(2, shortRaster.getScanlineStride()); ++ offset = safeMult(2, shortRaster.getDataOffset(0)); + dataArray = shortRaster.getDataStorage(); ++ dataArrayLength = 2 * shortRaster.getDataStorage().length; + dataType = DT_SHORT; + break; + } ++ verify(); + } + + public static boolean isSupported(BufferedImage image) { +@@ -232,4 +266,45 @@ + } + return false; + } ++ ++ private void verify() throws ImageLayoutException { ++ ++ if (offset < 0 || offset >= dataArrayLength) { ++ throw new ImageLayoutException("Invalid image layout"); ++ } ++ ++ int lastPixelOffset = safeMult(nextRowOffset, (height - 1)); ++ ++ lastPixelOffset = safeAdd(lastPixelOffset, (width - 1)); ++ ++ int off = safeAdd(offset, lastPixelOffset); ++ ++ if (off < 0 || off >= dataArrayLength) { ++ throw new ImageLayoutException("Invalid image layout"); ++ } ++ } ++ ++ static int safeAdd(int a, int b) throws ImageLayoutException { ++ long res = a; ++ res += b; ++ if (res < Integer.MIN_VALUE || res > Integer.MAX_VALUE) { ++ throw new ImageLayoutException("Invalid image layout"); ++ } ++ return (int)res; ++ } ++ ++ static int safeMult(int a, int b) throws ImageLayoutException { ++ long res = a; ++ res *= b; ++ if (res < Integer.MIN_VALUE || res > Integer.MAX_VALUE) { ++ throw new ImageLayoutException("Invalid image layout"); ++ } ++ return (int)res; ++ } ++ ++ public static class ImageLayoutException extends Exception { ++ public ImageLayoutException(String message) { ++ super(message); ++ } ++ } + } +diff --git a/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java b/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java +--- openjdk/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java ++++ openjdk/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java +@@ -51,6 +51,7 @@ + import java.awt.image.ComponentSampleModel; + import sun.java2d.cmm.*; + import sun.java2d.cmm.lcms.*; ++import static sun.java2d.cmm.lcms.LCMSImageLayout.ImageLayoutException; + + + public class LCMSTransform implements ColorTransform { +@@ -116,8 +117,12 @@ + LCMSImageLayout.isSupported(dst)) + { + synchronized(this) { +- LCMS.colorConvert(this, new LCMSImageLayout(src), +- new LCMSImageLayout(dst)); ++ try { ++ LCMS.colorConvert(this, new LCMSImageLayout(src), ++ new LCMSImageLayout(dst)); ++ } catch (ImageLayoutException e) { ++ throw new CMMException("Unable to convert images"); ++ } + } + return; + } +@@ -177,14 +182,18 @@ + } + int idx; + // TODO check for src npixels = dst npixels +- srcIL = new LCMSImageLayout( +- srcLine, srcLine.length/getNumInComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | +- LCMSImageLayout.BYTES_SH(1), getNumInComponents()); +- dstIL = new LCMSImageLayout( +- dstLine, dstLine.length/getNumOutComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | +- LCMSImageLayout.BYTES_SH(1), getNumOutComponents()); ++ try { ++ srcIL = new LCMSImageLayout( ++ srcLine, srcLine.length/getNumInComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | ++ LCMSImageLayout.BYTES_SH(1), getNumInComponents()); ++ dstIL = new LCMSImageLayout( ++ dstLine, dstLine.length/getNumOutComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | ++ LCMSImageLayout.BYTES_SH(1), getNumOutComponents()); ++ } catch (ImageLayoutException e) { ++ throw new CMMException("Unable to convert images"); ++ } + // process each scanline + for (int y = 0; y < h; y++) { + // convert src scanline +@@ -234,16 +243,19 @@ + alpha = new float[w]; + } + int idx; +- srcIL = new LCMSImageLayout( +- srcLine, srcLine.length/getNumInComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | +- LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2); ++ try { ++ srcIL = new LCMSImageLayout( ++ srcLine, srcLine.length/getNumInComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | ++ LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2); + +- dstIL = new LCMSImageLayout( +- dstLine, dstLine.length/getNumOutComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | +- LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); +- ++ dstIL = new LCMSImageLayout( ++ dstLine, dstLine.length/getNumOutComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | ++ LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); ++ } catch (ImageLayoutException e) { ++ throw new CMMException("Unable to convert images"); ++ } + // process each scanline + for (int y = 0; y < h; y++) { + // convert src scanline +@@ -353,16 +365,19 @@ + short[] srcLine = new short[w * srcNumBands]; + short[] dstLine = new short[w * dstNumBands]; + int idx; +- srcIL = new LCMSImageLayout( +- srcLine, srcLine.length/getNumInComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | +- LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2); ++ try { ++ srcIL = new LCMSImageLayout( ++ srcLine, srcLine.length/getNumInComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | ++ LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2); + +- dstIL = new LCMSImageLayout( +- dstLine, dstLine.length/getNumOutComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | +- LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); +- ++ dstIL = new LCMSImageLayout( ++ dstLine, dstLine.length/getNumOutComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | ++ LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); ++ } catch (ImageLayoutException e) { ++ throw new CMMException("Unable to convert rasters"); ++ } + // process each scanline + for (int y = 0; y < h; y++, ys++, yd++) { + // get src scanline +@@ -447,15 +462,18 @@ + byte[] dstLine = new byte[w * dstNumBands]; + int idx; + // TODO check for src npixels = dst npixels +- srcIL = new LCMSImageLayout( +- srcLine, srcLine.length/getNumInComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | +- LCMSImageLayout.BYTES_SH(1), getNumInComponents()); +- dstIL = new LCMSImageLayout( +- dstLine, dstLine.length/getNumOutComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | +- LCMSImageLayout.BYTES_SH(1), getNumOutComponents()); +- ++ try { ++ srcIL = new LCMSImageLayout( ++ srcLine, srcLine.length/getNumInComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | ++ LCMSImageLayout.BYTES_SH(1), getNumInComponents()); ++ dstIL = new LCMSImageLayout( ++ dstLine, dstLine.length/getNumOutComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | ++ LCMSImageLayout.BYTES_SH(1), getNumOutComponents()); ++ } catch (ImageLayoutException e) { ++ throw new CMMException("Unable to convert rasters"); ++ } + // process each scanline + for (int y = 0; y < h; y++, ys++, yd++) { + // get src scanline +@@ -489,16 +507,20 @@ + short[] srcLine = new short[w * srcNumBands]; + short[] dstLine = new short[w * dstNumBands]; + int idx; +- srcIL = new LCMSImageLayout( +- srcLine, srcLine.length/getNumInComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | +- LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2); + +- dstIL = new LCMSImageLayout( +- dstLine, dstLine.length/getNumOutComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | +- LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); ++ try { ++ srcIL = new LCMSImageLayout( ++ srcLine, srcLine.length/getNumInComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | ++ LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2); + ++ dstIL = new LCMSImageLayout( ++ dstLine, dstLine.length/getNumOutComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | ++ LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); ++ } catch (ImageLayoutException e) { ++ throw new CMMException("Unable to convert rasters"); ++ } + // process each scanline + for (int y = 0; y < h; y++, ys++, yd++) { + // get src scanline +@@ -540,15 +562,19 @@ + dst = new short [(src.length/getNumInComponents())*getNumOutComponents()]; + } + +- LCMSImageLayout srcIL = new LCMSImageLayout( +- src, src.length/getNumInComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | +- LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2); ++ try { ++ LCMSImageLayout srcIL = new LCMSImageLayout( ++ src, src.length/getNumInComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | ++ LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2); + +- LCMSImageLayout dstIL = new LCMSImageLayout( +- dst, dst.length/getNumOutComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | +- LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); ++ LCMSImageLayout dstIL = new LCMSImageLayout( ++ dst, dst.length/getNumOutComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | ++ LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2); ++ } catch (ImageLayoutException e) { ++ throw new CMMException("Unable to convert data"); ++ } + + synchronized(this) { + LCMS.colorConvert(this, srcIL, dstIL); +@@ -562,15 +588,19 @@ + dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()]; + } + +- LCMSImageLayout srcIL = new LCMSImageLayout( +- src, src.length/getNumInComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | +- LCMSImageLayout.BYTES_SH(1), getNumInComponents()); ++ try { ++ LCMSImageLayout srcIL = new LCMSImageLayout( ++ src, src.length/getNumInComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumInComponents()) | ++ LCMSImageLayout.BYTES_SH(1), getNumInComponents()); + +- LCMSImageLayout dstIL = new LCMSImageLayout( +- dst, dst.length/getNumOutComponents(), +- LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | +- LCMSImageLayout.BYTES_SH(1), getNumOutComponents()); ++ LCMSImageLayout dstIL = new LCMSImageLayout( ++ dst, dst.length/getNumOutComponents(), ++ LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) | ++ LCMSImageLayout.BYTES_SH(1), getNumOutComponents()); ++ } catch (ImageLayoutException e) { ++ throw new CMMException("Unable to convert data"); ++ } + + synchronized(this) { + LCMS.colorConvert(this, srcIL, dstIL);
--- a/patches/systemtap-alloc-size-workaround.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -Generating a dwarf location expression for variable * "constant" as used -in this probe argument triggers unforseen complications. See -https://bugzilla.redhat.com/show_bug.cgi?id=613824 -Workaround for now by passing the size without HeapWordSize adjustment. -See also the hotspot.object_alloc in tapset/hotspot.stp[.in]. - ---- openjdk.orig/hotspot/src/share/vm/runtime/sharedRuntime.cpp 2010-05-18 20:00:22.130618755 +0200 -+++ openjdk/hotspot/src/share/vm/runtime/sharedRuntime.cpp 2010-07-28 22:53:23.662310007 +0200 -@@ -711,7 +711,7 @@ - int size = o->size(); - symbolOop name = klass->name(); - HS_DTRACE_PROBE4(hotspot, object__alloc, get_java_tid(thread), -- name->bytes(), name->utf8_length(), size * HeapWordSize); -+ name->bytes(), name->utf8_length(), size); - return 0; - } -
--- a/patches/systemtap_gc.patch Wed Feb 13 23:54:10 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,369 +0,0 @@ ---- openjdk.orig/hotspot/src/share/vm/compiler/oopMap.cpp 2012-06-26 09:24:22.390325184 -0400 -+++ openjdk/hotspot/src/share/vm/compiler/oopMap.cpp 2012-07-06 10:12:44.981413003 -0400 -@@ -33,9 +33,13 @@ - #include "memory/resourceArea.hpp" - #include "runtime/frame.inline.hpp" - #include "runtime/signature.hpp" -+#include "utilities/dtrace.hpp" - #ifdef COMPILER1 - #include "c1/c1_Defs.hpp" - #endif -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL1(provider, gc__collection__delete, *uintptr_t); -+#endif /* !USDT2 */ - - // OopMapStream - -@@ -677,6 +681,9 @@ - " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: %d)", - derived_loc, (address)*derived_loc, (address)base, offset); - } -+#ifndef USDT2 -+ HS_DTRACE_PROBE1(hotspot, gc__collection__delete, entry); -+#endif /* !USDT2 */ - - // Delete entry - delete entry; ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2012-07-12 09:48:40.349999515 -0400 -+++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2012-07-19 18:38:07.560757426 -0400 -@@ -53,11 +53,18 @@ - #include "runtime/vmThread.hpp" - #include "services/management.hpp" - #include "services/memoryService.hpp" -+#include "utilities/dtrace.hpp" - #include "utilities/events.hpp" - #include "utilities/stack.inline.hpp" - - #include <math.h> - -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__ParallelCompact__clear, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parallel__collect, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__move, *uintptr_t, *uintptr_t, *uintptr_t, *uintptr_t); -+#endif /* !USDT2 */ -+ - // All sizes are in HeapWords. - const size_t ParallelCompactData::Log2RegionSize = 9; // 512 words - const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize; -@@ -433,6 +439,9 @@ - - void ParallelCompactData::clear() - { -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__ParallelCompact__clear, &_region_data, _region_data->data_location()); -+#endif /* !USDT2 */ - memset(_region_data, 0, _region_vspace->committed_size()); - } - -@@ -1970,6 +1979,9 @@ - "should be in vm thread"); - - ParallelScavengeHeap* heap = gc_heap(); -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__parallel__collect, heap, heap->gc_cause()); -+#endif /* !USDT2 */ - GCCause::Cause gc_cause = heap->gc_cause(); - assert(!heap->is_gc_active(), "not reentrant"); - -@@ -3376,6 +3388,9 @@ - // past the end of the partial object entering the region (if any). - HeapWord* const dest_addr = sd.partial_obj_end(dp_region); - HeapWord* const new_top = _space_info[space_id].new_top(); -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__move, &beg_addr, &end_addr, &dest_addr, &new_top); -+#endif /* !USDT2 */ - assert(new_top >= dest_addr, "bad new_top value"); - const size_t words = pointer_delta(new_top, dest_addr); - ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2012-08-15 12:04:43.837439833 -0400 -+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2012-08-15 12:01:47.897745719 -0400 -@@ -45,8 +45,13 @@ - #include "runtime/thread.hpp" - #include "runtime/vmThread.hpp" - #include "utilities/copy.hpp" -+#include "utilities/dtrace.hpp" - #include "utilities/events.hpp" - -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__G1__begin, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__G1__end, *uintptr_t, *uintptr_t); -+ #endif /* !USDT2 */ - class HeapRegion; - - void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, -@@ -84,6 +89,9 @@ - // The marking doesn't preserve the marks of biased objects. - BiasedLocking::preserve_marks(); - -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__G1__begin, &sh, sh->gc_cause()); -+#endif /* !USDT2 */ - mark_sweep_phase1(marked_for_unloading, clear_all_softrefs); - - mark_sweep_phase2(); -@@ -103,6 +111,9 @@ - GenRemSet* rs = sh->rem_set(); - rs->invalidate(sh->perm_gen()->used_region(), true /*whole_heap*/); - -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__G1__end, &sh, sh->gc_cause()); -+#endif /* !USDT2 */ - // "free at last gc" is calculated from these. - // CHF: cheating for now!!! - // Universe::set_heap_capacity_at_last_gc(Universe::heap()->capacity()); ---- openjdk.orig/hotspot/src/share/vm/memory/tenuredGeneration.cpp 2012-08-15 12:03:43.009543167 -0400 -+++ openjdk/hotspot/src/share/vm/memory/tenuredGeneration.cpp 2012-08-15 12:14:25.414381449 -0400 -@@ -33,6 +33,12 @@ - #include "memory/tenuredGeneration.hpp" - #include "oops/oop.inline.hpp" - #include "runtime/java.hpp" -+#include "utilities/dtrace.hpp" -+ -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__tenured__begin, bool, bool, size_t, bool); -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__tenured__end, bool, bool, size_t, bool); -+#endif /* !USDT2 */ - - TenuredGeneration::TenuredGeneration(ReservedSpace rs, - size_t initial_byte_size, int level, -@@ -307,8 +313,14 @@ - size_t size, - bool is_tlab) { - retire_alloc_buffers_before_full_gc(); -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__tenured__begin, full, clear_all_soft_refs, size, is_tlab); -+#endif /* !USDT2 */ - OneContigSpaceCardGeneration::collect(full, clear_all_soft_refs, - size, is_tlab); -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__tenured__end, full, clear_all_soft_refs, size, is_tlab); -+#endif /* !USDT2 */ - } - - void TenuredGeneration::update_gc_stats(int current_level, ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2012-08-15 12:03:43.039543116 -0400 -+++ openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2012-08-15 12:18:57.181932342 -0400 -@@ -49,6 +49,12 @@ - #include "utilities/copy.hpp" - #include "utilities/globalDefinitions.hpp" - #include "utilities/workgroup.hpp" -+#include "utilities/dtrace.hpp" -+ -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__parnew__begin, bool, bool, size_t, bool); -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__parnew__end, bool, bool, size_t, bool); -+#endif /* !USDT2 */ - - #ifdef _MSC_VER - #pragma warning( push ) -@@ -878,6 +884,9 @@ - bool clear_all_soft_refs, - size_t size, - bool is_tlab) { -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__parnew__begin, full, clear_all_soft_refs, size, is_tlab); -+#endif /* !USDT2 */ - assert(full || size > 0, "otherwise we don't want to collect"); - GenCollectedHeap* gch = GenCollectedHeap::heap(); - assert(gch->kind() == CollectedHeap::GenCollectedHeap, -@@ -1032,6 +1041,10 @@ - gch->print_heap_change(gch_prev_used); - } - -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__parnew__end, full, clear_all_soft_refs, size, is_tlab); -+#endif /* !USDT2 */ -+ - if (PrintGCDetails && ParallelGCVerbose) { - TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats()); - TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats()); ---- openjdk.orig/hotspot/src/share/vm/memory/defNewGeneration.cpp 2012-08-15 12:03:43.010543164 -0400 -+++ openjdk/hotspot/src/share/vm/memory/defNewGeneration.cpp 2012-08-15 12:21:41.076673646 -0400 -@@ -38,6 +38,7 @@ - #include "oops/oop.inline.hpp" - #include "runtime/java.hpp" - #include "utilities/copy.hpp" -+#include "utilities/dtrace.hpp" - #include "utilities/stack.inline.hpp" - #ifdef TARGET_OS_FAMILY_linux - # include "thread_linux.inline.hpp" -@@ -51,7 +52,10 @@ - #ifdef TARGET_OS_FAMILY_windows - # include "thread_windows.inline.hpp" - #endif -- -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__defnew__begin, bool, bool, size_t, bool); -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__defnew__end, bool, bool, size_t, bool); -+#endif /* !USDT2 */ - // - // DefNewGeneration functions. - -@@ -528,6 +532,9 @@ - bool clear_all_soft_refs, - size_t size, - bool is_tlab) { -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__defnew__begin, full, clear_all_soft_refs, size, is_tlab); -+#endif /* !USDT2 */ - assert(full || size > 0, "otherwise we don't want to collect"); - GenCollectedHeap* gch = GenCollectedHeap::heap(); - _next_gen = gch->next_gen(this); -@@ -661,6 +668,10 @@ - to()->set_concurrent_iteration_safe_limit(to()->top()); - SpecializationStats::print(); - update_time_of_last_gc(os::javaTimeMillis()); -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__defnew__end, full, clear_all_soft_refs, size, is_tlab); -+#endif /* !USDT2 */ -+ - } - - class RemoveForwardPointerClosure: public ObjectClosure { ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2012-08-15 12:03:43.044543106 -0400 -+++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2012-08-15 12:25:26.632316692 -0400 -@@ -55,6 +55,12 @@ - #include "runtime/vmThread.hpp" - #include "services/memoryService.hpp" - #include "services/runtimeService.hpp" -+#include "utilities/dtrace.hpp" -+ -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__begin, bool, bool, size_t, bool); -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__end, bool, bool, size_t, bool); -+#endif /* !USDT2 */ - - // statics - CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; -@@ -1647,7 +1653,13 @@ - size_t size, - bool tlab) - { -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__begin, full, clear_all_soft_refs, size, tlab); -+#endif /* !USDT2 */ - collector()->collect(full, clear_all_soft_refs, size, tlab); -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__end, full, clear_all_soft_refs, size, tlab); -+#endif /* !USDT2 */ - } - - void CMSCollector::collect(bool full, ---- openjdk.orig/hotspot/src/share/vm/memory/generation.cpp 2012-08-15 12:03:43.009543167 -0400 -+++ openjdk/hotspot/src/share/vm/memory/generation.cpp 2012-08-15 12:27:46.378095083 -0400 -@@ -39,8 +39,14 @@ - #include "oops/oop.inline.hpp" - #include "runtime/java.hpp" - #include "utilities/copy.hpp" -+#include "utilities/dtrace.hpp" - #include "utilities/events.hpp" - -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__begin, bool, bool, size_t, bool); -+ HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig__end, bool, bool, size_t, bool); -+#endif /* !USDT2 */ -+ - Generation::Generation(ReservedSpace rs, size_t initial_size, int level) : - _level(level), - _ref_processor(NULL) { -@@ -470,7 +476,13 @@ - // refs discovery is over the entire heap, not just this generation - ReferenceProcessorSpanMutator - x(ref_processor(), GenCollectedHeap::heap()->reserved_region()); -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__begin, full, clear_all_soft_refs, size, is_tlab); -+#endif /* !USDT2 */ - GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs); -+#ifndef USDT2 -+ HS_DTRACE_PROBE4(hotspot, gc__collection__contig__end, full, clear_all_soft_refs, size, is_tlab); -+#endif /* !USDT2 */ - SpecializationStats::print(); - } - ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp 2012-07-25 13:24:07.000000000 -0400 -+++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp 2012-08-17 10:26:44.181117802 -0400 -@@ -51,8 +51,17 @@ - #include "runtime/vmThread.hpp" - #include "runtime/vm_operations.hpp" - #include "services/memoryService.hpp" -+#include "utilities/dtrace.hpp" - #include "utilities/stack.inline.hpp" - -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSScavenge__begin, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSScavenge__end, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSParallelCompact__begin, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSParallelCompact__end, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSMarkSweep__begin, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__PSMarkSweep__end, *uintptr_t, *uintptr_t); -+#endif /* !USDT2 */ - - HeapWord* PSScavenge::_to_space_top_before_gc = NULL; - int PSScavenge::_consecutive_skipped_scavenges = 0; -@@ -226,7 +235,13 @@ - PSAdaptiveSizePolicy* policy = heap->size_policy(); - IsGCActiveMark mark; - -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__PSScavenge__begin, &heap, heap->gc_cause()); -+#endif /* !USDT2 */ - bool scavenge_was_done = PSScavenge::invoke_no_policy(); -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__PSScavenge__end, &heap, heap->gc_cause()); -+#endif /* !USDT2 */ - - PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); - if (UsePerfData) -@@ -243,9 +258,21 @@ - const bool clear_all_softrefs = cp->should_clear_all_soft_refs(); - - if (UseParallelOldGC) { -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__PSParallelCompact__begin, &heap, heap->gc_cause()); -+#endif /* !USDT2 */ - PSParallelCompact::invoke_no_policy(clear_all_softrefs); -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__PSParallelCompact__end, &heap, heap->gc_cause()); -+#endif /* !USDT2 */ - } else { -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__PSMarkSweep__begin, &heap, heap->gc_cause()); -+#endif /* !USDT2 */ - PSMarkSweep::invoke_no_policy(clear_all_softrefs); -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__PSMarkSweep__end, &heap, heap->gc_cause()); -+#endif /* !USDT2 */ - } - } - } ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp 2012-07-25 13:24:07.000000000 -0400 -+++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp 2012-08-31 15:14:23.936576341 -0400 -@@ -40,8 +40,14 @@ - #include "runtime/handles.inline.hpp" - #include "runtime/java.hpp" - #include "runtime/vmThread.hpp" -+#include "utilities/dtrace.hpp" - #include "utilities/vmError.hpp" - -+#ifndef USDT2 -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parscavenge__heap__begin, *uintptr_t, *uintptr_t); -+ HS_DTRACE_PROBE_DECL2(provider, gc__collection__parscavenge__heap__end, *uintptr_t, *uintptr_t); -+#endif /* !USDT2 */ -+ - PSYoungGen* ParallelScavengeHeap::_young_gen = NULL; - PSOldGen* ParallelScavengeHeap::_old_gen = NULL; - PSPermGen* ParallelScavengeHeap::_perm_gen = NULL; -@@ -806,7 +812,13 @@ - } - - VM_ParallelGCSystemGC op(gc_count, full_gc_count, cause); -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__parscavenge__heap__begin, &op, cause); -+#endif /* !USDT2 */ - VMThread::execute(&op); -+#ifndef USDT2 -+ HS_DTRACE_PROBE2(hotspot, gc__collection__parscavenge__heap__end, &op, cause); -+#endif /* !USDT2 */ - } - - // This interface assumes that it's being called by the