Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 369 by [email protected]: asan should handle SIGBUS on Linux
https://code.google.com/p/address-sanitizer/issues/detail?id=369

On Linux, some stack overflows generate SIGBUS instead of SIGSEGV. Asan should handle SIGBUS so that it can report these stack overflows properly.

Here's a test case:

$ cat bus.c
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>

void foo()
{
        foo();
}

int main()
{
        const long pagesize = sysconf(_SC_PAGESIZE);
        FILE *f = fopen("/proc/self/maps", "r");
        char a[1000];
        while (fgets(a, sizeof a, f))
        {
                if (strstr(a, "[stack]"))
                {
                        unsigned long addr;
                        if (sscanf(a, "%lx", &addr) == 1)
mmap((void *)(addr - 4 * pagesize), pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
                }
        }
        foo();
        return 0;
}

$ clang -o bus bus.c -fsanitize=address && ulimit -Ss 8192 && ./bus
Bus error (core dumped)

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to