You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/security/polyglot-sandbox.md
+28-4Lines changed: 28 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ redirect_from:
10
10
11
11
# Sandboxing
12
12
13
-
GraalVM allows a host application written in a JVM-based language to execute guest code written in Javascript via the [Polyglot API](../reference-manual/embedding/embed-languages.md).
13
+
GraalVM allows a host application written in a JVM-based language to execute guest code written in Javascript or WebAssembly via the [Polyglot API](../reference-manual/embedding/embed-languages.md).
14
14
Configured with a [sandbox policy](#sandbox-policies), a security boundary between a host application and guest code can be established.
15
15
For example, host code can execute untrusted guest code using the [UNTRUSTED](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/SandboxPolicy.html#UNTRUSTED) policy.
16
16
Host code can also execute multiple mutually distrusting instances of guest code that will be protected from one another.
@@ -478,12 +478,36 @@ In the case of a misprediction, the result of these instructions is discarded.
478
478
However, the execution may have caused side effects in the micro-architectural state of a CPU.
479
479
For example, data may have been pulled into the cache during transient execution - a side-channel that can be read by timing data access.
480
480
481
-
GraalVM protects against Spectre attacks by inserting speculative execution barrier instructions in runtime compiled guest code to prevent attackers from crafting speculative execution gadgets.
482
-
A speculative execution barrier is placed at each target of a conditional branch that is relevant to Java memory safety to stop speculative execution.
481
+
GraalVM protects against Spectre attacks by applying masking to memory accesses in runtime compiled code.
482
+
Since the masking operation is also effective during speculative execution, accesses protected by masks are always scoped to the isolate heap.
483
+
For memory accesses where masking is not applicable, GraalVM inserts speculative execution barrier instructions to prevent attackers from crafting speculative execution gadgets.
484
+
On AArch64 protection relies solely on speculative execution barrier instructions.
485
+
486
+
### Process Isolation
487
+
488
+
As an experimental feature, the dedicated native-image isolate that runs the Polyglot engine in the ISOLATED and UNTRUSTED policy can run in a separate process.
489
+
The feature is enabled by setting `engine.IsolateMode=external`, experimental options have to be allowed:
Executing guest code in a separate process further deepens the isolation between the host application and guest code by providing a separate address space and signal domain.
504
+
This means that defenses against leaking sensitive data from the same address space are no longer necessary and fatal crashes of the native-image isolate no longer affect the host application.
505
+
These properties come at the expense of slower startup performance of a corresponding Polyglot engine as well as an increased communication overhead between host and guest code.
506
+
Under the hood, host and guest processes communicate via Unix Domain sockets, transparently hidden behind the Polyglot API.
483
507
484
508
## Sharing Execution Engines
485
509
486
-
Guest code of different trust domains has to be separated at the polyglot engine level, that is, only guest code of the same trust domain should share an engine.
510
+
Guest code of different trust domains has to be separated at the Polyglot engine level, that is, only guest code of the same trust domain should share an engine.
487
511
When multiple context share an engine, all of them must have the same sandbox policy (the engine's sandbox policy).
488
512
Application developers may choose to share execution engines among execution contexts for performance reasons.
489
513
While the context holds the state of the executed code, the engine holds the code itself.
0 commit comments