Package org.elasticsearch.nativeaccess
Class WindowsNativeAccess
java.lang.Object
org.elasticsearch.nativeaccess.WindowsNativeAccess
- All Implemented Interfaces:
NativeAccess
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceWindows callback for console eventsNested classes/interfaces inherited from interface org.elasticsearch.nativeaccess.NativeAccess
NativeAccess.ExecSandboxState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NativeAccess.ExecSandboxStateprotected booleanprotected static final Logger -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a Console Ctrl Handler for Windows.allocatedSizeInBytes(Path path) Retrieves the actual number of bytes of disk storage used to store a specified file.booleanDetermine whether this JVM is running as the root user.Return whether installing the exec system call filters was successful, and to what degree.Return limits for the current process.getShortPathName(String path) Retrieves the short path form of the specified path.getZstd()Returns an accessor to zstd compression functions.booleanReturn whether locking memory was successful, or false otherwise.newConfinedBuffer(int len) Creates a newCloseableByteBufferusing a confined arena.newSharedBuffer(int len) Creates a newCloseableByteBufferusing a shared arena.systemd()voidInstall exec system call filtering on Windows.voidAttempt to lock this process's virtual memory address space into physical RAM.voidtryPreallocate(Path file, long size)
-
Field Details
-
logger
-
isMemoryLocked
protected boolean isMemoryLocked -
execSandboxState
-
-
Method Details
-
getShortPathName
Retrieves the short path form of the specified path.- Parameters:
path- the path- Returns:
- the short path name, or the original path name if unsupported or unavailable
-
addConsoleCtrlHandler
Adds a Console Ctrl Handler for Windows. On non-windows this is a noop.- Returns:
- true if the handler is correctly set
-
definitelyRunningAsRoot
public boolean definitelyRunningAsRoot()Description copied from interface:NativeAccessDetermine whether this JVM is running as the root user.- Returns:
- true if running as root, or false if unsure
-
tryLockMemory
public void tryLockMemory()Description copied from interface:NativeAccessAttempt to lock this process's virtual memory address space into physical RAM. -
tryInstallExecSandbox
public void tryInstallExecSandbox()Install exec system call filtering on Windows.Process creation is restricted with
SetInformationJobObject/ActiveProcessLimit.Note: This is not intended as a real sandbox. It is another level of security, mostly intended to annoy security researchers and make their lives more difficult in achieving "remote execution" exploits.
-
allocatedSizeInBytes
Description copied from interface:NativeAccessRetrieves the actual number of bytes of disk storage used to store a specified file.- Parameters:
path- the path to the file- Returns:
- an
OptionalLongthat contains the number of allocated bytes on disk for the file, or empty if the size is invalid
-
tryPreallocate
-
getProcessLimits
Description copied from interface:NativeAccessReturn limits for the current process. -
getVectorSimilarityFunctions
-
systemd
- Specified by:
systemdin interfaceNativeAccess
-
getZstd
Description copied from interface:NativeAccessReturns an accessor to zstd compression functions.- Specified by:
getZstdin interfaceNativeAccess- Returns:
- an object used to compress and decompress bytes using zstd
-
newConfinedBuffer
Description copied from interface:NativeAccessCreates a newCloseableByteBufferusing a confined arena. The buffer must be used within the same thread that it is created.- Specified by:
newConfinedBufferin interfaceNativeAccess- Parameters:
len- the number of bytes the buffer should allocate- Returns:
- the buffer
-
isMemoryLocked
public boolean isMemoryLocked()Description copied from interface:NativeAccessReturn whether locking memory was successful, or false otherwise.- Specified by:
isMemoryLockedin interfaceNativeAccess
-
getExecSandboxState
Description copied from interface:NativeAccessReturn whether installing the exec system call filters was successful, and to what degree.- Specified by:
getExecSandboxStatein interfaceNativeAccess
-