Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 27 Aug 2015 11:55:24 -0700
From: Andy Lutomirski <>
To: "" <>
Subject: _Unwind_Backtrace crashes

This works on glibc.  It aborts on musl on i386 using the latest git version.

I suspect it's because whatever calls main isn't properly annotated,
but I don't know how to debug this without rebuilding gcc, which is
kind of a mess.

#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unwind.h>
#include <err.h>
#include <string.h>

static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *),
               int flags)
    struct sigaction sa;
    memset(&sa, 0, sizeof(sa));
    sa.sa_sigaction = handler;
    sa.sa_flags = SA_SIGINFO | flags;
    if (sigaction(sig, &sa, 0))
        err(1, "sigaction");

_Unwind_Reason_Code trace_fn(struct _Unwind_Context * ctx, void *opaque)
    return _URC_NO_REASON;

static void sigusr1(int sig, siginfo_t *info, void *ctx_void)
    printf("In signal handler.  Trying to unwind.\n");
    _Unwind_Backtrace(trace_fn, 0);

int main()
    printf("Unwind directly\n");
    _Unwind_Backtrace(trace_fn, 0);

    printf("Unwind from signal handler\n");
    sethandler(SIGUSR1, sigusr1, 0);


Andy Lutomirski
AMA Capital Management, LLC

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.