x64: Fix nested exception support

Operating Systems / OSv - Nadav Har'El [cloudius-systems.com] - 5 March 2014 01:34 UTC

Commit 89464d6a037dd06ac5ca37f0c70a65786193866a added support for nested exceptions. One of the reason these are needed are when using tracepoints keeping backtraces using backtrace_safe(). If the tracepoint happens while handling an exception, the call to backtrace_safe() might itself cause an exception, and while handling *that* nested exception on the per-cpu nested exception stack, we need a second nested exception stack (that second stack will only ever be used to print a "nested too deep" error).

However, the existing code had an off-by-one error in its test, and actually aborted on the nested exception, when exception_depth=1, rather than setting the exception stack to precpu_exception_stack[1] as it should, and only aborting when exception_depth reaches 2.

So despite the aforementioned commit, we did not actually support nested exceptions. Turning on malloc tracing with backtraces, with the kernel arguments "--trace=memory_malloc --trace-backtrace", quickly resulted in an abort. With this patch, that tracing no longer aborts.

c979213 x64: Fix nested exception support
arch/x64/arch-cpu.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Upstream: github.com


  • Share