Integrated: 8313202: MutexLocker should disallow null Mutexes
Aleksey Shipilev
shade at openjdk.org
Wed Sep 13 07:35:59 UTC 2023
On Wed, 26 Jul 2023 17:06:02 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> As seen in [JDK-8313081](https://bugs.openjdk.org/browse/JDK-8313081), it is fairly easy to pass nullptr `Mutex` to `MutexLocker` by accident, which would just silently avoid the lock.
>
> There are a few places in Hotspot where we pass `nullptr` to simulate re-entrancy and/or conditionally take the lock. Those places can be more explicit, and the default `MutexLocker` can disallow nullptrs for extra safety.
>
> More thorough testing with different GC/JIT combinations is running now, we might find more issues there. Meanwhile, please comment on the approach.
>
> Additional testing:
> - [x] `grep -R "MutexLocker " src/hotspot | grep -i null`, only new `ConditionalMutexLocker` hits
> - [x] `grep -R "MutexLocker " src/hotspot | grep -i ?`, no hits
> - [x] Linux AArch64 fastdebug, `tier1 tier2 tier3` x `Serial Parallel G1 Shenandoah`
This pull request has now been integrated.
Changeset: 2d168c57
Author: Aleksey Shipilev <shade at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/2d168c573402c0fc3dfb6c1fe6f48ec46997fa67
Stats: 110 lines in 18 files changed: 46 ins; 13 del; 51 mod
8313202: MutexLocker should disallow null Mutexes
Reviewed-by: dholmes, coleenp, dcubed
-------------
PR: https://git.openjdk.org/jdk/pull/15043
More information about the hotspot-dev
mailing list