# HG changeset patch # User andrew # Date 1534949465 -3600 # Wed Aug 22 15:51:05 2018 +0100 # Node ID bd1f7b5f5fd596f18657ee6230fed8c9aa8e9f57 # Parent 0282aa4750de1538e9f137845ea11a285b9cf737 # Parent eed8e846c982d7474dd07fc873ba02f83ad1f847 Merge jdk8u181-b13 diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -1167,6 +1167,7 @@ a17bab9405474602b18cd62e060a09b17d6413ac jdk8u171-b00 ebfd57cc21e6b7f0c22b17c666b6b28c9340e207 jdk8u171-b01 1acd7c1b80241def8fac90f70b0df16356adad47 jdk8u171-b02 +5587cde50bbc2aa031aefb47eaa36b041f5e7c4b jdk8u181-b00 5587cde50bbc2aa031aefb47eaa36b041f5e7c4b jdk8u171-b03 99ef466523302cfbd00496cf6575a00c8637b884 jdk8u171-b04 08326a76b14888908523cf2bb1105de63b43544d jdk8u171-b05 @@ -1193,3 +1194,17 @@ 8a75f5107626f5eb7d0458ba10d8bbc01d6f4199 aarch64-jdk8u181-b04 373cb5a46bc1bbacaa1f38943007fc94574b607f aarch64-jdk8u181-b13 57a508e6d1c3da585f2ec791f981557c275129e6 aarch64-jdk8u181-b14 +083a9d6562100353708e4b73656282b21a78f714 jdk8u172-b11 +6e2be123a2e1c7671086c767e79ffe8ad5d4f9ca jdk8u181-b01 +1d0b6fcff115a57ca02081da84589630ba282789 jdk8u181-b02 +1127faef22f14d56cdd6c0c8bded598f492c2611 jdk8u181-b03 +c53e56e8904926f4efdde8a0483109ed3c60c064 jdk8u181-b04 +cea033df30750958ffc999d647ee43587d4a06b2 jdk8u181-b05 +2198f5b865507118b644830293dc9f0ec3b4439e jdk8u181-b06 +892e637195c74dc83ee2c22c93125f0209216007 jdk8u181-b07 +9ffa7549c389c6361e643f69ddf6a3e76118de13 jdk8u181-b08 +b46904cf3eaf0ca150aee9f0d8bdf85e2691e74f jdk8u181-b09 +08b5e1f3d022fbe122b11b6f45f62b5a4ce92ed9 jdk8u181-b10 +e4f39d283b55faf6074308797615298bd1a45a66 jdk8u181-b11 +464ed8cea5d6cdbfacc9be7035297af88f57f708 jdk8u181-b12 +9062a259cecfe8e1f3386e2982eb77bd117c81e1 jdk8u181-b31 diff --git a/THIRD_PARTY_README b/THIRD_PARTY_README --- a/THIRD_PARTY_README +++ b/THIRD_PARTY_README @@ -181,6 +181,192 @@ ------------------------------------------------------------------------------- +%% This notice is provided with respect to DejaVu fonts v2.34, which may be +included with JRE 8, and JDK 8, and OpenJDK 8. + +--- begin of LICENSE --- + +Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. +Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below) + + +Bitstream Vera Fonts Copyright +------------------------------ + +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is +a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of the fonts accompanying this license ("Fonts") and associated +documentation files (the "Font Software"), to reproduce and distribute the +Font Software, including without limitation the rights to use, copy, merge, +publish, distribute, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to the +following conditions: + +The above copyright and trademark notices and this permission notice shall +be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular +the designs of glyphs or characters in the Fonts may be modified and +additional glyphs or characters may be added to the Fonts, only if the fonts +are renamed to names not containing either the words "Bitstream" or the word +"Vera". + +This License becomes null and void to the extent applicable to Fonts or Font +Software that has been modified and is distributed under the "Bitstream +Vera" names. + +The Font Software may be sold as part of a larger software package but no +copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME +FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING +ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE +FONT SOFTWARE. + +Except as contained in this notice, the names of Gnome, the Gnome +Foundation, and Bitstream Inc., shall not be used in advertising or +otherwise to promote the sale, use or other dealings in this Font Software +without prior written authorization from the Gnome Foundation or Bitstream +Inc., respectively. For further information, contact: fonts at gnome dot +org. + +Arev Fonts Copyright +------------------------------ + +Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the fonts accompanying this license ("Fonts") and +associated documentation files (the "Font Software"), to reproduce +and distribute the modifications to the Bitstream Vera Font Software, +including without limitation the rights to use, copy, merge, publish, +distribute, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to +the following conditions: + +The above copyright and trademark notices and this permission notice +shall be included in all copies of one or more of the Font Software +typefaces. + +The Font Software may be modified, altered, or added to, and in +particular the designs of glyphs or characters in the Fonts may be +modified and additional glyphs or characters may be added to the +Fonts, only if the fonts are renamed to names not containing either +the words "Tavmjong Bah" or the word "Arev". + +This License becomes null and void to the extent applicable to Fonts +or Font Software that has been modified and is distributed under the +"Tavmjong Bah Arev" names. + +The Font Software may be sold as part of a larger software package but +no copy of one or more of the Font Software typefaces may be sold by +itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL +TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +Except as contained in this notice, the name of Tavmjong Bah shall not +be used in advertising or otherwise to promote the sale, use or other +dealings in this Font Software without prior written authorization +from Tavmjong Bah. For further information, contact: tavmjong @ free +. fr. + +TeX Gyre DJV Math +----------------- +Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. + +Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski +(on behalf of TeX users groups) are in public domain. + +Letters imported from Euler Fraktur from AMSfonts are (c) American +Mathematical Society (see below). +Bitstream Vera Fonts Copyright +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera +is a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of the fonts accompanying this license ("Fonts") and associated documentation +files (the "Font Software"), to reproduce and distribute the Font Software, +including without limitation the rights to use, copy, merge, publish, +distribute, and/or sell copies of the Font Software, and to permit persons +to whom the Font Software is furnished to do so, subject to the following +conditions: + +The above copyright and trademark notices and this permission notice +shall be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular +the designs of glyphs or characters in the Fonts may be modified and +additional glyphs or characters may be added to the Fonts, only if the +fonts are renamed to names not containing either the words "Bitstream" +or the word "Vera". + +This License becomes null and void to the extent applicable to Fonts or +Font Software that has been modified and is distributed under the +"Bitstream Vera" names. + +The Font Software may be sold as part of a larger software package but +no copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME +FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING +ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN +THE FONT SOFTWARE. +Except as contained in this notice, the names of GNOME, the GNOME +Foundation, and Bitstream Inc., shall not be used in advertising or +otherwise to promote the sale, use or other dealings in this Font Software +without prior written authorization from the GNOME Foundation or +Bitstream Inc., respectively. +For further information, contact: fonts at gnome dot org. + +AMSFonts (v. 2.2) copyright + +The PostScript Type 1 implementation of the AMSFonts produced by and +previously distributed by Blue Sky Research and Y&Y, Inc. are now freely +available for general use. This has been accomplished through the +cooperation +of a consortium of scientific publishers with Blue Sky Research and Y&Y. +Members of this consortium include: + +Elsevier Science IBM Corporation Society for Industrial and Applied +Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS) + +In order to assure the authenticity of these fonts, copyright will be +held by the American Mathematical Society. This is not meant to restrict +in any way the legitimate use of the fonts, such as (but not limited to) +electronic distribution of documents containing these fonts, inclusion of +these fonts into other public domain or commercial font collections or computer +applications, use of the outline data to create derivative fonts and/or +faces, etc. However, the AMS does require that the AMS copyright notice be +removed from any derivative versions of the fonts which have been altered in +any way. In addition, to ensure the fidelity of TeX documents using Computer +Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces, +has requested that any alterations which yield different font metrics be +given a different name. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + %% This notice is provided with respect to Document Object Model (DOM) Level 2 & 3, which may be included with JRE 8, JDK 8, and OpenJDK 8. diff --git a/agent/src/os/linux/Makefile b/agent/src/os/linux/Makefile --- a/agent/src/os/linux/Makefile +++ b/agent/src/os/linux/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2018, 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 @@ -77,6 +77,9 @@ endif LFLAGS_LIBSA += $(LDFLAGS_HASH_STYLE) +LDFLAGS_NO_EXEC_STACK="-Wl,-z,noexecstack" +LFLAGS_LIBSA += $(LDFLAGS_NO_EXEC_STACK) + $(LIBSA): $(ARCH) $(OBJS) mapfile $(GCC) -shared $(LFLAGS_LIBSA) -o $(LIBSA) $(OBJS) $(LIBS) diff --git a/make/linux/makefiles/gcc.make b/make/linux/makefiles/gcc.make --- a/make/linux/makefiles/gcc.make +++ b/make/linux/makefiles/gcc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2018, 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 @@ -304,6 +304,8 @@ LFLAGS += $(LDFLAGS_HASH_STYLE) +LDFLAGS_NO_EXEC_STACK="-Wl,-z,noexecstack" + # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. MAPFLAG = -Xlinker --version-script=FILENAME diff --git a/make/linux/makefiles/jsig.make b/make/linux/makefiles/jsig.make --- a/make/linux/makefiles/jsig.make +++ b/make/linux/makefiles/jsig.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2018, 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,7 @@ # cause problems with interposing. See CR: 6466665 # LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) -LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT $(LDFLAGS_HASH_STYLE) +LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT $(LDFLAGS_HASH_STYLE) $(LDFLAGS_NO_EXEC_STACK) # DEBUG_BINARIES overrides everything, use full -g debug information ifeq ($(DEBUG_BINARIES), true) diff --git a/src/share/vm/prims/whitebox.cpp b/src/share/vm/prims/whitebox.cpp --- a/src/share/vm/prims/whitebox.cpp +++ b/src/share/vm/prims/whitebox.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, 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 @@ -158,6 +158,9 @@ } WB_END +#ifdef LINUX +#include "utilities/elfFile.hpp" +#endif WB_ENTRY(jlong, WB_GetCompressedOopsMaxHeapSize(JNIEnv* env, jobject o)) { return (jlong)Arguments::max_heap_for_compressed_oops(); @@ -1010,6 +1013,21 @@ } } +// Checks that the library libfile has the noexecstack bit set. +WB_ENTRY(jboolean, WB_CheckLibSpecifiesNoexecstack(JNIEnv* env, jobject o, jstring libfile)) + jboolean ret = false; +#ifdef LINUX + // Can't be in VM when we call JNI. + ThreadToNativeFromVM ttnfv(thread); + const char* lf = env->GetStringUTFChars(libfile, NULL); + CHECK_JNI_EXCEPTION_(env, 0); + ElfFile ef(lf); + ret = (jboolean) ef.specifies_noexecstack(); + env->ReleaseStringUTFChars(libfile, lf); +#endif + return ret; +WB_END + #define CC (char*) static JNINativeMethod methods[] = { @@ -1121,6 +1139,8 @@ (void*)&WB_GetNMethod }, {CC"isMonitorInflated", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated }, {CC"forceSafepoint", CC"()V", (void*)&WB_ForceSafepoint }, + {CC"checkLibSpecifiesNoexecstack", CC"(Ljava/lang/String;)Z", + (void*)&WB_CheckLibSpecifiesNoexecstack}, }; #undef CC diff --git a/test/runtime/execstack/TestCheckJDK.java b/test/runtime/execstack/TestCheckJDK.java new file mode 100644 --- /dev/null +++ b/test/runtime/execstack/TestCheckJDK.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2017, 2018, 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 Testexecstack.java + * @summary Searches for all libraries in test VM and checks that they + * have the noexecstack bit set. + * @requires (os.family == "linux") + * @library /testlibrary /testlibrary/whitebox + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * TestCheckJDK + */ + +import com.oracle.java.testlibrary.Asserts; +import sun.hotspot.WhiteBox; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class TestCheckJDK { + static boolean testPassed = true; + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + + static void checkExecStack(Path file) { + String filename = file.toString(); + if (filename.endsWith(".so")) { + if (!WB.checkLibSpecifiesNoexecstack(filename)) { + System.out.println("Library does not have the noexecstack bit set: " + filename); + testPassed = false; + } + } + } + + public static void main(String[] args) throws Throwable { + String vmInstallDir = System.getProperty("java.home"); + + Files.walk(Paths.get(vmInstallDir)).filter(Files::isRegularFile).forEach(TestCheckJDK::checkExecStack); + + Asserts.assertTrue(testPassed, + "The tested VM contains libs that don't have the noexecstack " + + "bit set. They must be linked with -z,noexecstack."); + } +} diff --git a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, 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 @@ -235,4 +235,7 @@ // Class Data Sharing public native boolean isSharedClass(Class c); + + // Returns true on linux if library has the noexecstack flag set. + public native boolean checkLibSpecifiesNoexecstack(String libfilename); }