See here:
void assert_locked_or_safepoint(const Mutex* lock) {
// check if this thread owns the lock (common case)
assert(lock != NULL, "Need non-NULL lock");
if (lock->owned_by_self()) return;
if (SafepointSynchronize::is_at_safepoint()) return;
if (!Universe::is_fully_initialized()) return;
// see if invoker of VM operation owns it
VM_Operation* op = VMThread::vm_operation();
if (op != NULL && op->calling_thread() == lock->owner()) return;
fatal("must own lock %s", lock->name());
}
The call to VMThread::vm_operation() does not check if the calling thread is VMThread. This would fail the assert after JDK-8212107.