The popularity of the Java programming language has led to its wide adoption in cloud computing infrastructures. However, Java applications running in untrusted clouds are vulnerable to various forms of privileged attacks. The emergence of trusted execution environments (TEEs) such as Intel SGX mitigates this problem. TEEs protect code and data in secure enclaves inaccessible to untrusted software, including the kernel and hypervisors. To efficiently use TEEs, developers must manually partition their applications into trusted and untrusted parts, in order to reduce the size of the trusted computing base (TCB) and minimise the risks of security vulnerabilities. However, partitioning applications poses two important challenges: (i) ensuring efficient object communication between the partitioned components, and (ii) ensuring the consistency of garbage collection between the parts, especially with memory-managed languages such as Java. We present Montsalvat, a tool which provides a practical and intuitive annotation-based partitioning approach for Java applications destined for secure enclaves. Montsalvat provides an RMI-like mechanism to ensure inter-object communication, as well as consistent garbage collection across the partitioned components. We implement Montsalvat with GraalVM native-image, a tool for compiling Java applications ahead-of-time into standalone native executables that do not require a JVM at runtime. Our extensive evaluation with micro- and macro-benchmarks shows our partitioning approach to boost performance in real-world applications
academic
Montsalvat: Partitioning Java Applications to Minimize the TCB in Intel SGX
The popularity of the Java programming language has led to its widespread adoption in cloud computing infrastructure. However, Java applications running in untrusted cloud environments are vulnerable to various privileged attacks. The emergence of Trusted Execution Environments (TEEs) such as Intel SGX mitigates this issue. TEEs protect code and data within secure enclaves from access by untrusted software, including kernels and hypervisors. To efficiently utilize TEEs, developers must manually partition applications into trusted and untrusted components to reduce the size of the Trusted Computing Base (TCB) and minimize security vulnerability risks. This paper presents Montsalvat, a practical and intuitive annotation-based partitioning approach for Java applications targeting secure enclaves. Montsalvat provides RMI-like mechanisms to ensure inter-object communication and consistent garbage collection across partitioned components.
Security Threats: Java applications in untrusted cloud environments face threats from privileged attacks, including kernel-level and hypervisor-level attacks
TCB Minimization Requirements: When using TEEs such as Intel SGX, it is necessary to minimize the Trusted Computing Base to reduce the attack surface
Partitioning Complexity: Manual partitioning of Java applications requires handling complex issues such as inter-object communication and garbage collection consistency
Complete Application Approaches: SCONE, Graphene-SGX, and others place entire applications (including the JVM) within enclaves, resulting in large TCBs (millions of lines of code)
Framework-Specific Solutions: VC3, SecureKeeper, and others target only specific frameworks, lacking generality
Existing Java Partitioning Approaches:
Civet requires a complete LibOS, resulting in a still-large TCB
Annotation-Based Partitioning Method: Proposes a practical and intuitive class-level annotation approach (@Trusted, @Untrusted, @Neutral) for partitioning Java applications
RMI Mechanism: Designs an RMI-like cross-enclave object communication mechanism that implements transparent remote method invocation through proxy objects
Distributed Garbage Collection: Implements a GC extension based on weak references to ensure object destruction consistency between trusted and untrusted heaps
GraalVM Integration: Deep integration with GraalVM native-image, leveraging AOT compilation for performance optimization
Performance Improvements: Achieves significant performance gains in real applications (PalDB 6.6×, GraphChi 2.2×)
Uses the Javassist framework for bytecode transformation:
Proxy Class Generation:
Generates proxy classes for each trusted class in the untrusted runtime
Generates proxy classes for each untrusted class in the trusted runtime
Proxy classes retain original method signatures but replace method bodies with cross-enclave calls
Relay Method Injection:
// Original method transformed into relay method
@CEntryPoint
public static void relayAccount(Isolate ctx, int hash,
CCharPointer buf, int b) {
String s = deserialize(buf);
Account mirror = new Account(s, b);
mirrorProxyRegistry.add(hash, mirror);
}
Object Mapping Mechanism:
Each proxy object is assigned a unique hash value
Maintains proxy-mirror object registries
Implements cross-enclave object references through hash values
// GC synchronization based on weak references
WeakReference<ProxyObject> weakRef = new WeakReference<>(proxy);
proxyWeakRefs.add(new ProxyWeakRefEntry(weakRef, proxy.getHash()));
// GC Helper periodically checks
if (weakRef.get() == null) {
// Proxy object has been garbage collected, notify other side to destroy mirror object
notifyMirrorDestruction(hash);
}
The paper cites 60 related references covering multiple domains including SGX technology, TEE applications, Java security, and compilation optimization, providing a solid theoretical foundation for this research.
Overall Assessment: This is a high-quality systems research paper that addresses practical deployment challenges of Java applications in TEE environments. The methodology is well-designed, the implementation is complete, and the experiments are comprehensive, demonstrating good academic value and practical significance. Although there remains room for improvement in RMI overhead and applicability, it provides important reference for related research.