Package org.elasticsearch.nativeaccess
Class LinuxNativeAccess
java.lang.Object
org.elasticsearch.nativeaccess.PosixNativeAccess
org.elasticsearch.nativeaccess.LinuxNativeAccess
- All Implemented Interfaces:
NativeAccess
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.nativeaccess.NativeAccess
NativeAccess.ExecSandboxState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NativeAccess.ExecSandboxStateprotected booleanprotected static final LoggerFields inherited from class org.elasticsearch.nativeaccess.PosixNativeAccess
constants, libc, processLimits, vectorDistance -
Method Summary
Modifier and TypeMethodDescriptionReturn whether installing the exec system call filters was successful, and to what degree.protected longReturn the maximum number of threads this process may start, orProcessLimits.UNKNOWN.getZstd()Returns an accessor to zstd compression functions.booleanReturn whether locking memory was successful, or false otherwise.protected voidprotected booleannativePreallocate(int fd, long currentSize, long newSize) newConfinedBuffer(int len) Creates a newCloseableByteBufferusing a confined arena.newSharedBuffer(int len) Creates a newCloseableByteBufferusing a shared arena.systemd()voidInstalls exec system call filtering for Linux.Methods inherited from class org.elasticsearch.nativeaccess.PosixNativeAccess
allocatedSizeInBytes, definitelyRunningAsRoot, getProcessLimits, getRLimit, getVectorSimilarityFunctions, tryLockMemory, tryPreallocate
-
Field Details
-
logger
-
isMemoryLocked
protected boolean isMemoryLocked -
execSandboxState
-
-
Method Details
-
getMaxThreads
protected long getMaxThreads()Description copied from class:PosixNativeAccessReturn the maximum number of threads this process may start, orProcessLimits.UNKNOWN.- Specified by:
getMaxThreadsin classPosixNativeAccess
-
systemd
- Specified by:
systemdin interfaceNativeAccess
-
logMemoryLimitInstructions
protected void logMemoryLimitInstructions()- Specified by:
logMemoryLimitInstructionsin classPosixNativeAccess
-
nativePreallocate
protected boolean nativePreallocate(int fd, long currentSize, long newSize) - Specified by:
nativePreallocatein classPosixNativeAccess
-
tryInstallExecSandbox
public void tryInstallExecSandbox()Installs exec system call filtering for Linux.On Linux exec system call filtering currently supports amd64 and aarch64 architectures. It requires Linux kernel 3.5 or above, and
CONFIG_SECCOMPandCONFIG_SECCOMP_FILTERcompiled into the kernel.On Linux BPF Filters are installed using either
seccomp(2)(3.17+) orprctl(2)(3.5+).seccomp(2)is preferred, as it allows filters to be applied to any existing threads in the process, and one motivation here is to protect against bugs in the JVM. Otherwise, code will fall back to theprctl(2)method which will at least protect elasticsearch application threads.Linux BPF filters will return
EACCES(Access Denied) for the following system calls:execveforkvforkexecveat
- See Also:
-
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
-