Tom Spink BEng (Hons), PhD, FBCS
← All publications

Publication

Propagating C++ exceptions across the user/kernel boundary

Abstract

Exception handling is an important and useful feature of modern programming languages, ensuring robustness and error resilience in software systems. In user-space programming, exceptions raised by application code are easily propagated and caught within the same execution context. However, when an exception originates from the Operating System (OS) kernel, such as during a system call, or a memory access violation, the ability to catch and handle these exceptions in user code becomes significantly more challenging.

This paper introduces a novel technique for passing C++ exceptions across the user-space/kernel-space boundary, enabling the seamless propagation and subsequent catching of exceptions raised by the OS kernel in user code.

Our proposed method requires a specific Application Binary Interface (ABI) to be implemented by both the user-space application, and the OS kernel, but this is not unreasonable as user applications typically conform to a specific OS ABI anyway, which are often abstracted by the standard libraries.

We have developed a proof-of-concept implementation of our approach in a research operating system, and conducted experiments to evaluate its effectiveness and performance. The results demonstrate that our method successfully enables the capture and handling of exceptions raised by the OS kernel in user code, and provides a richer mechanism for propagating kernel error information.