On Thu, 11 Jul 2024 06:50:21 GMT, Jan Kratochvil <jkratoch...@openjdk.org> wrote:
>> The testcase requires root permissions. >> >> Designed by Severin Gehwolf, implemented by Jan Kratochvil. > > Jan Kratochvil has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 103 commits: > > - Fix the gtest > - fix compilation warning > - fix the gtest > - less refactorizations > - remove not a real backward compat. > - whitespace > - less refactorizations > - reduce refactorizations > - Fix caching > - Merge branch 'master' into master-cgroup > - ... and 93 more: https://git.openjdk.org/jdk/compare/537d20af...060e7688 src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp line 50: > 48: _path(construct_path(mount_path, > cgroup_path)) { > 49: } > 50: // Shallow copy constructor I had to remove the "shallow" part as it was not memory safe afterwards and one could easily get: ================================================================= ==3770369==ERROR: AddressSanitizer: heap-use-after-free on address 0x502000001530 at pc 0x7f086bcc45c0 bp 0x7f086adfd7b0 sp 0x7f086adfcf70 READ of size 1 at 0x502000001530 thread T1 #0 0x7f086bcc45bf in strcmp.part.0 (/lib64/libasan.so.8+0xc45bf) (BuildId: c1431025b5d8af781c22c9ceea71f065c547d32d) #1 0x7f0862c77e55 in CgroupController::set_path(char const*) /home/azul/azul/openjdk-git/src/hotspot/os/linux/cgroupSubsystem_linux.cpp:841 ... 0x502000001530 is located 0 bytes inside of 2-byte region [0x502000001530,0x502000001532) freed by thread T1 here: ... #4 0x7f08655c537c in os::free(void*) /home/azul/azul/openjdk-git/src/hotspot/share/runtime/os.cpp:775 #5 0x7f0862c7a456 in CgroupController::~CgroupController() /home/azul/azul/openjdk-git/src/hotspot/os/linux/cgroupSubsystem_linux.hpp:184 ... previously allocated by thread T1 here: #0 0x7f086bcf7997 in malloc (/lib64/libasan.so.8+0xf7997) (BuildId: c1431025b5d8af781c22c9ceea71f065c547d32d) ... #7 0x7f08655c87df in os::strdup(char const*, MEMFLAGS) /home/azul/azul/openjdk-git/src/hotspot/share/runtime/os.cpp:605 #8 0x7f0862c7a26f in CgroupController::CgroupController(char*, char*, bool) /home/azul/azul/openjdk-git/src/hotspot/os/linux/cgroupSubsystem_linux.hpp:170 I plan to fix the ugly value-copy in a later refactorization. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17198#discussion_r1673497620