diff options
| author | Richard Leitner <richard.leitner@skidata.com> | 2020-08-20 09:00:08 +0200 |
|---|---|---|
| committer | Richard Leitner <richard.leitner@skidata.com> | 2020-08-20 15:11:36 +0200 |
| commit | e5510ba991a5494e562776f135fc07f2999a86a8 (patch) | |
| tree | 48c5fb5d665af845c4dfd92861dc99aa88b71347 /recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch | |
| parent | a599da830cdfe8f50534a8b5d4b8b963b34bc045 (diff) | |
| download | meta-java-e5510ba991a5494e562776f135fc07f2999a86a8.tar.gz | |
openjdk-8: update to latest ga version 265
Patch related changes:
* The hotspot patch 1004 was mainlined in changeset 3a3803a0c789 [1] and
is therfore dropped.
* The jdk patch 2010 was mainlined in changeset c4418d567028 [2] and is
therefore dropped.
* Rename hotspot/aarch64 patches to start with number 1401.
* Rename hotspot/aarch32 patches to start with number 1201.
* Merge aarch32-hotspot-fix-shark-build-pt2.patch and
openjdk8-fix-shark-build-pt2.patch to hotspot patch 1013 as they were
the same.
[1] https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/3a3803a0c789
[2] https://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/c4418d567028
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Diffstat (limited to 'recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch')
| -rw-r--r-- | recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch | 172 |
1 files changed, 0 insertions, 172 deletions
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 deleted file mode 100644 index 69b85aa..0000000 --- a/recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch +++ /dev/null | |||
| @@ -1,172 +0,0 @@ | |||
| 1 | From 1beb42da8445e9ca6c8560f8c78cac185fffb64d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> | ||
| 3 | Date: Fri, 10 Aug 2018 14:54:45 +0100 | ||
| 4 | Subject: [PATCH 1004/1013] hotspot: backport patch to fix misuses of | ||
| 5 | strncpy/strncat | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 9 | |||
| 10 | Various small fixes around strncpy and strncat | ||
| 11 | |||
| 12 | Compilation using gcc >= 8 fails because of errors regarding | ||
| 13 | misuse of string functions. | ||
| 14 | Fix them using a backport from openjdk-10 | ||
| 15 | |||
| 16 | Modelled after http://hg.openjdk.java.net/jdk-updates/jdk10u/rev/b1608535e50f | ||
| 17 | |||
| 18 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
| 19 | Signed-off-by: Richard Leitner <richard.leitner@skidata.com> | ||
| 20 | --- | ||
| 21 | agent/src/os/linux/libproc_impl.c | 7 ++++++- | ||
| 22 | src/share/tools/hsdis/hsdis.c | 1 + | ||
| 23 | src/share/vm/compiler/compileBroker.hpp | 3 ++- | ||
| 24 | src/share/vm/compiler/disassembler.cpp | 1 + | ||
| 25 | src/share/vm/runtime/arguments.cpp | 13 ++++++------- | ||
| 26 | src/share/vm/utilities/ostream.cpp | 12 ++++++++---- | ||
| 27 | src/share/vm/utilities/vmError.cpp | 9 +-------- | ||
| 28 | 7 files changed, 25 insertions(+), 21 deletions(-) | ||
| 29 | |||
| 30 | diff --git a/hotspot/agent/src/os/linux/libproc_impl.c b/hotspot/agent/src/os/linux/libproc_impl.c | ||
| 31 | index ca791c95d..73a15ce35 100644 | ||
| 32 | --- a/hotspot/agent/src/os/linux/libproc_impl.c | ||
| 33 | +++ b/hotspot/agent/src/os/linux/libproc_impl.c | ||
| 34 | @@ -159,7 +159,12 @@ lib_info* add_lib_info_fd(struct ps_prochandle* ph, const char* libname, int fd, | ||
| 35 | return NULL; | ||
| 36 | } | ||
| 37 | |||
| 38 | - strncpy(newlib->name, libname, sizeof(newlib->name)); | ||
| 39 | + if (strlen(libname) >= sizeof(newlib->name)) { | ||
| 40 | + print_debug("libname %s too long\n", libname); | ||
| 41 | + return NULL; | ||
| 42 | + } | ||
| 43 | + strcpy(newlib->name, libname); | ||
| 44 | + | ||
| 45 | newlib->base = base; | ||
| 46 | |||
| 47 | if (fd == -1) { | ||
| 48 | diff --git a/hotspot/src/share/tools/hsdis/hsdis.c b/hotspot/src/share/tools/hsdis/hsdis.c | ||
| 49 | index 7bef1040f..1907d479e 100644 | ||
| 50 | --- a/hotspot/src/share/tools/hsdis/hsdis.c | ||
| 51 | +++ b/hotspot/src/share/tools/hsdis/hsdis.c | ||
| 52 | @@ -438,6 +438,7 @@ static void parse_caller_options(struct hsdis_app_data* app_data, const char* ca | ||
| 53 | } | ||
| 54 | p = q; | ||
| 55 | } | ||
| 56 | + *iop = '\0'; | ||
| 57 | } | ||
| 58 | |||
| 59 | static void print_help(struct hsdis_app_data* app_data, | ||
| 60 | diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp | ||
| 61 | index ad37ff173..16e0ba3aa 100644 | ||
| 62 | --- a/hotspot/src/share/vm/compiler/compileBroker.hpp | ||
| 63 | +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp | ||
| 64 | @@ -173,7 +173,8 @@ class CompilerCounters : public CHeapObj<mtCompiler> { | ||
| 65 | // these methods should be called in a thread safe context | ||
| 66 | |||
| 67 | void set_current_method(const char* method) { | ||
| 68 | - strncpy(_current_method, method, (size_t)cmname_buffer_length); | ||
| 69 | + strncpy(_current_method, method, (size_t)cmname_buffer_length-1); | ||
| 70 | + _current_method[cmname_buffer_length-1] = '\0'; | ||
| 71 | if (UsePerfData) _perf_current_method->set_value(method); | ||
| 72 | } | ||
| 73 | |||
| 74 | diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp | ||
| 75 | index 93cd9e854..e7b32cd6b 100644 | ||
| 76 | --- a/hotspot/src/share/vm/compiler/disassembler.cpp | ||
| 77 | +++ b/hotspot/src/share/vm/compiler/disassembler.cpp | ||
| 78 | @@ -295,6 +295,7 @@ address decode_env::handle_event(const char* event, address arg) { | ||
| 79 | strlen((const char*)arg) > sizeof(buffer) - 1) { | ||
| 80 | // Only print this when the mach changes | ||
| 81 | strncpy(buffer, (const char*)arg, sizeof(buffer) - 1); | ||
| 82 | + buffer[sizeof(buffer) - 1] = '\0'; | ||
| 83 | output()->print_cr("[Disassembling for mach='%s']", arg); | ||
| 84 | } | ||
| 85 | } else if (match(event, "format bytes-per-line")) { | ||
| 86 | diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp | ||
| 87 | index 7c85a0da8..ea4026b98 100644 | ||
| 88 | --- a/hotspot/src/share/vm/runtime/arguments.cpp | ||
| 89 | +++ b/hotspot/src/share/vm/runtime/arguments.cpp | ||
| 90 | @@ -3456,7 +3456,7 @@ void Arguments::fix_appclasspath() { | ||
| 91 | } | ||
| 92 | |||
| 93 | char* copy = AllocateHeap(strlen(src) + 1, mtInternal); | ||
| 94 | - strncpy(copy, src, strlen(src) + 1); | ||
| 95 | + strcpy(copy, src); | ||
| 96 | |||
| 97 | // trim all trailing empty paths | ||
| 98 | for (char* tail = copy + strlen(copy) - 1; tail >= copy && *tail == separator; tail--) { | ||
| 99 | @@ -3835,17 +3835,16 @@ static char* get_shared_archive_path() { | ||
| 100 | if (end != NULL) *end = '\0'; | ||
| 101 | size_t jvm_path_len = strlen(jvm_path); | ||
| 102 | size_t file_sep_len = strlen(os::file_separator()); | ||
| 103 | - shared_archive_path = NEW_C_HEAP_ARRAY(char, jvm_path_len + | ||
| 104 | - file_sep_len + 20, mtInternal); | ||
| 105 | + const size_t len = jvm_path_len + file_sep_len + 20; | ||
| 106 | + shared_archive_path = NEW_C_HEAP_ARRAY(char, len, mtInternal); | ||
| 107 | if (shared_archive_path != NULL) { | ||
| 108 | - strncpy(shared_archive_path, jvm_path, jvm_path_len + 1); | ||
| 109 | - strncat(shared_archive_path, os::file_separator(), file_sep_len); | ||
| 110 | - strncat(shared_archive_path, "classes.jsa", 11); | ||
| 111 | + jio_snprintf(shared_archive_path, len, "%s%sclasses.jsa", | ||
| 112 | + jvm_path, os::file_separator()); | ||
| 113 | } | ||
| 114 | } else { | ||
| 115 | shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(SharedArchiveFile) + 1, mtInternal); | ||
| 116 | if (shared_archive_path != NULL) { | ||
| 117 | - strncpy(shared_archive_path, SharedArchiveFile, strlen(SharedArchiveFile) + 1); | ||
| 118 | + strcpy(shared_archive_path, SharedArchiveFile); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | return shared_archive_path; | ||
| 122 | diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp | ||
| 123 | index 1b00f829a..4daea2b7e 100644 | ||
| 124 | --- a/hotspot/src/share/vm/utilities/ostream.cpp | ||
| 125 | +++ b/hotspot/src/share/vm/utilities/ostream.cpp | ||
| 126 | @@ -342,15 +342,19 @@ void stringStream::write(const char* s, size_t len) { | ||
| 127 | assert(rm == NULL || Thread::current()->current_resource_mark() == rm, | ||
| 128 | "stringStream is re-allocated with a different ResourceMark"); | ||
| 129 | buffer = NEW_RESOURCE_ARRAY(char, end); | ||
| 130 | - strncpy(buffer, oldbuf, buffer_pos); | ||
| 131 | + if (buffer_pos > 0) { | ||
| 132 | + memcpy(buffer, oldbuf, buffer_pos); | ||
| 133 | + } | ||
| 134 | buffer_length = end; | ||
| 135 | } | ||
| 136 | } | ||
| 137 | // invariant: buffer is always null-terminated | ||
| 138 | guarantee(buffer_pos + write_len + 1 <= buffer_length, "stringStream oob"); | ||
| 139 | - buffer[buffer_pos + write_len] = 0; | ||
| 140 | - strncpy(buffer + buffer_pos, s, write_len); | ||
| 141 | - buffer_pos += write_len; | ||
| 142 | + if (write_len > 0) { | ||
| 143 | + buffer[buffer_pos + write_len] = 0; | ||
| 144 | + memcpy(buffer + buffer_pos, s, write_len); | ||
| 145 | + buffer_pos += write_len; | ||
| 146 | + } | ||
| 147 | |||
| 148 | // Note that the following does not depend on write_len. | ||
| 149 | // This means that position and count get updated | ||
| 150 | diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp | ||
| 151 | index 49b978a02..97c5e33f2 100644 | ||
| 152 | --- a/hotspot/src/share/vm/utilities/vmError.cpp | ||
| 153 | +++ b/hotspot/src/share/vm/utilities/vmError.cpp | ||
| 154 | @@ -450,14 +450,7 @@ void VMError::report(outputStream* st) { | ||
| 155 | #else | ||
| 156 | const char *file = _filename; | ||
| 157 | #endif | ||
| 158 | - size_t len = strlen(file); | ||
| 159 | - size_t buflen = sizeof(buf); | ||
| 160 | - | ||
| 161 | - strncpy(buf, file, buflen); | ||
| 162 | - if (len + 10 < buflen) { | ||
| 163 | - sprintf(buf + len, ":%d", _lineno); | ||
| 164 | - } | ||
| 165 | - st->print(" (%s)", buf); | ||
| 166 | + st->print(" (%s:%d)", file, _lineno); | ||
| 167 | } else { | ||
| 168 | st->print(" (0x%x)", _id); | ||
| 169 | } | ||
| 170 | -- | ||
| 171 | 2.26.2 | ||
| 172 | |||
