From 48f907296be2a5f96cccd26cf044ee73b25a2d96 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 30 Jun 2022 12:49:03 -0400 Subject: [PATCH 1/2] openjdk11: fix memory corruption issue on musl https://bugs.openjdk.org/browse/JDK-8289477 --- .../files/musl_patches/8289477.patch | 35 +++++++++++++++++++ srcpkgs/openjdk11/template | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/openjdk11/files/musl_patches/8289477.patch diff --git a/srcpkgs/openjdk11/files/musl_patches/8289477.patch b/srcpkgs/openjdk11/files/musl_patches/8289477.patch new file mode 100644 index 000000000000..57ac4866b578 --- /dev/null +++ b/srcpkgs/openjdk11/files/musl_patches/8289477.patch @@ -0,0 +1,35 @@ +From da6d1fc0e0aeb1fdb504aced4b0dba0290ec240f Mon Sep 17 00:00:00 2001 +From: Thomas Stuefe +Date: Thu, 30 Jun 2022 06:19:25 +0000 +Subject: [PATCH] 8289477: Memory corruption with CPU_ALLOC, CPU_FREE on muslc + +Reviewed-by: dholmes, clanger +--- + src/hotspot/os/linux/os_linux.cpp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp +index 726926218907..8ee10e201c69 100644 +--- a/src/hotspot/os/linux/os_linux.cpp ++++ b/src/hotspot/os/linux/os_linux.cpp +@@ -4591,7 +4591,8 @@ static int _cpu_count(const cpu_set_t* cpus) { + // dynamic check - see 6515172 for details. + // If anything goes wrong we fallback to returning the number of online + // processors - which can be greater than the number available to the process. +-int os::Linux::active_processor_count() { ++static int get_active_processor_count() { ++ // Note: keep this function, with its CPU_xx macros, *outside* the os namespace (see JDK-8289477). + cpu_set_t cpus; // can represent at most 1024 (CPU_SETSIZE) processors + cpu_set_t* cpus_p = &cpus; + int cpus_size = sizeof(cpu_set_t); +@@ -4663,6 +4664,10 @@ int os::Linux::active_processor_count() { + return cpu_count; + } + ++int os::Linux::active_processor_count() { ++ return get_active_processor_count(); ++} ++ + // Determine the active processor count from one of + // three different sources: + // diff --git a/srcpkgs/openjdk11/template b/srcpkgs/openjdk11/template index 48be7fa6bfc8..8d74b7c131f1 100644 --- a/srcpkgs/openjdk11/template +++ b/srcpkgs/openjdk11/template @@ -1,7 +1,7 @@ # Template file for 'openjdk11' pkgname=openjdk11 version=11.0.12+7 -revision=2 +revision=3 _java_ver="${version%%.*}" _jdk_home="usr/lib/jvm/openjdk${_java_ver}" archs="x86_64* i686* aarch64* armv7* ppc64*" From b14582ecbc760bdd022d7a9d24ac958a3bb1a428 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 30 Jun 2022 12:49:14 -0400 Subject: [PATCH 2/2] openjdk17: fix memory corruption issue on musl https://bugs.openjdk.org/browse/JDK-8289477 --- .../files/musl_patches/8289477.patch | 35 +++++++++++++++++++ srcpkgs/openjdk17/template | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/openjdk17/files/musl_patches/8289477.patch diff --git a/srcpkgs/openjdk17/files/musl_patches/8289477.patch b/srcpkgs/openjdk17/files/musl_patches/8289477.patch new file mode 100644 index 000000000000..57ac4866b578 --- /dev/null +++ b/srcpkgs/openjdk17/files/musl_patches/8289477.patch @@ -0,0 +1,35 @@ +From da6d1fc0e0aeb1fdb504aced4b0dba0290ec240f Mon Sep 17 00:00:00 2001 +From: Thomas Stuefe +Date: Thu, 30 Jun 2022 06:19:25 +0000 +Subject: [PATCH] 8289477: Memory corruption with CPU_ALLOC, CPU_FREE on muslc + +Reviewed-by: dholmes, clanger +--- + src/hotspot/os/linux/os_linux.cpp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp +index 726926218907..8ee10e201c69 100644 +--- a/src/hotspot/os/linux/os_linux.cpp ++++ b/src/hotspot/os/linux/os_linux.cpp +@@ -4591,7 +4591,8 @@ static int _cpu_count(const cpu_set_t* cpus) { + // dynamic check - see 6515172 for details. + // If anything goes wrong we fallback to returning the number of online + // processors - which can be greater than the number available to the process. +-int os::Linux::active_processor_count() { ++static int get_active_processor_count() { ++ // Note: keep this function, with its CPU_xx macros, *outside* the os namespace (see JDK-8289477). + cpu_set_t cpus; // can represent at most 1024 (CPU_SETSIZE) processors + cpu_set_t* cpus_p = &cpus; + int cpus_size = sizeof(cpu_set_t); +@@ -4663,6 +4664,10 @@ int os::Linux::active_processor_count() { + return cpu_count; + } + ++int os::Linux::active_processor_count() { ++ return get_active_processor_count(); ++} ++ + // Determine the active processor count from one of + // three different sources: + // diff --git a/srcpkgs/openjdk17/template b/srcpkgs/openjdk17/template index 03ac17c81b4d..0763d2d5a41e 100644 --- a/srcpkgs/openjdk17/template +++ b/srcpkgs/openjdk17/template @@ -1,7 +1,7 @@ # Template file for 'openjdk17' pkgname=openjdk17 version=17.0.3+7 -revision=2 +revision=3 _gtest_ver=1.8.1 _java_ver="${version%%.*}" _jdk_update="${version#*+}"