8337124: (fs) sun.nio.fs.WindowsSecurity.enablePrivilege should pin when continuations supported

Reviewed-by: jpai, alanb
This commit is contained in:
Brian Burkhalter 2024-07-25 20:59:48 +00:00
parent b5b5a5b8e5
commit 8c28f25e13

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
package sun.nio.fs;
import jdk.internal.misc.PreviewFeatures;
import jdk.internal.vm.Continuation;
import jdk.internal.vm.ContinuationSupport;
import static sun.nio.fs.WindowsNativeDispatcher.*;
import static sun.nio.fs.WindowsConstants.*;
@ -106,7 +106,7 @@ class WindowsSecurity {
final boolean needToRevert = elevated;
// prevent yielding with privileges
if (PreviewFeatures.isEnabled())
if (ContinuationSupport.isSupported())
Continuation.pin();
return () -> {
@ -126,7 +126,7 @@ class WindowsSecurity {
}
} finally {
LocalFree(pLuid);
if (PreviewFeatures.isEnabled())
if (ContinuationSupport.isSupported())
Continuation.unpin();
}
};