This does not happen for me:
% cat z.c
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
struct sigaction sa;
memset(&sa, 0, sizeof(sigaction));
sigemptyset(&sa.sa_mask);
// sa.sa_flags = SA_SIGINFO;
// sigaction(SIGSEGV, &sa, NULL);
return 0;
}
% clang z.c -fsanitize=address && ./a.out
%
Please provide more info. How do you compile? (make sure to add -g)
run this under gdb and show what 'bt' says.
--kcc
On Thu, Jan 16, 2014 at 7:14 AM, laser <[email protected]> wrote:
> Hi experts,
>
> asan report segment fault error for memset line in the simple code below,
> valgrind doesn't report it, could you explain the reason?
>
>
> 1 #include <signal.h>
> 2 #include <stdio.h>
> 3 #include <stdlib.h>
> 4 #include <string.h>
> 5
> 6
> 7 int main(void)
> 8 {
> 9 struct sigaction sa;
> 10
> 11 memset(&sa, 0, sizeof(sigaction));
> 12 sigemptyset(&sa.sa_mask);
> 13 // sa.sa_flags = SA_SIGINFO;
> 14
> 15 // sigaction(SIGSEGV, &sa, NULL);
> 16
> 17 return 0;
> 18 }
>
>
>
>
>
> root@terry-lx:/tmp# ./segerror1
>
> ASAN:SIGSEGV
>
> =================================================================
>
> ==26565== ERROR: AddressSanitizer: SEGV on unknown address 0x17f91a12 (pc
> 0x0804868b sp 0xbfc8d060 bp 0xbfc8d158 T0)
>
> AddressSanitizer can not provide additional info.
>
> #0 0x804868a (/tmp/segerror1+0x804868a)
>
> #1 0xb5fda4d2 (/lib/i386-linux-gnu/libc-2.15.so+0x194d2)
>
> #2 0x8048510 (/tmp/segerror1+0x8048510)
>
> ==26565== ABORTING
>
> root@test-lx:/tmp# ./segerror1 2>&1 | ./asan_symbolize.py | c++filt
>
> /tmp/llvm-3.4/llvm/Release+Asserts/bin/llvm-symbolizer
> --use-symbol-table=true --demangle=False --functions=true --inlining=true
>
> ASAN:SIGSEGV
>
> =================================================================
>
> ==26566== ERROR: AddressSanitizer: SEGV on unknown address 0x17ff0c3a (pc
> 0x0804868b sp 0xbff861a0 bp 0xbff86298 T0)
>
> AddressSanitizer can not provide additional info.
>
> #0 0x804868a (/tmp/segerror1+0x804868a)
>
>
> /tmp/segerror1 0x804868a
>
> #0 0x804868a in main /tmp/./segerror1.c:11:0
>
> #1 0xb60184d2 (/lib/i386-linux-gnu/libc-2.15.so+0x194d2)
>
>
> /lib/i386-linux-gnu/libc-2.15.so 0x194d2
>
> addr2line -f -e /lib/i386-linux-gnu/libc-2.15.so
>
> /lib/i386-linux-gnu/libc-2.15.so 0x194d2
>
> #1 0xb60184d2 in __libc_start_main
> /build/buildd/eglibc-2.15/csu/libc-start.c:226
>
> #2 0x8048510 (/tmp/segerror1+0x8048510)
>
>
> /tmp/segerror1 0x8048510
>
> addr2line -f -e /tmp/segerror1
>
> /tmp/segerror1 0x8048510
>
> #2 0x8048510 in _start ??:0
>
> ==26566== ABORTING
>
>
> --
> 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/groups/opt_out.
--
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/groups/opt_out.