8309727: Assert privileges while reading the jdk.incubator.vector.VECTOR_ACCESS_OOB_CHECK system property

Reviewed-by: rriggs, uschindler, psandoz
This commit is contained in:
Chris Hegarty 2023-06-09 19:25:21 +00:00
parent 7d6f97d04d
commit cee5724d09
3 changed files with 34 additions and 2 deletions

View file

@ -26,10 +26,14 @@ package jdk.incubator.vector;
import jdk.internal.vm.annotation.ForceInline;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Objects;
/*non-public*/ class VectorIntrinsics {
static final int VECTOR_ACCESS_OOB_CHECK = Integer.getInteger("jdk.incubator.vector.VECTOR_ACCESS_OOB_CHECK", 2);
@SuppressWarnings("removal")
static final int VECTOR_ACCESS_OOB_CHECK = AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
Integer.getInteger("jdk.incubator.vector.VECTOR_ACCESS_OOB_CHECK", 2));
@ForceInline
static void requireLength(int haveLength, int length) {