diff options
| author | Florian Weimer <fweimer@redhat.com> | 2024-05-31 12:26:43 +0200 |
|---|---|---|
| committer | Florian Weimer <fweimer@redhat.com> | 2024-05-31 22:49:18 +0200 |
| commit | c5f7f4fc8bb857cbe07972ff1e29970b101e9995 (patch) | |
| tree | 3ee7b5b3127b3be0bf34b291dd0537f207b5d679 /debug | |
| parent | 90ee0d87302810f1670a1fbcf9455b883309b1de (diff) | |
| download | glibc-fw/x86-shstk-backtrace.tar.xz glibc-fw/x86-shstk-backtrace.zip | |
x86_64: Use shadow stack for backtrace implementationfw/x86-shstk-backtrace
Test failures:
FAIL: debug/tst-backtrace4
FAIL: misc/tst-sigcontext-get_pc
The return address of signal handlers is not on the shadow stack.
Diffstat (limited to 'debug')
| -rw-r--r-- | debug/backtrace.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/debug/backtrace.c b/debug/backtrace.c index 969d699bd1..2ed0112cb8 100644 --- a/debug/backtrace.c +++ b/debug/backtrace.c @@ -20,6 +20,7 @@ #include <stdlib.h> #include <unwind.h> #include <unwind-link.h> +#include <arch_backtrace.h> struct trace_arg { @@ -63,6 +64,16 @@ backtrace_helper (struct _Unwind_Context *ctx, void *a) int __backtrace (void **array, int size) { + if (size <= 0) + return 0; + + /* Try the architecture-specific implementation first. */ + { + int result = __arch_backtrace (array, size); + if (result >= 0) + return result; + } + struct trace_arg arg = { .array = array, @@ -72,7 +83,7 @@ __backtrace (void **array, int size) .cnt = -1 }; - if (size <= 0 || arg.unwind_link == NULL) + if (arg.unwind_link == NULL) return 0; UNWIND_LINK_PTR (arg.unwind_link, _Unwind_Backtrace) |
