Speaker
Description
The Livepatch consistency model 1 requires the kernel to provide reliable stacktrace in order to be fully supported. On x86, the ORC unwinder provides these reliable stacktraces. However, arm64 misses the required support from objtool: it cannot generate ORC unwind tables for arm64. Prior RFCs have proposed to add this support to objtool, but feedback from the upstream community has indicated that a solution using data produced directly from the compiler would be preferred 2, 3.
In the v6.17 release, the Arm64 kernel gained livepatch support, but without fully reliable stacktrace 4. With this partial solution, interrupt stacks cannot be reliably traced because the unwinder cannot tell if the Link Register was current at the time the exception was taken.
SFrame provides a generalized, compiler-based solution, inspired by the ORC unwinder 5, 6. Currently, there's already an SFrame unwinder proposed for userspace: 7.
We would like to propose similar functionality to provide reliable stacktraces within the Arm64 kernel: 8. This patch series adds to and depends upon the exising userspace patches by factoring out a common SFrame-lookup library which supports both kernel and userspace SFrame sections. Previous versions of this series implemented an SFrame-only kernel unwinder to replace frame-pointer unwinding entirely. However, after receiving feedback, the kernel unwinder now relies on SFrame only when unwinding across an exception boundary, and uses frame pointers everywhere else. This combined strategy enables the best of both worlds: the superior performance of frame-pointer unwinding is kept whenever possible, while the SFrame table allows for fully reliable unwind of a stack with interrupts.
Ongoing mailing list discussion draws into question SFrame's viability as a userspace unwinding solution 9. This raises several questions around the in-kernel approach, which we would like to bring forward for discussion:
-
What is the current pathway for support for SFrame generation within the LLVM toolchain?
-
The kernel unwind patches continue to have a dependency on the userspace patches. From a development velocity perspective, does this dependency make sense to keep in future versions?
-
For the purpose of unwinding across interrupt boundaries, are there alternatives to SFrame that should be considered?