Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LAsort: segfault with automatic de-dup'ing #92

Open
a-ludi opened this issue May 22, 2020 · 2 comments
Open

LAsort: segfault with automatic de-dup'ing #92

a-ludi opened this issue May 22, 2020 · 2 comments

Comments

@a-ludi
Copy link

a-ludi commented May 22, 2020

The changes from 477d5b9 introduced a serious bug into LAsort that causes a segfault. The code crashes in LAsort.c:377.

When compiling with -fsanitize=address -fsanitize=undefined the sanitizer reports many misaligned accesses and then crashes for some reason. Maybe it is of help anyway:

$ LAsort -v assembly-reference.reads-real-pb.97.las
  assembly-reference.reads-real-pb.97: 175,058 records 6,712,342 trace bytes
LAsort.c:326:25: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:328:70: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:42:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:47:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:52:8: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:57:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:41:6: runtime error: member access within misaligned address 0x7f6c1793b86c for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b86c: note: pointer points here
  0f 64 0e 60 10 65 16 6b  0f 62 04 43 0c 00 00 00  3f 00 00 00 dc 8c 00 00  6b 16 00 00 f8 8e 00 00
              ^ 
LAsort.c:46:6: runtime error: member access within misaligned address 0x7f6c1793b86c for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b86c: note: pointer points here
  0f 64 0e 60 10 65 16 6b  0f 62 04 43 0c 00 00 00  3f 00 00 00 dc 8c 00 00  6b 16 00 00 f8 8e 00 00
              ^ 
LAsort.c:51:8: runtime error: member access within misaligned address 0x7f6c1793b86c for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b86c: note: pointer points here
  0f 64 0e 60 10 65 16 6b  0f 62 04 43 0c 00 00 00  3f 00 00 00 dc 8c 00 00  6b 16 00 00 f8 8e 00 00
              ^ 
LAsort.c:56:6: runtime error: member access within misaligned address 0x7f6c1793b86c for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b86c: note: pointer points here
  0f 64 0e 60 10 65 16 6b  0f 62 04 43 0c 00 00 00  3f 00 00 00 dc 8c 00 00  6b 16 00 00 f8 8e 00 00
              ^ 
LAsort.c:62:6: runtime error: member access within misaligned address 0x7f6c1793feb4 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793feb4: note: pointer points here
  09 e7 12 00 00 00 00 00  22 67 0a 32 02 00 00 00  0b 00 00 00 00 00 00 00  36 15 00 00 4b 00 00 00
              ^ 
LAsort.c:61:6: runtime error: member access within misaligned address 0x7f6c17943ed2 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c17943ed2: note: pointer points here
 19 59  0e 5c 16 53 16 59 11 57  00 0f 0e 00 00 00 79 00  00 00 00 00 00 00 ed 06  00 00 74 02 00 00
              ^ 
LAsort.c:66:6: runtime error: member access within misaligned address 0x7f6c17a08d1c for type 'struct Overlap', which requires 8 byte alignment
0x7f6c17a08d1c: note: pointer points here
  b0 fb 12 00 ba 7f 00 00  00 07 16 37 04 00 00 00  15 00 00 00 5a 09 00 00  0a 3a 00 00 a4 09 00 00
              ^ 
LAsort.c:67:6: runtime error: member access within misaligned address 0x7f6c17a08df6 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c17a08df6: note: pointer points here
 00 00 b0 fb 12 00  ba 7f 00 00 13 47 02 00  00 00 14 00 00 00 53 18  00 00 e0 29 00 00 92 18  00 00
             ^ 
LAsort.c:383:37: runtime error: member access within misaligned address 0x7f6c1793b9c2 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b9c2: note: pointer points here
 07 64  14 66 0a 65 0a 66 10 6e  07 58 10 00 00 00 3f 00  00 00 57 11 01 00 00 00  00 00 ea 13 01 00
              ^ 
LAsort.c:156:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:161:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:166:8: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:171:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:365:36: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:157:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:162:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:167:8: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:172:6: runtime error: member access within misaligned address 0x7f6c1793b836 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793b836: note: pointer points here
 0f 68 0f 68 0f 64  0d 62 0c 5f 09 5f 0e 00  00 00 58 00 00 00 90 8c  00 00 70 0c 00 00 d8 8e  00 00
             ^ 
LAsort.c:177:6: runtime error: member access within misaligned address 0x7f6c1793feb4 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c1793feb4: note: pointer points here
  09 e7 12 00 00 00 00 00  22 67 0a 32 02 00 00 00  0b 00 00 00 00 00 00 00  36 15 00 00 4b 00 00 00
              ^ 
LAsort.c:176:6: runtime error: member access within misaligned address 0x7f6c17943ed2 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c17943ed2: note: pointer points here
 19 59  0e 5c 16 53 16 59 11 57  00 0f 0e 00 00 00 79 00  00 00 00 00 00 00 ed 06  00 00 74 02 00 00
              ^ 
LAsort.c:181:6: runtime error: member access within misaligned address 0x7f6c17a08cc4 for type 'struct Overlap', which requires 8 byte alignment
0x7f6c17a08cc4: note: pointer points here
  b0 fb 12 00 ba 7f 00 00  00 08 1a 3c 04 00 00 00  16 00 00 00 58 09 00 00  fa 36 00 00 a4 09 00 00
              ^ 
LAsort.c:182:6: runtime error: member access within misaligned address 0x7f6c17a08dcc for type 'struct Overlap', which requires 8 byte alignment
0x7f6c17a08dcc: note: pointer points here
  b0 fb 12 00 ba 7f 00 00  00 14 28 54 02 00 00 00  13 00 00 00 53 18 00 00  e5 1b 00 00 92 18 00 00
              ^ 
LAsort.c:186:6: runtime error: member access within misaligned address 0x7f6c18442b6a for type 'struct Overlap', which requires 8 byte alignment
0x7f6c18442b6a: note: pointer points here
 84 fe  12 00 00 00 00 00 07 33  01 17 04 00 00 00 08 00  00 00 29 09 00 00 7f 20  00 00 78 09 00 00
              ^ 
LAsort.c:187:6: runtime error: member access within misaligned address 0x7f6c18442b3e for type 'struct Overlap', which requires 8 byte alignment
0x7f6c18442b3e: note: pointer points here
 13 00 00 00 00 00  09 3a 18 60 00 0e 04 00  00 00 08 00 00 00 29 09  00 00 7f 20 00 00 78 09  00 00
            ^ 
=================================================================
==73018==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f6c1864fcee at pc 0x7f6c586681e3 bp 0x7ffd28e713a0 sp 0x7ffd28e70b50
READ of size 1762486797 at 0x7f6c1864fcee thread T0
    #0 0x7f6c586681e2 in __interceptor_memmove /sw/tgz/gcc/gcc-6.2.0/libsanitizer/asan/asan_interceptors.cc:429
    #1 0x4054b8 in main /source/daligner/LAsort.c:377
    #2 0x7f6c5724bc04 in __libc_start_main (/lib64/libc.so.6+0x21c04)
    #3 0x401fe8  (/lustre/projects/project_ludwig_pb_gaps/apps/daligner/2.0.20200322+commit-477d5b9/LAsort+0x401fe8)
  
0x7f6c1864fcee is located 0 bytes to the right of 13714670-byte region [0x7f6c1793b800,0x7f6c1864fcee)
allocated by thread T0 here:
    #0 0x7f6c586c7c68 in __interceptor_malloc /sw/tgz/gcc/gcc-6.2.0/libsanitizer/asan/asan_malloc_linux.cc:62
    #1 0x405a14 in Malloc /source/daligner/DB.c:67
    #2 0x4048be in main /source/daligner/LAsort.c:293
    #3 0x7f6c5724bc04 in __libc_start_main (/lib64/libc.so.6+0x21c04)
  
SUMMARY: AddressSanitizer: heap-buffer-overflow /sw/tgz/gcc/gcc-6.2.0/libsanitizer/asan/asan_interceptors.cc:429 in __interceptor_memmove
Shadow bytes around the buggy address:
  0x0fee030c1f40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fee030c1f50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fee030c1f60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fee030c1f70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fee030c1f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fee030c1f90: 00 00 00 00 00 00 00 00 00 00 00 00 00[06]fa fa
  0x0fee030c1fa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fee030c1fb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fee030c1fc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fee030c1fd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fee030c1fe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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 right 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
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==73018==ABORTING
@thegenemyers
Copy link
Owner

thegenemyers commented May 22, 2020 via email

@a-ludi
Copy link
Author

a-ludi commented May 25, 2020

Thanks Gene, that fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants