RFR: 8322420: [Linux] cgroup v2: Limits in parent nested control groups are not detected [v2]
Thomas Stuefe
stuefe at openjdk.org
Wed Aug 28 07:44:25 UTC 2024
On Tue, 27 Aug 2024 18:33:14 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp line 46:
>>
>>> 44: }
>>> 45: if (_path != nullptr) {
>>> 46: os::free(_path);
>>
>> Please set _path to nullptr, the dangling pointer makes me nervous.
>
> It's set in the [initialization list](https://github.com/openjdk/jdk/pull/20646/files#diff-ca999d88f840ec06af060a8245bec6e0783fe60d7fe07908547111c10873c1f6R49) to `nullptr`. Is that not enough?
You free _path here, but it is still not nullptr. You then rely on all three code paths below to reset _path to a sensible value. That is brittle and may bitrot. It would be cleaner to add a _path = nullptr right after the free, to prevent the old invalif pointer from being accidentally used.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20646#discussion_r1734155856
More information about the hotspot-runtime-dev
mailing list