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

AddressSanitizer: access-violation on unknown address #175

Open
InnotSagg opened this issue Dec 20, 2020 · 0 comments
Open

AddressSanitizer: access-violation on unknown address #175

InnotSagg opened this issue Dec 20, 2020 · 0 comments

Comments

@InnotSagg
Copy link

InnotSagg commented Dec 20, 2020

I try use llvm-mingw with https://github.com/ldc-developers/ldc (enable -fsanitize=address), work well on win32, but get this error on win64:

=================================================================
==3424==ERROR: AddressSanitizer: access-violation on unknown address 0x000040003110 (pc 0x0001400014b4 bp 0x00000014fe20 sp 0x00000014fda0 T0)
==3424==The signal is caused by a READ memory access.
    #0 0x1400014b3 in main tests.d:3
    #1 0x1400013e9 in __tmainCRTStartup /build/mingw-w64/mingw-w64-crt/build-x86_64\../crt\crtexe.c:333:15
    #2 0x140001445 in mainCRTStartup /build/mingw-w64/mingw-w64-crt/build-x86_64\../crt\crtexe.c:212:9
    #3 0x7ff886d36fd3  (C:\Windows\System32\KERNEL32.DLL+0x180016fd3)
    #4 0x7ff887bdcf30  (C:\Windows\SYSTEM32\ntdll.dll+0x18004cf30)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: access-violation tests.d:3 in main
==3424==ABORTING    

The source code reduced to this simple test case:

extern(C) int main(int argc, char** argv, char** evp) @nogc nothrow {
        string s = "a";
        return 0;
}

llvm-objdump

tests_core_utf8.o:	file format coff-x86-64

Disassembly of section .text$main:

0000000000000000 <main>:
       0: 55                           	pushq	%rbp
       1: 53                           	pushq	%rbx
       2: 48 81 ec 88 00 00 00         	subq	$136, %rsp
       9: 48 8d ac 24 80 00 00 00      	leaq	128(%rsp), %rbp
      11: 48 83 e4 e0                  	andq	$-32, %rsp
      15: 48 89 e3                     	movq	%rsp, %rbx
      18: 48 83 ec 20                  	subq	$32, %rsp
      1c: 4c 89 43 58                  	movq	%r8, 88(%rbx)
      20: 48 89 53 50                  	movq	%rdx, 80(%rbx)
      24: 89 4b 4c                     	movl	%ecx, 76(%rbx)
      27: e8 00 00 00 00               	callq	0x2c <main+0x2c>
      2c: 48 83 c4 20                  	addq	$32, %rsp
      30: 31 c0                        	xorl	%eax, %eax
      32: 89 c2                        	movl	%eax, %edx
      34: 4c 8b 04 25 00 00 00 00      	movq	0, %r8
      3c: 4c 8b 0c 25 00 00 00 00      	movq	0, %r9
      44: 4d 8b 09                     	movq	(%r9), %r9
      47: 8b 43 4c                     	movl	76(%rbx), %eax
      4a: 89 83 84 00 00 00            	movl	%eax, 132(%rbx)
      50: 4c 8b 53 50                  	movq	80(%rbx), %r10
      54: 4c 89 53 78                  	movq	%r10, 120(%rbx)
      58: 4c 8b 5b 58                  	movq	88(%rbx), %r11
      5c: 4c 89 5b 70                  	movq	%r11, 112(%rbx)
      60: 41 83 38 00                  	cmpl	$0, (%r8)
      64: 4c 89 4b 40                  	movq	%r9, 64(%rbx)
      68: 48 89 53 38                  	movq	%rdx, 56(%rbx)
      6c: 74 16                        	je	0x84 <main+0x84>
      6e: 48 83 ec 20                  	subq	$32, %rsp
      72: b9 40 00 00 00               	movl	$64, %ecx
      77: e8 00 00 00 00               	callq	0x7c <main+0x7c>
      7c: 48 83 c4 20                  	addq	$32, %rsp
      80: 48 89 43 38                  	movq	%rax, 56(%rbx)
      84: 48 8b 43 38                  	movq	56(%rbx), %rax
      88: 48 83 f8 00                  	cmpq	$0, %rax
      8c: 48 89 c1                     	movq	%rax, %rcx
      8f: 48 89 43 30                  	movq	%rax, 48(%rbx)
      93: 48 89 4b 28                  	movq	%rcx, 40(%rbx)
      97: 75 1b                        	jne	0xb4 <main+0xb4>
      99: b8 40 00 00 00               	movl	$64, %eax
      9e: e8 00 00 00 00               	callq	0xa3 <main+0xa3>
      a3: 48 29 c4                     	subq	%rax, %rsp
      a6: 48 89 e0                     	movq	%rsp, %rax
      a9: 48 83 e0 e0                  	andq	$-32, %rax
      ad: 48 89 c4                     	movq	%rax, %rsp
      b0: 48 89 43 28                  	movq	%rax, 40(%rbx)
      b4: 48 8b 43 28                  	movq	40(%rbx), %rax
      b8: 48 89 43 68                  	movq	%rax, 104(%rbx)
      bc: 48 89 c1                     	movq	%rax, %rcx
      bf: 48 81 c1 20 00 00 00         	addq	$32, %rcx
      c6: 48 c7 00 b3 8a b5 41         	movq	$1102416563, (%rax)
      cd: 48 ba 00 00 00 00 00 00 00 00	movabsq	$0, %rdx
      d7: 48 89 50 08                  	movq	%rdx, 8(%rax)
      db: 48 ba 00 00 00 00 00 00 00 00	movabsq	$0, %rdx
      e5: 48 89 50 10                  	movq	%rdx, 16(%rax)
      e9: 48 89 c2                     	movq	%rax, %rdx
      ec: 48 c1 ea 03                  	shrq	$3, %rdx
      f0: 4c 8b 43 40                  	movq	64(%rbx), %r8
      f4: 4c 01 c2                     	addq	%r8, %rdx
      f7: 49 b9 f1 f1 f1 f1 00 00 f3 f3	movabsq	$-868350299093208591, %r9
     101: 4c 89 0a                     	movq	%r9, (%rdx)
     104: 49 89 c9                     	movq	%rcx, %r9
     107: 49 c1 e9 03                  	shrq	$3, %r9
     10b: 4d 01 c1                     	addq	%r8, %r9
     10e: 41 80 39 00                  	cmpb	$0, (%r9)
     112: 48 89 43 20                  	movq	%rax, 32(%rbx)
     116: 48 89 4b 18                  	movq	%rcx, 24(%rbx)
     11a: 48 89 53 10                  	movq	%rdx, 16(%rbx)
     11e: 74 0d                        	je	0x12d <main+0x12d>
     120: 48 83 ec 20                  	subq	$32, %rsp
     124: 48 8b 4b 18                  	movq	24(%rbx), %rcx
     128: e8 00 00 00 00               	callq	0x12d <main+0x12d>
     12d: 48 8b 43 18                  	movq	24(%rbx), %rax
     131: 48 c7 00 01 00 00 00         	movq	$1, (%rax)
     138: 48 05 08 00 00 00            	addq	$8, %rax
     13e: 48 89 c1                     	movq	%rax, %rcx
     141: 48 c1 e9 03                  	shrq	$3, %rcx
     145: 48 8b 53 40                  	movq	64(%rbx), %rdx
     149: 48 01 d1                     	addq	%rdx, %rcx
     14c: 80 39 00                     	cmpb	$0, (%rcx)
     14f: 48 89 43 08                  	movq	%rax, 8(%rbx)
     153: 74 0d                        	je	0x162 <main+0x162>
     155: 48 83 ec 20                  	subq	$32, %rsp
     159: 48 8b 4b 08                  	movq	8(%rbx), %rcx
     15d: e8 00 00 00 00               	callq	0x162 <main+0x162>
     162: 48 b8 00 00 00 00 00 00 00 00	movabsq	$0, %rax
     16c: 48 8b 4b 08                  	movq	8(%rbx), %rcx
     170: 48 89 01                     	movq	%rax, (%rcx)
     173: 48 8b 43 20                  	movq	32(%rbx), %rax
     177: 48 c7 00 0e 36 e0 45         	movq	$1172321806, (%rax)
     17e: 48 8b 53 30                  	movq	48(%rbx), %rdx
     182: 48 83 fa 00                  	cmpq	$0, %rdx
     186: 74 1e                        	je	0x1a6 <main+0x1a6>
     188: 48 b8 f5 f5 f5 f5 f5 f5 f5 f5	movabsq	$-723401728380766731, %rax
     192: 48 8b 4b 10                  	movq	16(%rbx), %rcx
     196: 48 89 01                     	movq	%rax, (%rcx)
     199: 48 8b 43 30                  	movq	48(%rbx), %rax
     19d: 48 8b 50 38                  	movq	56(%rax), %rdx
     1a1: c6 02 00                     	movb	$0, (%rdx)
     1a4: eb 0b                        	jmp	0x1b1 <main+0x1b1>
     1a6: 48 8b 43 10                  	movq	16(%rbx), %rax
     1aa: 48 c7 00 00 00 00 00         	movq	$0, (%rax)
     1b1: 31 c0                        	xorl	%eax, %eax
     1b3: 48 8d 65 08                  	leaq	8(%rbp), %rsp
     1b7: 5b                           	popq	%rbx
     1b8: 5d                           	popq	%rbp
     1b9: c3                           	retq

Disassembly of section .text$asan.module_ctor:

0000000000000000 <asan.module_ctor>:
       0: 48 83 ec 28                  	subq	$40, %rsp
       4: e8 00 00 00 00               	callq	0x9 <asan.module_ctor+0x9>
       9: e8 00 00 00 00               	callq	0xe <asan.module_ctor+0xe>
       e: 90                           	nop
       f: 48 83 c4 28                  	addq	$40, %rsp
      13: c3                           	retq
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

1 participant