AddressSanitizer报告本身是否泄漏?

时间:2018-10-23 13:43:18

标签: go gcc address-sanitizer

我正在尝试在具有Go绑定的库上使用ASAN。我是C ++的新手,如果这是一个简单的问题,请原谅我。但是,我至少希望AddressSanitizer可以更准确地告诉我它实际泄漏的位置,也许是在我的代码中!

实际上,我只能看到libasan本身泄漏了一些字节。也许我什至无法正常运行ASAN?

shinichi@ilya:~/source/go/src/github.com/theQRL/go-qrl [master*]$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.4 go test -bench -v ./pkg/core/block
# github.com/theQRL/go-qrl/pkg/core/block (testmain)
/usr/lib/go-1.10/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
//usr/lib/x86_64-linux-gnu/libasan.so.4: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
//usr/lib/x86_64-linux-gnu/libasan.so.4: warning: the use of `tempnam' is dangerous, better use `mkstemp'
//usr/lib/x86_64-linux-gnu/libasan.so.4: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'

=================================================================
==13851==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 846056 byte(s) in 7 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7f0af48b82e1 in bfd_malloc (/usr/lib/x86_64-linux-gnu/libbfd-2.30-system.so+0x502e1)

Direct leak of 5680 byte(s) in 3 object(s) allocated from:
    #0 0x7f0af4c96f40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40)
    #1 0x7f0af4962a4c in xrealloc (/usr/lib/x86_64-linux-gnu/libbfd-2.30-system.so+0xfaa4c)

Direct leak of 5536 byte(s) in 1 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x5579758a0b61  (/usr/bin/x86_64-linux-gnu-ld.bfd+0x13b61)

Direct leak of 4504 byte(s) in 147 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7f0af49629c7 in xmalloc (/usr/lib/x86_64-linux-gnu/libbfd-2.30-system.so+0xfa9c7)

Direct leak of 512 byte(s) in 8 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x55797589e632  (/usr/bin/x86_64-linux-gnu-ld.bfd+0x11632)

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x5579758a078f  (/usr/bin/x86_64-linux-gnu-ld.bfd+0x1378f)

Indirect leak of 131088 byte(s) in 8 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x55797589e648  (/usr/bin/x86_64-linux-gnu-ld.bfd+0x11648)

Indirect leak of 8991 byte(s) in 1 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x5579758a07a4  (/usr/bin/x86_64-linux-gnu-ld.bfd+0x137a4)

Indirect leak of 44 byte(s) in 1 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7f0af49629c7 in xmalloc (/usr/lib/x86_64-linux-gnu/libbfd-2.30-system.so+0xfa9c7)
    #2 0x3638782f6363672e  (<unknown module>)

Indirect leak of 31 byte(s) in 1 object(s) allocated from:
    #0 0x7f0af4c96b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7f0af49629c7 in xmalloc (/usr/lib/x86_64-linux-gnu/libbfd-2.30-system.so+0xfa9c7)
    #2 0x6d742f3d6e6f6973  (<unknown module>)

SUMMARY: AddressSanitizer: 1002506 byte(s) leaked in 178 allocation(s).
collect2: error: ld returned 1 exit status

=================================================================
==13849==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4378 byte(s) in 21 object(s) allocated from:
    #0 0x7f9e6fcb4b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x4720c7  (/usr/bin/x86_64-linux-gnu-g++-7+0x4720c7)

Direct leak of 160 byte(s) in 1 object(s) allocated from:
    #0 0x7f9e6fcb4d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
    #1 0x472100  (/usr/bin/x86_64-linux-gnu-g++-7+0x472100)

Indirect leak of 18 byte(s) in 1 object(s) allocated from:
    #0 0x7f9e6fcb4b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x4720c7  (/usr/bin/x86_64-linux-gnu-g++-7+0x4720c7)

SUMMARY: AddressSanitizer: 4556 byte(s) leaked in 23 allocation(s).

FAIL    github.com/theQRL/go-qrl/pkg/core/block [build failed]
shinichi@ilya:~/source/go/src/github.com/theQRL/go-qrl [master*]$ 

0 个答案:

没有答案