From bd4095a9c3f406c08af68a6439cc6b70f0f37e08 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 22 Dec 2023 00:46:39 -0500 Subject: [PATCH] New package: openjdk19-bootstrap-19.0.2+7 --- .../patches/FixNullPtrCast.patch | 36 ++ .../openjdk19-bootstrap/patches/cgroups.patch | 406 ++++++++++++++++++ srcpkgs/openjdk19-bootstrap/template | 101 +++++ srcpkgs/openjdk19-bootstrap/update | 4 + 4 files changed, 547 insertions(+) create mode 100644 srcpkgs/openjdk19-bootstrap/patches/FixNullPtrCast.patch create mode 100644 srcpkgs/openjdk19-bootstrap/patches/cgroups.patch create mode 100644 srcpkgs/openjdk19-bootstrap/template create mode 100644 srcpkgs/openjdk19-bootstrap/update diff --git a/srcpkgs/openjdk19-bootstrap/patches/FixNullPtrCast.patch b/srcpkgs/openjdk19-bootstrap/patches/FixNullPtrCast.patch new file mode 100644 index 00000000000..6f051587927 --- /dev/null +++ b/srcpkgs/openjdk19-bootstrap/patches/FixNullPtrCast.patch @@ -0,0 +1,36 @@ +Patch taken from Alpine: https://git.alpinelinux.org/aports/tree/community/openjdk17/FixNullPtrCast.patch + +same fix for armv7l-musl added + +Subject: Fix cast errors with latest GCC +Upstream: No +Author: Simon Frankenberger + +This patch fixes one remaining casting error reported by GCC 12 for aarch64 + +--- old/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp ++++ new/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp +@@ -267,7 +267,7 @@ + + virtual void pass_object() { + intptr_t* addr = single_slot_addr(); +- intptr_t value = *addr == 0 ? NULL : (intptr_t)addr; ++ intptr_t value = *addr == 0 ? (intptr_t) 0 : (intptr_t)addr; + if (pass_gpr(value) < 0) { + pass_stack<>(value); + } + +--- old/src/hotspot/cpu/arm/interpreterRT_arm.cpp ++++ new/src/hotspot/cpu/arm/interpreterRT_arm.cpp +@@ -306,8 +306,8 @@ + virtual void pass_object() { + intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0)); + if(_last_gp < GPR_PARAMS) { +- _toGP[_last_gp++] = (*(intptr_t*)from_addr == 0) ? NULL : from_addr; ++ _toGP[_last_gp++] = (*(intptr_t*)from_addr == 0) ? (intptr_t) 0 : (intptr_t)from_addr; + } else { +- *_to++ = (*(intptr_t*)from_addr == 0) ? NULL : from_addr; ++ *_to++ = (*(intptr_t*)from_addr == 0) ? (intptr_t) 0 : (intptr_t)from_addr; + } + _from -= Interpreter::stackElementSize; + } diff --git a/srcpkgs/openjdk19-bootstrap/patches/cgroups.patch b/srcpkgs/openjdk19-bootstrap/patches/cgroups.patch new file mode 100644 index 00000000000..efeaa0871a0 --- /dev/null +++ b/srcpkgs/openjdk19-bootstrap/patches/cgroups.patch @@ -0,0 +1,406 @@ +From 8f3bbe950fb5a3d9f6cae122209df01df0f342f0 Mon Sep 17 00:00:00 2001 +From: casparcwang +Date: Thu, 15 Sep 2022 08:47:05 +0000 +Subject: [PATCH] 8293472: Incorrect container resource limit detection if + manual cgroup fs mounts present + +Reviewed-by: sgehwolf, iklam +--- + .../os/linux/cgroupSubsystem_linux.cpp | 69 +++++++++--------- + .../os/linux/cgroupSubsystem_linux.hpp | 5 ++ + .../cgroup/CgroupSubsystemFactory.java | 71 ++++++++++++++++--- + .../containers/docker/DockerBasicTest.java | 14 ++++ + .../containers/docker/TestCPUAwareness.java | 15 ++-- + .../docker/TestMemoryAwareness.java | 15 ++-- + 6 files changed, 135 insertions(+), 54 deletions(-) + +diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp +index baa7a40a9146..1f3a6dfcaf6b 100644 +--- a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp ++++ b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp +@@ -123,6 +123,32 @@ CgroupSubsystem* CgroupSubsystemFactory::create() { + return new CgroupV1Subsystem(cpuset, cpu, cpuacct, pids, memory); + } + ++void CgroupSubsystemFactory::set_controller_paths(CgroupInfo* cg_infos, ++ int controller, ++ const char* name, ++ char* mount_path, ++ char* root_path) { ++ if (cg_infos[controller]._mount_path != NULL) { ++ // On some systems duplicate controllers get mounted in addition to ++ // the main cgroup controllers most likely under /sys/fs/cgroup. In that ++ // case pick the one under /sys/fs/cgroup and discard others. ++ if (strstr(cg_infos[controller]._mount_path, "/sys/fs/cgroup") != cg_infos[controller]._mount_path) { ++ log_debug(os, container)("Duplicate %s controllers detected. Picking %s, skipping %s.", ++ name, mount_path, cg_infos[controller]._mount_path); ++ os::free(cg_infos[controller]._mount_path); ++ os::free(cg_infos[controller]._root_mount_path); ++ cg_infos[controller]._mount_path = os::strdup(mount_path); ++ cg_infos[controller]._root_mount_path = os::strdup(root_path); ++ } else { ++ log_debug(os, container)("Duplicate %s controllers detected. Picking %s, skipping %s.", ++ name, cg_infos[controller]._mount_path, mount_path); ++ } ++ } else { ++ cg_infos[controller]._mount_path = os::strdup(mount_path); ++ cg_infos[controller]._root_mount_path = os::strdup(root_path); ++ } ++} ++ + bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos, + const char* proc_cgroups, + const char* proc_self_cgroup, +@@ -288,7 +314,6 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos, + bool cgroupv2_mount_point_found = false; + bool any_cgroup_mounts_found = false; + while ((p = fgets(buf, MAXPATHLEN, mntinfo)) != NULL) { +- char tmp_mount_point[MAXPATHLEN+1]; + char tmp_fs_type[MAXPATHLEN+1]; + char tmproot[MAXPATHLEN+1]; + char tmpmount[MAXPATHLEN+1]; +@@ -299,15 +324,13 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos, + // Cgroup v2 relevant info. We only look for the _mount_path iff is_cgroupsV2 so + // as to avoid memory stomping of the _mount_path pointer later on in the cgroup v1 + // block in the hybrid case. +- // +- if (is_cgroupsV2 && sscanf(p, "%*d %*d %*d:%*d %*s %s %*[^-]- %s %*s %*s", tmp_mount_point, tmp_fs_type) == 2) { ++ if (is_cgroupsV2 && sscanf(p, "%*d %*d %*d:%*d %s %s %*[^-]- %s %*s %*s", tmproot, tmpmount, tmp_fs_type) == 3) { + // we likely have an early match return (e.g. cgroup fs match), be sure we have cgroup2 as fstype +- if (!cgroupv2_mount_point_found && strcmp("cgroup2", tmp_fs_type) == 0) { ++ if (strcmp("cgroup2", tmp_fs_type) == 0) { + cgroupv2_mount_point_found = true; + any_cgroup_mounts_found = true; + for (int i = 0; i < CG_INFO_LENGTH; i++) { +- assert(cg_infos[i]._mount_path == NULL, "_mount_path memory stomping"); +- cg_infos[i]._mount_path = os::strdup(tmp_mount_point); ++ set_controller_paths(cg_infos, i, "(cg2, unified)", tmpmount, tmproot); + } + } + } +@@ -332,47 +355,23 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos, + while ((token = strsep(&cptr, ",")) != NULL) { + if (strcmp(token, "memory") == 0) { + any_cgroup_mounts_found = true; +- assert(cg_infos[MEMORY_IDX]._mount_path == NULL, "stomping of _mount_path"); +- cg_infos[MEMORY_IDX]._mount_path = os::strdup(tmpmount); +- cg_infos[MEMORY_IDX]._root_mount_path = os::strdup(tmproot); ++ set_controller_paths(cg_infos, MEMORY_IDX, token, tmpmount, tmproot); + cg_infos[MEMORY_IDX]._data_complete = true; + } else if (strcmp(token, "cpuset") == 0) { + any_cgroup_mounts_found = true; +- if (cg_infos[CPUSET_IDX]._mount_path != NULL) { +- // On some systems duplicate cpuset controllers get mounted in addition to +- // the main cgroup controllers most likely under /sys/fs/cgroup. In that +- // case pick the one under /sys/fs/cgroup and discard others. +- if (strstr(cg_infos[CPUSET_IDX]._mount_path, "/sys/fs/cgroup") != cg_infos[CPUSET_IDX]._mount_path) { +- log_warning(os, container)("Duplicate cpuset controllers detected. Picking %s, skipping %s.", +- tmpmount, cg_infos[CPUSET_IDX]._mount_path); +- os::free(cg_infos[CPUSET_IDX]._mount_path); +- cg_infos[CPUSET_IDX]._mount_path = os::strdup(tmpmount); +- } else { +- log_warning(os, container)("Duplicate cpuset controllers detected. Picking %s, skipping %s.", +- cg_infos[CPUSET_IDX]._mount_path, tmpmount); +- } +- } else { +- cg_infos[CPUSET_IDX]._mount_path = os::strdup(tmpmount); +- } +- cg_infos[CPUSET_IDX]._root_mount_path = os::strdup(tmproot); ++ set_controller_paths(cg_infos, CPUSET_IDX, token, tmpmount, tmproot); + cg_infos[CPUSET_IDX]._data_complete = true; + } else if (strcmp(token, "cpu") == 0) { + any_cgroup_mounts_found = true; +- assert(cg_infos[CPU_IDX]._mount_path == NULL, "stomping of _mount_path"); +- cg_infos[CPU_IDX]._mount_path = os::strdup(tmpmount); +- cg_infos[CPU_IDX]._root_mount_path = os::strdup(tmproot); ++ set_controller_paths(cg_infos, CPU_IDX, token, tmpmount, tmproot); + cg_infos[CPU_IDX]._data_complete = true; + } else if (strcmp(token, "cpuacct") == 0) { + any_cgroup_mounts_found = true; +- assert(cg_infos[CPUACCT_IDX]._mount_path == NULL, "stomping of _mount_path"); +- cg_infos[CPUACCT_IDX]._mount_path = os::strdup(tmpmount); +- cg_infos[CPUACCT_IDX]._root_mount_path = os::strdup(tmproot); ++ set_controller_paths(cg_infos, CPUACCT_IDX, token, tmpmount, tmproot); + cg_infos[CPUACCT_IDX]._data_complete = true; + } else if (strcmp(token, "pids") == 0) { + any_cgroup_mounts_found = true; +- assert(cg_infos[PIDS_IDX]._mount_path == NULL, "stomping of _mount_path"); +- cg_infos[PIDS_IDX]._mount_path = os::strdup(tmpmount); +- cg_infos[PIDS_IDX]._root_mount_path = os::strdup(tmproot); ++ set_controller_paths(cg_infos, PIDS_IDX, token, tmpmount, tmproot); + cg_infos[PIDS_IDX]._data_complete = true; + } + } +diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.hpp b/src/hotspot/os/linux/cgroupSubsystem_linux.hpp +index 2e3fc8e8bc78..91456b3d0e14 100644 +--- a/src/hotspot/os/linux/cgroupSubsystem_linux.hpp ++++ b/src/hotspot/os/linux/cgroupSubsystem_linux.hpp +@@ -311,6 +311,11 @@ class CgroupSubsystemFactory: AllStatic { + } + #endif + ++ static void set_controller_paths(CgroupInfo* cg_infos, ++ int controller, ++ const char* name, ++ char* mount_path, ++ char* root_path); + // Determine the cgroup type (version 1 or version 2), given + // relevant paths to files. Sets 'flags' accordingly. + static bool determine_type(CgroupInfo* cg_infos, +diff --git a/test/hotspot/jtreg/containers/cgroup/CgroupSubsystemFactory.java b/test/hotspot/jtreg/containers/cgroup/CgroupSubsystemFactory.java +index 54807119d82e..7eb78fa447fd 100644 +--- a/test/hotspot/jtreg/containers/cgroup/CgroupSubsystemFactory.java ++++ b/test/hotspot/jtreg/containers/cgroup/CgroupSubsystemFactory.java +@@ -62,11 +62,19 @@ public class CgroupSubsystemFactory { + private Path cgroupv1MntInfoZeroHierarchy; + private Path cgroupv2CgInfoZeroHierarchy; + private Path cgroupv2MntInfoZeroHierarchy; ++ private Path cgroupv2MntInfoDouble; ++ private Path cgroupv2MntInfoDouble2; + private Path cgroupv1CgInfoNonZeroHierarchy; + private Path cgroupv1MntInfoNonZeroHierarchyOtherOrder; + private Path cgroupv1MntInfoNonZeroHierarchy; + private Path cgroupv1MntInfoDoubleCpuset; + private Path cgroupv1MntInfoDoubleCpuset2; ++ private Path cgroupv1MntInfoDoubleMemory; ++ private Path cgroupv1MntInfoDoubleMemory2; ++ private Path cgroupv1MntInfoDoubleCpu; ++ private Path cgroupv1MntInfoDoubleCpu2; ++ private Path cgroupv1MntInfoDoublePids; ++ private Path cgroupv1MntInfoDoublePids2; + private Path cgroupv1MntInfoSystemdOnly; + private String mntInfoEmpty = ""; + private Path cgroupV1SelfCgroup; +@@ -160,6 +168,15 @@ public class CgroupSubsystemFactory { + private String mntInfoCgroupv1MoreCpusetLine = "121 32 0:37 / /cpusets rw,relatime shared:69 - cgroup none rw,cpuset\n"; + private String mntInfoCgroupv1DoubleCpuset = mntInfoCgroupv1MoreCpusetLine + mntInfoHybrid; + private String mntInfoCgroupv1DoubleCpuset2 = mntInfoHybrid + mntInfoCgroupv1MoreCpusetLine; ++ private String mntInfoCgroupv1MoreMemoryLine = "1100 1098 0:28 / /memory rw,nosuid,nodev,noexec,relatime master:6 - cgroup cgroup rw,memory\n"; ++ private String mntInfoCgroupv1DoubleMemory = mntInfoCgroupv1MoreMemoryLine + mntInfoHybrid; ++ private String mntInfoCgroupv1DoubleMemory2 = mntInfoHybrid + mntInfoCgroupv1MoreMemoryLine; ++ private String mntInfoCgroupv1DoubleCpuLine = "1101 1098 0:29 / /cpu,cpuacct rw,nosuid,nodev,noexec,relatime master:7 - cgroup cgroup rw,cpu,cpuacct\n"; ++ private String mntInfoCgroupv1DoubleCpu = mntInfoCgroupv1DoubleCpuLine + mntInfoHybrid; ++ private String mntInfoCgroupv1DoubleCpu2 = mntInfoHybrid + mntInfoCgroupv1DoubleCpuLine; ++ private String mntInfoCgroupv1DoublePidsLine = "1107 1098 0:35 / /pids rw,nosuid,nodev,noexec,relatime master:13 - cgroup cgroup rw,pids\n"; ++ private String mntInfoCgroupv1DoublePids = mntInfoCgroupv1DoublePidsLine + mntInfoHybrid; ++ private String mntInfoCgroupv1DoublePids2 = mntInfoHybrid + mntInfoCgroupv1DoublePidsLine; + private String cgroupsNonZeroHierarchy = + "#subsys_name hierarchy num_cgroups enabled\n" + + "cpuset 3 1 1\n" + +@@ -175,7 +192,11 @@ public class CgroupSubsystemFactory { + "hugetlb 6 1 1\n" + + "pids 9 80 1"; // hierarchy has to match procSelfCgroupHybridContent + private String mntInfoCgroupsV2Only = +- "28 21 0:25 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:4 - cgroup2 none rw,seclabel,nsdelegate"; ++ "28 21 0:25 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:4 - cgroup2 none rw,seclabel,nsdelegate\n"; ++ private String mntInfoCgroupsV2MoreLine = ++ "240 232 0:24 /../.. /cgroup-in ro,relatime - cgroup2 cgroup2 rw,nsdelegate\n"; ++ private String mntInfoCgroupsV2Double = mntInfoCgroupsV2MoreLine + mntInfoCgroupsV2Only; ++ private String mntInfoCgroupsV2Double2 = mntInfoCgroupsV2Only + mntInfoCgroupsV2MoreLine; + private String mntInfoCgroupsV1SystemdOnly = + "35 26 0:26 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup systemd rw,name=systemd\n" + + "26 18 0:19 / /sys/fs/cgroup rw,relatime - tmpfs none rw,size=4k,mode=755\n"; +@@ -217,6 +238,12 @@ private void setup() { + cgroupv2MntInfoZeroHierarchy = Paths.get(existingDirectory.toString(), "mountinfo_cgroupv2"); + Files.writeString(cgroupv2MntInfoZeroHierarchy, mntInfoCgroupsV2Only); + ++ cgroupv2MntInfoDouble = Paths.get(existingDirectory.toString(), "mountinfo_cgroupv2_double"); ++ Files.writeString(cgroupv2MntInfoDouble, mntInfoCgroupsV2Double); ++ ++ cgroupv2MntInfoDouble2 = Paths.get(existingDirectory.toString(), "mountinfo_cgroupv2_double2"); ++ Files.writeString(cgroupv2MntInfoDouble2, mntInfoCgroupsV2Double2); ++ + cgroupv1CgInfoNonZeroHierarchy = Paths.get(existingDirectory.toString(), "cgroups_non_zero"); + Files.writeString(cgroupv1CgInfoNonZeroHierarchy, cgroupsNonZeroHierarchy); + +@@ -244,6 +271,24 @@ private void setup() { + cgroupv1MntInfoDoubleCpuset2 = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_cpuset2"); + Files.writeString(cgroupv1MntInfoDoubleCpuset2, mntInfoCgroupv1DoubleCpuset2); + ++ cgroupv1MntInfoDoubleMemory = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_memory"); ++ Files.writeString(cgroupv1MntInfoDoubleMemory, mntInfoCgroupv1DoubleMemory); ++ ++ cgroupv1MntInfoDoubleMemory2 = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_memory2"); ++ Files.writeString(cgroupv1MntInfoDoubleMemory2, mntInfoCgroupv1DoubleMemory2); ++ ++ cgroupv1MntInfoDoubleCpu = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_cpu"); ++ Files.writeString(cgroupv1MntInfoDoubleCpu, mntInfoCgroupv1DoubleCpu); ++ ++ cgroupv1MntInfoDoubleCpu2 = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_cpu2"); ++ Files.writeString(cgroupv1MntInfoDoubleCpu2, mntInfoCgroupv1DoubleCpu2); ++ ++ cgroupv1MntInfoDoublePids = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_pids"); ++ Files.writeString(cgroupv1MntInfoDoublePids, mntInfoCgroupv1DoublePids); ++ ++ cgroupv1MntInfoDoublePids2 = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_pids2"); ++ Files.writeString(cgroupv1MntInfoDoublePids2, mntInfoCgroupv1DoublePids2); ++ + cgroupv1MntInfoSystemdOnly = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_systemd_only"); + Files.writeString(cgroupv1MntInfoSystemdOnly, mntInfoCgroupsV1SystemdOnly); + +@@ -291,14 +336,14 @@ public void testCgroupv1JoinControllerCombo(WhiteBox wb) { + System.out.println("testCgroupv1JoinControllerMounts PASSED!"); + } + +- public void testCgroupv1MultipleCpusetMounts(WhiteBox wb, Path mountInfo) { ++ public void testCgroupv1MultipleControllerMounts(WhiteBox wb, Path mountInfo) { + String procCgroups = cgroupv1CgInfoNonZeroHierarchy.toString(); + String procSelfCgroup = cgroupV1SelfCgroup.toString(); + String procSelfMountinfo = mountInfo.toString(); + int retval = wb.validateCgroup(procCgroups, procSelfCgroup, procSelfMountinfo); +- Asserts.assertEQ(CGROUPS_V1, retval, "Multiple cpuset controllers, but only one in /sys/fs/cgroup"); ++ Asserts.assertEQ(CGROUPS_V1, retval, "Multiple controllers, but only one in /sys/fs/cgroup"); + Asserts.assertTrue(isValidCgroup(retval)); +- System.out.println("testCgroupv1MultipleCpusetMounts PASSED!"); ++ System.out.println("testCgroupv1MultipleControllerMounts PASSED!"); + } + + public void testCgroupv1SystemdOnly(WhiteBox wb) { +@@ -341,10 +386,10 @@ public void testCgroupv1MissingMemoryController(WhiteBox wb) { + System.out.println("testCgroupv1MissingMemoryController PASSED!"); + } + +- public void testCgroupv2(WhiteBox wb) { ++ public void testCgroupv2(WhiteBox wb, Path mountInfo) { + String procCgroups = cgroupv2CgInfoZeroHierarchy.toString(); + String procSelfCgroup = cgroupV2SelfCgroup.toString(); +- String procSelfMountinfo = cgroupv2MntInfoZeroHierarchy.toString(); ++ String procSelfMountinfo = mountInfo.toString(); + int retval = wb.validateCgroup(procCgroups, procSelfCgroup, procSelfMountinfo); + Asserts.assertEQ(CGROUPS_V2, retval, "Expected"); + Asserts.assertTrue(isValidCgroup(retval)); +@@ -388,13 +433,21 @@ public static void main(String[] args) throws Exception { + try { + test.testCgroupv1SystemdOnly(wb); + test.testCgroupv1NoMounts(wb); +- test.testCgroupv2(wb); ++ test.testCgroupv2(wb, test.cgroupv2MntInfoZeroHierarchy); ++ test.testCgroupv2(wb, test.cgroupv2MntInfoDouble); ++ test.testCgroupv2(wb, test.cgroupv2MntInfoDouble2); + test.testCgroupV1Hybrid(wb); + test.testCgroupV1HybridMntInfoOrder(wb); + test.testCgroupv1MissingMemoryController(wb); + test.testCgroupv2NoCgroup2Fs(wb); +- test.testCgroupv1MultipleCpusetMounts(wb, test.cgroupv1MntInfoDoubleCpuset); +- test.testCgroupv1MultipleCpusetMounts(wb, test.cgroupv1MntInfoDoubleCpuset2); ++ test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleCpuset); ++ test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleCpuset2); ++ test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleMemory); ++ test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleMemory2); ++ test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleCpu); ++ test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleCpu2); ++ test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoublePids); ++ test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoublePids2); + test.testCgroupv1JoinControllerCombo(wb); + test.testNonZeroHierarchyOnlyFreezer(wb); + } finally { +diff --git a/test/hotspot/jtreg/containers/docker/DockerBasicTest.java b/test/hotspot/jtreg/containers/docker/DockerBasicTest.java +index bcbd2ffa21df..357eb3db4972 100644 +--- a/test/hotspot/jtreg/containers/docker/DockerBasicTest.java ++++ b/test/hotspot/jtreg/containers/docker/DockerBasicTest.java +@@ -53,6 +53,7 @@ public static void main(String[] args) throws Exception { + try { + testJavaVersion(); + testHelloDocker(); ++ testJavaVersionWithCgMounts(); + } finally { + if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { + DockerTestUtils.removeDockerImage(imageNameAndTag); +@@ -81,4 +82,17 @@ private static void testHelloDocker() throws Exception { + .shouldHaveExitValue(0) + .shouldContain("Hello Docker"); + } ++ ++ ++ private static void testJavaVersionWithCgMounts() throws Exception { ++ DockerRunOptions opts = ++ new DockerRunOptions(imageNameAndTag, "/jdk/bin/java", "-version") ++ .addDockerOpts("-v", "/sys/fs/cgroup:/cgroups-in:ro"); ++ ++ // Duplicated cgroup mounts should be handled by the container detection ++ // code and should not cause any error/warning output. ++ DockerTestUtils.dockerRunJava(opts) ++ .shouldHaveExitValue(0) ++ .shouldNotMatch("\\[os,container *\\]"); ++ } + } +diff --git a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java +index 93881c615bd9..a41dc9c39392 100644 +--- a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java ++++ b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java +@@ -70,10 +70,11 @@ public static void main(String[] args) throws Exception { + testActiveProcessorCount(2, 2); + + // cpu quota and period +- testCpuQuotaAndPeriod(50*1000, 100*1000); +- testCpuQuotaAndPeriod(100*1000, 100*1000); +- testCpuQuotaAndPeriod(150*1000, 100*1000); +- testCpuQuotaAndPeriod(400*1000, 100*1000); ++ testCpuQuotaAndPeriod(50*1000, 100*1000, false); ++ testCpuQuotaAndPeriod(100*1000, 100*1000, false); ++ testCpuQuotaAndPeriod(150*1000, 100*1000, false); ++ testCpuQuotaAndPeriod(400*1000, 100*1000, false); ++ testCpuQuotaAndPeriod(50*1000, 100*1000, true /* additional cgroup mount */); + + testOperatingSystemMXBeanAwareness("0.5", "1"); + testOperatingSystemMXBeanAwareness("1.0", "1"); +@@ -153,7 +154,7 @@ private static int adjustExpectedAPCForAvailableCPUs(int expectedAPC) { + } + + +- private static void testCpuQuotaAndPeriod(int quota, int period) ++ private static void testCpuQuotaAndPeriod(int quota, int period, boolean addCgmounts) + throws Exception { + Common.logNewTestCase("test cpu quota and period: "); + System.out.println("quota = " + quota); +@@ -167,6 +168,10 @@ private static void testCpuQuotaAndPeriod(int quota, int period) + .addDockerOpts("--cpu-period=" + period) + .addDockerOpts("--cpu-quota=" + quota); + ++ if (addCgmounts) { ++ opts = opts.addDockerOpts("--volume", "/sys/fs/cgroup:/cgroups-in:ro"); ++ } ++ + Common.run(opts) + .shouldMatch("CPU Period is.*" + period) + .shouldMatch("CPU Quota is.*" + quota) +diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java b/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java +index ff5cd23cc65f..d6ff603157a6 100644 +--- a/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java ++++ b/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java +@@ -63,10 +63,11 @@ public static void main(String[] args) throws Exception { + DockerTestUtils.buildJdkContainerImage(imageName); + + try { +- testMemoryLimit("100m", "104857600"); +- testMemoryLimit("500m", "524288000"); +- testMemoryLimit("1g", "1073741824"); +- testMemoryLimit("4g", "4294967296"); ++ testMemoryLimit("100m", "104857600", false); ++ testMemoryLimit("500m", "524288000", false); ++ testMemoryLimit("1g", "1073741824", false); ++ testMemoryLimit("4g", "4294967296", false); ++ testMemoryLimit("100m", "104857600", true /* additional cgroup mount */); + + testMemorySoftLimit("500m", "524288000"); + testMemorySoftLimit("1g", "1073741824"); +@@ -98,7 +99,7 @@ public static void main(String[] args) throws Exception { + } + + +- private static void testMemoryLimit(String valueToSet, String expectedTraceValue) ++ private static void testMemoryLimit(String valueToSet, String expectedTraceValue, boolean addCgmounts) + throws Exception { + + Common.logNewTestCase("memory limit: " + valueToSet); +@@ -106,6 +107,10 @@ private static void testMemoryLimit(String valueToSet, String expectedTraceValue + DockerRunOptions opts = Common.newOpts(imageName) + .addDockerOpts("--memory", valueToSet); + ++ if (addCgmounts) { ++ opts = opts.addDockerOpts("--volume", "/sys/fs/cgroup:/cgroups-in:ro"); ++ } ++ + Common.run(opts) + .shouldMatch("Memory Limit is:.*" + expectedTraceValue); + } diff --git a/srcpkgs/openjdk19-bootstrap/template b/srcpkgs/openjdk19-bootstrap/template new file mode 100644 index 00000000000..25ac0a7a17a --- /dev/null +++ b/srcpkgs/openjdk19-bootstrap/template @@ -0,0 +1,101 @@ +# Template file for 'openjdk19-bootstrap' +pkgname=openjdk19-bootstrap +version=19.0.2+7 +revision=1 +_gtest_ver=1.8.1 +_java_ver="${version%%.*}" +_jdk_update="${version#*+}" +_base_version="${version%+*}" +_jdk_home="usr/lib/jvm/openjdk${_java_ver}" +archs="x86_64* aarch64*" +create_wrksrc=yes +build_wrksrc="jdk${_java_ver}u-jdk-${version/+/-}" +build_style=gnu-configure +configure_args="--disable-warnings-as-errors + --enable-unlimited-crypto + --with-zlib=system + --with-libjpeg=system + --with-giflib=system + --with-libpng=system + --with-lcms=system + --with-jtreg=no + --with-gtest=../googletest-release-${_gtest_ver} + --with-debug-level=release + --with-native-debug-symbols=internal + --with-jobs=${XBPS_ORIG_MAKEJOBS} + --with-version-pre= + --with-version-build=${_jdk_update} + --with-version-opt=void-r${revision} + --with-vendor-name=Void + --with-vendor-url=https://voidlinux.org/ + --with-vendor-bug-url=https://github.com/void-linux/void-packages/issues + --with-vendor-vm-bug-url=https://github.com/void-linux/void-packages/issues + --with-boot-jdk=/usr/lib/jvm/openjdk$(( _java_ver - 1 ))" +make_build_args="images" +make_check_target="test-hotspot-gtest" +hostmakedepends="pkg-config automake autoconf cpio tar unzip zip ca-certificates + openssl zlib-devel which make-ca openjdk$(( _java_ver - 1 ))-bootstrap" +makedepends="libXrender-devel libXtst-devel libXt-devel libXrandr-devel + giflib-devel libjpeg-turbo-devel cups-devel freetype-devel alsa-lib-devel + fontconfig-devel zlib-devel lcms2-devel" +short_desc="OpenJDK Java Development Kit (bootstrap version ${_java_ver})" +maintainer="classabbyamp " +license="GPL-2.0-only WITH Classpath-exception-2.0" +homepage="http://openjdk.java.net/" +distfiles="https://github.com/openjdk/jdk${_java_ver}u/archive/jdk-${version}.tar.gz + https://github.com/google/googletest/archive/refs/tags/release-${_gtest_ver}.tar.gz" +checksum="5903efd527dd08e9c235c8822e3d5699c3d18a8618c3e533307e8d6491ffbbf0 + 9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c" +nocross=yes +repository=bootstrap +patch_args="-Np1 --directory=$build_wrksrc" + +# Build and check are still parallel, but don't use -jN. +disable_parallel_build=yes +disable_parallel_check=yes + +case "$XBPS_TARGET_MACHINE" in + i686*|arm*) broken="Unsupported architecture" ;; +esac + +post_extract() { + chmod +x "$build_wrksrc"/configure + if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + rm -r "$build_wrksrc"/src/jdk.hotspot.agent + fi +} + +do_configure() { + CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2/} + CXXFLAGS=${CXXFLAGS/-D_FORTIFY_SOURCE=2/} + + # force ELFv2 for ppc64 just in case + case "$XBPS_TARGET_MACHINE" in + ppc64*) + CFLAGS+=" -DABI_ELFv2" + CXXFLAGS+=" -DABI_ELFv2" + ;; + esac + + configure_args=${configure_args/--with-libtool-sysroot=$XBPS_CROSS_BASE} + if [ "$XBPS_CCACHE" ] && [ -z "$CROSS_BUILD" ]; then + configure_args+=" --enable-ccache" + CC="/usr/bin/cc" + CXX="/usr/bin/c++" + fi + ./configure ${configure_args} \ + --with-extra-cflags="$CFLAGS" \ + --with-extra-cxxflags="$CXXFLAGS" \ + --with-extra-ldflags="$LDFLAGS" \ + READELF="$READELF" AR="$AR" STRIP="$STRIP" NM="$NM" \ + OBJDUMP="$OBJDUMP" OBJCOPY="$OBJCOPY" +} + +pre_install() { + make_install_args="INSTALL_PREFIX=${DESTDIR}/usr/lib" +} + +post_install() { + rm -rf "${DESTDIR}"/usr/lib/bin + mv "${DESTDIR}"/usr/lib/jvm/openjdk-"${_base_version}" "${DESTDIR}/$_jdk_home" +} diff --git a/srcpkgs/openjdk19-bootstrap/update b/srcpkgs/openjdk19-bootstrap/update new file mode 100644 index 00000000000..d8abe90aa84 --- /dev/null +++ b/srcpkgs/openjdk19-bootstrap/update @@ -0,0 +1,4 @@ +site="https://github.com/openjdk/jdk19u/tags" +pattern='jdk-\K19\.[\d.+]+(?=\.)' +# don't need to update the bootstrap package +ignore="*"