RFR: [8u] JDK-6424123: "JVM crashes on failed 'strdup' call"

Andrew Hughes gnu.andrew at redhat.com
Thu Apr 2 04:46:36 UTC 2020


Bug: https://bugs.openjdk.java.net/browse/JDK-6424123
Webrev: https://cr.openjdk.java.net/~andrew/openjdk8/6424123/webrev.01

This patch cleans up some cases where strings aren't freed and also
introduces strdup_check_oom to more elegantly handle cases where strdup
fails.  That function is later used by JDK-8076475 [0].

The differences in the backport are mainly due to later changes that
have already been backported to 8u:

* src/cpu/ppc/vm/vm_version_ppc.cpp
  - Context changes due to later updates to the supported feature set

* src/cpu/sparc/vm/vm_version_sparc.cpp
  - Same as for vm_version_ppc.cpp

* src/cpu/x86/vm/vm_version_x86.cpp
  - Same again

* src/os/aix/vm/porting_aix.cpp
  - Header context is different as 8u doesn't import allocation.hpp

* src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp
  - Changes dropped as code was completely refactored by JDK-8134119 and
now uses os::malloc & os::free already

* src/share/vm/classfile/classLoader.cpp
  - Context of signature of LazyClassPathEntry::LazyClassPathEntry was
different, due to introduction of throw_exception. Changes to
setup_bootstrap_search_path were dropped as JDK-8056971 changed
sys_class_path to be used read only and not duplicated.

* src/share/vm/classfile/classLoader.hpp
  - Change to LazyClassPathEntry::_path (char* -> const char*) in
JDK-8056971 had to be reverted so it could be passed to os::free. Some
context differences due to changes in class methods (addition of
open_entry).

* src/share/vm/compiler/compilerOracle.cpp
  - strdup is already present, thanks to JDK-8055286, so is replaced
with strdup_check_oom. Destructor and removal of strdup in call to
add_option_string are also already present, thank to that change.

* src/share/vm/runtime/arguments.cpp
  - Some context differences due to process_java_launcher_argument
having a special case for "gamma" from JDK-7022037. This was removed by
JDK-8027113 in OpenJDK 9.

Ok for 8u?

[0] https://mail.openjdk.java.net/pipermail/jdk8u-dev/2020-April/011514.html

Thanks,
-- 
Andrew :)

Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222



More information about the jdk8u-dev mailing list