RFR: 8313202: MutexLocker should disallow null Mutexes [v8]
Aleksey Shipilev
shade at openjdk.org
Tue Sep 12 11:46:35 UTC 2023
> 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`
Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision:
- Merge branch 'master' into JDK-8313202-mutexlocker-nulls
- Touchup whitespace
- Rewrite jvmtiManageCapabilities lock usage
- Re-instate old asserts
- Merge branch 'master' into JDK-8313202-mutexlocker-nulls
- Merge branch 'master' into JDK-8313202-mutexlocker-nulls
- Merge branch 'master' into JDK-8313202-mutexlocker-nulls
- Merge branch 'master' into JDK-8313202-mutexlocker-nulls
- Accept one more potentially nullptr mutex
- Merge branch 'master' into JDK-8313202-mutexlocker-nulls
- ... and 4 more: https://git.openjdk.org/jdk/compare/ac7097a6...e3da7697
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/15043/files
- new: https://git.openjdk.org/jdk/pull/15043/files/3676fa71..e3da7697
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=15043&range=07
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=15043&range=06-07
Stats: 26710 lines in 843 files changed: 15579 ins; 7371 del; 3760 mod
Patch: https://git.openjdk.org/jdk/pull/15043.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15043/head:pull/15043
PR: https://git.openjdk.org/jdk/pull/15043
More information about the hotspot-dev
mailing list