Discussion:
can't start when built with gcc 4.8.3 address sanitizer
Konstantin Svist
2014-07-29 22:56:29 UTC
Permalink
I have some suspicion there's memory errors when running luajit from
redis, so I was trying to get it running under GCC's address sanitizer.

Tried on 2.0.3 and on git:

export CFLAGS='-fsanitize=address -fno-omit-frame-pointer'
export LIBS='-lasan'
make
make install

Starting up the cli binary results in:

=================================================================
==24904== ERROR: AddressSanitizer: global-buffer-overflow on address
0x000000539a64 at pc 0x40b0bf bp 0x7fff7c498a70 sp 0x7fff7c498a68
READ of size 4 at 0x000000539a64 thread T0
#0 0x40b0be (/usr/local/bin/luajit-2.1.0-alpha+0x40b0be)
#1 0x4fe886 (/usr/local/bin/luajit-2.1.0-alpha+0x4fe886)
#2 0x45be83 (/usr/local/bin/luajit-2.1.0-alpha+0x45be83)
#3 0x45a4d3 (/usr/local/bin/luajit-2.1.0-alpha+0x45a4d3)
#4 0x406b09 (/usr/local/bin/luajit-2.1.0-alpha+0x406b09)
#5 0x45be83 (/usr/local/bin/luajit-2.1.0-alpha+0x45be83)
#6 0x422ff9 (/usr/local/bin/luajit-2.1.0-alpha+0x422ff9)
#7 0x4053d7 (/usr/local/bin/luajit-2.1.0-alpha+0x4053d7)
#8 0x3b36621b44 (/usr/lib64/libc-2.17.so+0x21b44)
#9 0x405b04 (/usr/local/bin/luajit-2.1.0-alpha+0x405b04)
0x000000539a67 is located 0 bytes to the right of global variable
'*.LC16 (lib_base.c)' (0x539a60) of size 7
'*.LC16 (lib_base.c)' is ascii string '__mode'
0x000000539a64 is located 60 bytes to the left of global variable
'*.LC17 (lib_base.c)' (0x539aa0) of size 10
'*.LC17 (lib_base.c)' is ascii string 'coroutine'
Shadow bytes around the buggy address:
0x00008009f2f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 f9
0x00008009f300: f9 f9 f9 f9 00 00 00 02 f9 f9 f9 f9 00 f9 f9 f9
0x00008009f310: f9 f9 f9 f9 00 02 f9 f9 f9 f9 f9 f9 05 f9 f9 f9
0x00008009f320: f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9
0x00008009f330: f9 f9 f9 f9 03 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9
=>0x00008009f340: f9 f9 f9 f9 03 f9 f9 f9 f9 f9 f9 f9[07]f9 f9 f9
0x00008009f350: f9 f9 f9 f9 00 02 f9 f9 f9 f9 f9 f9 00 00 00 00
0x00008009f360: 00 05 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 f9 f9
0x00008009f370: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
0x00008009f380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00008009f390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap righ redzone: fb
Freed Heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
==24904== ABORTING
Mike Pall
2014-07-29 23:04:50 UTC
Permalink
Post by Konstantin Svist
I have some suspicion there's memory errors when running luajit from
redis, so I was trying to get it running under GCC's address sanitizer.
Well, it doesn't make sense to do that without enabling debug
symbols.

But I guess it's just tripping on the same false positives that
Valgrind does, see src/lj.supp. The optimized string compare
accesses memory beyond the end of strings, which is ok if they are
not at a page border.

--Mike

Loading...