diff options
author | Richard Leitner <richard.leitner@skidata.com> | 2019-12-30 15:35:59 +0100 |
---|---|---|
committer | Richard Leitner <richard.leitner@skidata.com> | 2020-08-17 13:02:40 +0200 |
commit | 040bfc7748f37b258f8f1d2c6f1d2d44127bf173 (patch) | |
tree | 4a147312e7398d03f0f8bbffd52f71233fa91957 /recipes-core/openjdk/patches-openjdk-8/1004-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch | |
parent | 4bcf80651fa555611c13c02eaab3529ccf31bbf6 (diff) | |
download | meta-java-040bfc7748f37b258f8f1d2c6f1d2d44127bf173.tar.gz |
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 <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, 172 insertions, 0 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 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 @@ | |||
1 | From 3a6eef99b27b7dd750e7a02eb3ada71db99d9345 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/1012] 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 2665b6b8c..5a9294677 100644 | ||
88 | --- a/hotspot/src/share/vm/runtime/arguments.cpp | ||
89 | +++ b/hotspot/src/share/vm/runtime/arguments.cpp | ||
90 | @@ -3455,7 +3455,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 | @@ -3834,17 +3834,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 ef3bb5cee..c11fef472 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.24.1 | ||
172 | |||