hyperlight-dev / hyperlight-dev/hyperlight
Improve guest exception handling to prevent infinite loops
- Lenguaje dominante
- Rust
- Estrellas
- 4.7k
- Forks
- 208
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 48
Descripción
When the guest exception handler itself fails (due to corrupted stack, unmapped memory etc.), the guest enters an unrecoverable state— causing either an infinite page fault loop (hang) or a triple fault (crash). This occurs because:
1. The exception handler entry point requires a working stack (for context_save!() pushes)
2. The Rust handler uses format!() which allocates on the heap
3. There's no detection of nested/recursive exceptions
A triple fault is not a terrible outcome as at least the guest terminates but having the infinite page loop is more of a problem, if the host is monitoring execution and kills the guest via the `InterruptHandle` then it should be able to successfully terminate the guest , but if it is not doing this then a badly behaved guest could cause resource (CPU) starvation.
There are a couple of things that we can do to protect against this:
Configure a small permanent fixed stack in the ISS that can be used for a double fault handler.
Detect exception handler re-entrancy and exit immediately with outb data that the host can translate to a `DoubleFault` error.
This is another reason that we should consider not allowing guest code to run in ring 0.
Guía de contribución
Línea de trabajo
Start by tracing the guest exception handler entry point, context_save!() stack use, the Rust handler's format!() allocation, and the InterruptHandle termination path. Define how a fixed double-fault stack and re-entrancy detection should report failure to the host, then verify that nested faults terminate instead of looping.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust
- Área
- operating-systems
- Tipo de issue
- Error
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100