From 7d30e6ff7b8a54d67256ce528e8c4fd7e63f6b14 Mon Sep 17 00:00:00 2001 From: Richard Leitner Date: Mon, 30 Dec 2019 15:35:59 +0100 Subject: openjdk-8: update to latest ga version 242 As OpenJDK-8 is now tagging "ga" versions in addition to the "build" version the recipes are adapted to use those "ga" versions. All existing patches got re-applied and renamed. For better handling Hotspot patches now start at patch number 1001 and jdk patches at 2001. Furthermore architecture dependent patches are prefixed with the architecture they apply on. Following patches/hunks were completely dropped: - 0002-hotspot-fix-compilation-with-security-flags-enabled.patch got backported to hotspot jdk8u https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/c40a28e54185 - 0011-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch ostream.cpp:112 got fixed in hotspot jdk8u https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/f3108e56b502 - 0014-hotspot-zero-fix-undefined-behaviour-gcc-v8-fix.patch got backported to hotspot jdk8u https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/ca4663e58916 - 0018-hotspot-Fix-debug-build-after-8062808-Turn-on-the-Wr.patch fixed in hotspot jdk8u https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/32bc598624bd - 0020-Enable-HotSpot-builds-on-5.x-Linux-kernels.patch fixed in hotspot jdk8u https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/5af8ec63c21c - openjdk8-add-missing-linker-flags.patch fixed in hotspot jdk8u https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/f175513c2c3a - openjdk8-fix-shark-stdc++11.patch fixed in hotspot jdk8u - openjdk8-fix-libpng-neon-build.patch fixed in jdk https://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/5d57817931e1 - aarch64-hotspot-fix-undefined-behaviour-gcc-v8-fix.patch got backported to hotspot jdk8u Following patches were newly added: - 0011-autoconf-fix-CC-with-arguments-detection.patch needed because of jdk8u commit "8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris" - 0012-autoconf-NativeCompilation-remove-sysroot.patch needed because of jdk8u commit "8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris" Additionally add UPDATING.md which describes the openjdk8 update process for this layer and update8checksums.sh, a script that updates the openjdk8 source archive checksums in the corresponding .inc files. Signed-off-by: Richard Leitner --- ...kport-patch-to-fix-misuses-of-strncpy-str.patch | 172 +++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch (limited to 'recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch') diff --git a/recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch b/recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch new file mode 100644 index 0000000..ad480e3 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch @@ -0,0 +1,172 @@ +From 3a6eef99b27b7dd750e7a02eb3ada71db99d9345 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Fri, 10 Aug 2018 14:54:45 +0100 +Subject: [PATCH 1004/1012] hotspot: backport patch to fix misuses of + strncpy/strncat +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Various small fixes around strncpy and strncat + +Compilation using gcc >= 8 fails because of errors regarding +misuse of string functions. +Fix them using a backport from openjdk-10 + +Modelled after http://hg.openjdk.java.net/jdk-updates/jdk10u/rev/b1608535e50f + +Signed-off-by: André Draszik +Signed-off-by: Richard Leitner +--- + agent/src/os/linux/libproc_impl.c | 7 ++++++- + src/share/tools/hsdis/hsdis.c | 1 + + src/share/vm/compiler/compileBroker.hpp | 3 ++- + src/share/vm/compiler/disassembler.cpp | 1 + + src/share/vm/runtime/arguments.cpp | 13 ++++++------- + src/share/vm/utilities/ostream.cpp | 12 ++++++++---- + src/share/vm/utilities/vmError.cpp | 9 +-------- + 7 files changed, 25 insertions(+), 21 deletions(-) + +diff --git a/hotspot/agent/src/os/linux/libproc_impl.c b/hotspot/agent/src/os/linux/libproc_impl.c +index ca791c95d..73a15ce35 100644 +--- a/hotspot/agent/src/os/linux/libproc_impl.c ++++ b/hotspot/agent/src/os/linux/libproc_impl.c +@@ -159,7 +159,12 @@ lib_info* add_lib_info_fd(struct ps_prochandle* ph, const char* libname, int fd, + return NULL; + } + +- strncpy(newlib->name, libname, sizeof(newlib->name)); ++ if (strlen(libname) >= sizeof(newlib->name)) { ++ print_debug("libname %s too long\n", libname); ++ return NULL; ++ } ++ strcpy(newlib->name, libname); ++ + newlib->base = base; + + if (fd == -1) { +diff --git a/hotspot/src/share/tools/hsdis/hsdis.c b/hotspot/src/share/tools/hsdis/hsdis.c +index 7bef1040f..1907d479e 100644 +--- a/hotspot/src/share/tools/hsdis/hsdis.c ++++ b/hotspot/src/share/tools/hsdis/hsdis.c +@@ -438,6 +438,7 @@ static void parse_caller_options(struct hsdis_app_data* app_data, const char* ca + } + p = q; + } ++ *iop = '\0'; + } + + static void print_help(struct hsdis_app_data* app_data, +diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp +index ad37ff173..16e0ba3aa 100644 +--- a/hotspot/src/share/vm/compiler/compileBroker.hpp ++++ b/hotspot/src/share/vm/compiler/compileBroker.hpp +@@ -173,7 +173,8 @@ class CompilerCounters : public CHeapObj { + // these methods should be called in a thread safe context + + void set_current_method(const char* method) { +- strncpy(_current_method, method, (size_t)cmname_buffer_length); ++ strncpy(_current_method, method, (size_t)cmname_buffer_length-1); ++ _current_method[cmname_buffer_length-1] = '\0'; + if (UsePerfData) _perf_current_method->set_value(method); + } + +diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp +index 93cd9e854..e7b32cd6b 100644 +--- a/hotspot/src/share/vm/compiler/disassembler.cpp ++++ b/hotspot/src/share/vm/compiler/disassembler.cpp +@@ -295,6 +295,7 @@ address decode_env::handle_event(const char* event, address arg) { + strlen((const char*)arg) > sizeof(buffer) - 1) { + // Only print this when the mach changes + strncpy(buffer, (const char*)arg, sizeof(buffer) - 1); ++ buffer[sizeof(buffer) - 1] = '\0'; + output()->print_cr("[Disassembling for mach='%s']", arg); + } + } else if (match(event, "format bytes-per-line")) { +diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp +index 2665b6b8c..5a9294677 100644 +--- a/hotspot/src/share/vm/runtime/arguments.cpp ++++ b/hotspot/src/share/vm/runtime/arguments.cpp +@@ -3455,7 +3455,7 @@ void Arguments::fix_appclasspath() { + } + + char* copy = AllocateHeap(strlen(src) + 1, mtInternal); +- strncpy(copy, src, strlen(src) + 1); ++ strcpy(copy, src); + + // trim all trailing empty paths + for (char* tail = copy + strlen(copy) - 1; tail >= copy && *tail == separator; tail--) { +@@ -3834,17 +3834,16 @@ static char* get_shared_archive_path() { + if (end != NULL) *end = '\0'; + size_t jvm_path_len = strlen(jvm_path); + size_t file_sep_len = strlen(os::file_separator()); +- shared_archive_path = NEW_C_HEAP_ARRAY(char, jvm_path_len + +- file_sep_len + 20, mtInternal); ++ const size_t len = jvm_path_len + file_sep_len + 20; ++ shared_archive_path = NEW_C_HEAP_ARRAY(char, len, mtInternal); + if (shared_archive_path != NULL) { +- strncpy(shared_archive_path, jvm_path, jvm_path_len + 1); +- strncat(shared_archive_path, os::file_separator(), file_sep_len); +- strncat(shared_archive_path, "classes.jsa", 11); ++ jio_snprintf(shared_archive_path, len, "%s%sclasses.jsa", ++ jvm_path, os::file_separator()); + } + } else { + shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(SharedArchiveFile) + 1, mtInternal); + if (shared_archive_path != NULL) { +- strncpy(shared_archive_path, SharedArchiveFile, strlen(SharedArchiveFile) + 1); ++ strcpy(shared_archive_path, SharedArchiveFile); + } + } + return shared_archive_path; +diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp +index 1b00f829a..4daea2b7e 100644 +--- a/hotspot/src/share/vm/utilities/ostream.cpp ++++ b/hotspot/src/share/vm/utilities/ostream.cpp +@@ -342,15 +342,19 @@ void stringStream::write(const char* s, size_t len) { + assert(rm == NULL || Thread::current()->current_resource_mark() == rm, + "stringStream is re-allocated with a different ResourceMark"); + buffer = NEW_RESOURCE_ARRAY(char, end); +- strncpy(buffer, oldbuf, buffer_pos); ++ if (buffer_pos > 0) { ++ memcpy(buffer, oldbuf, buffer_pos); ++ } + buffer_length = end; + } + } + // invariant: buffer is always null-terminated + guarantee(buffer_pos + write_len + 1 <= buffer_length, "stringStream oob"); +- buffer[buffer_pos + write_len] = 0; +- strncpy(buffer + buffer_pos, s, write_len); +- buffer_pos += write_len; ++ if (write_len > 0) { ++ buffer[buffer_pos + write_len] = 0; ++ memcpy(buffer + buffer_pos, s, write_len); ++ buffer_pos += write_len; ++ } + + // Note that the following does not depend on write_len. + // This means that position and count get updated +diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp +index ef3bb5cee..c11fef472 100644 +--- a/hotspot/src/share/vm/utilities/vmError.cpp ++++ b/hotspot/src/share/vm/utilities/vmError.cpp +@@ -450,14 +450,7 @@ void VMError::report(outputStream* st) { + #else + const char *file = _filename; + #endif +- size_t len = strlen(file); +- size_t buflen = sizeof(buf); +- +- strncpy(buf, file, buflen); +- if (len + 10 < buflen) { +- sprintf(buf + len, ":%d", _lineno); +- } +- st->print(" (%s)", buf); ++ st->print(" (%s:%d)", file, _lineno); + } else { + st->print(" (0x%x)", _id); + } +-- +2.24.1 + -- cgit v1.2.3-54-g00ecf