bugGNU roff - Bugs: bug #57516, Memory leaks shown by...

 
 

bug #57516: Memory leaks shown by "LDFLAGS=-fsanitize=address"

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Thu 02 Jan 2020 03:45:36 AM UTC
   
 
Category:  Core Severity:  3 - Normal
Item Group:  Build/Installation Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 02 Jan 2020 03:45:36 AM UTC, original submission:  


Subject: Memory leaks shown by "LDFLAGS=-fsanitize=address"

  Bug reports #56694, #55331, and #52335 could be related to
this phenomenon.

 If the html-documentation is not built, the next memory leak is reported for "webpage.ps".

  Configuration of "groff" with:

CC='/usr/bin/gcc' # (Debian 9.2.1-21) 9.2.1 20191130

CFLAGS="\
-Wall -Wextra -Wformat=2 -Wmissing-prototypes \
-Wold-style-definition -Wstrict-prototypes -Wstringop-overflow=4 \
-Wold-style-declaration -Wshadow=global \
-fstack-protector-strong -fno-common -funsigned-char \
-fvar-tracking-assignments  \
-fstack-clash-protection \
-ftrapv \
-std=c11 -pedantic -D_FORTIFY_SOURCE=2  \
"
CXXFLAGS="\
-Wall -Wextra -Wformat=2   \
-fstack-protector-strong -fno-common -funsigned-char  \
-std=c++14 \
"
LDFLAGS="-fsanitize=undefined -fsanitize=address"



-- Begin of output from "make":

[...]

  GROFF    doc/pic.html

=================================================================
==13419==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2607 byte(s) in 11 object(s) allocated from:
    #0 0x7fc74ab7c628 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x107628)
    #1 0x561e75a38693 in strsave(char const*) (/home/bg/git/groff/build/pic+0x2c693)
    #2 0x561e75a1e990 in do_define() (/home/bg/git/groff/build/pic+0x12990)
    #3 0x561e75a200fb in yylex() (/home/bg/git/groff/build/pic+0x140fb)
    #4 0x561e75a1510c in yyparse() (/home/bg/git/groff/build/pic+0x910c)
    #5 0x561e75a2176c in do_picture(_IO_FILE*) (/home/bg/git/groff/build/pic+0x1576c)
    #6 0x561e75a21c03 in do_file(char const*) (/home/bg/git/groff/build/pic+0x15c03)
    #7 0x561e75a221f9 in main (/home/bg/git/groff/build/pic+0x161f9)
    #8 0x7fc749c3dbba in __libc_start_main ../csu/libc-start.c:308

Direct leak of 1800 byte(s) in 75 object(s) allocated from:
    #0 0x7fc74ab7e36f in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10936f)
    #1 0x561e75a1aa72 in define_variable(char const*, double) (/home/bg/git/groff/build/pic+0xea72)
    #2 0x561e75a1ecae in for_input::get() (/home/bg/git/groff/build/pic+0x12cae)
    #3 0x561e75a1c9b6 in input_stack::get_char() (/home/bg/git/groff/build/pic+0x109b6)
    #4 0x561e75a1d8dc in get_token(int) (/home/bg/git/groff/build/pic+0x118dc)
    #5 0x561e75a20085 in yylex() (/home/bg/git/groff/build/pic+0x14085)
    #6 0x561e75a1510c in yyparse() (/home/bg/git/groff/build/pic+0x910c)
    #7 0x561e75a2176c in do_picture(_IO_FILE*) (/home/bg/git/groff/build/pic+0x1576c)
    #8 0x561e75a21c03 in do_file(char const*) (/home/bg/git/groff/build/pic+0x15c03)
    #9 0x561e75a221f9 in main (/home/bg/git/groff/build/pic+0x161f9)
    #10 0x7fc749c3dbba in __libc_start_main ../csu/libc-start.c:308

[...]

SUMMARY: AddressSanitizer: 7805 byte(s) leaked in 290 allocation(s).

=================================================================
==13421==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2760 byte(s) in 115 object(s) allocated from:
    #0 0x7f1d6c57e36f in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10936f)
    #1 0x560d4759f3e7 in init_table(char const*) (/home/bg/git/groff/build/eqn+0xe3e7)
    #2 0x560d4759e739 in main (/home/bg/git/groff/build/eqn+0xd739)
    #3 0x7f1d6b63dbba in __libc_start_main ../csu/libc-start.c:308

[...]

SUMMARY: AddressSanitizer: 6336 byte(s) leaked in 329 allocation(s).

=================================================================
==13423==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 3456 byte(s) in 432 object(s) allocated from:
    #0 0x7f4853ec936f in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10936f)
    #1 0x5583f3ffd743 in glyph_to_unicode_init::glyph_to_unicode_init() (/home/bg/git/groff/build/post-grohtml+0x28743)
    #2 0x5583f3ffd81d in __static_initialization_and_destruction_0(int, int) (/home/bg/git/groff/build/post-grohtml+0x2881d)
    #3 0x5583f3ffd833 in _GLOBAL__sub_I__ZN23glyph_to_unicode_passocC2Ev (/home/bg/git/groff/build/post-grohtml+0x28833)
    #4 0x5583f400c954 in __libc_csu_init (/home/bg/git/groff/build/post-grohtml+0x37954)

SUMMARY: AddressSanitizer: 3456 byte(s) leaked in 432 allocation(s).

=================================================================
==13417==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 3456 byte(s) in 432 object(s) allocated from:
    #0 0x7f760818136f in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10936f)
    #1 0x55feb8f8e737 in glyph_to_unicode_init::glyph_to_unicode_init() (/home/bg/git/groff/build/groff+0x11737)
    #2 0x55feb8f8e811 in __static_initialization_and_destruction_0(int, int) (/home/bg/git/groff/build/groff+0x11811)
    #3 0x55feb8f8e827 in _GLOBAL__sub_I__ZN23glyph_to_unicode_passocC2Ev (/home/bg/git/groff/build/groff+0x11827)
    #4 0x55feb8f9d284 in __libc_csu_init (/home/bg/git/groff/build/groff+0x20284)

SUMMARY: AddressSanitizer: 3456 byte(s) leaked in 432 allocation(s).
make[1]: *** [Makefile:11880: doc/pic.html] Error 1
make[1]: Leaving directory '/home/bg/git/groff/build'
make: *** [Makefile:5648: all] Error 2

--- End of output from "make":

-- Begin of file "tmp/groff-regions-vCZUNF":

=================================================================
==13430==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) on 0x604000000750
    #0 0x7fbf6e656137 in operator delete[](void*) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10a137)
    #1 0x557e10d7b5c5 in process_startup_file(char const*) (/home/bg/git/groff/build/troff+0x615c5)
    #2 0x557e10d7c795 in main (/home/bg/git/groff/build/troff+0x62795)
    #3 0x7fbf6d714bba in __libc_start_main ../csu/libc-start.c:308
    #4 0x557e10d4f649 in _start (/home/bg/git/groff/build/troff+0x35649)

0x604000000750 is located 0 bytes inside of 41-byte region [0x604000000750,0x604000000779)
allocated by thread T0 here:
    #0 0x7fbf6e653628 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x107628)
    #1 0x557e10da8cb6 in strsave(char const*) (/home/bg/git/groff/build/troff+0x8ecb6)
    #2 0x557e10da7996 in search_path::open_file(char const*, char**) (/home/bg/git/groff/build/troff+0x8d996)
    #3 0x557e10d7b552 in process_startup_file(char const*) (/home/bg/git/groff/build/troff+0x61552)
    #4 0x557e10d7c795 in main (/home/bg/git/groff/build/troff+0x62795)
    #5 0x7fbf6d714bba in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10a137) in operator delete[](void*)
==13430==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==13430==ABORTING

=================================================================
==13431==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 3456 byte(s) in 432 object(s) allocated from:
    #0 0x7ff52b9da36f in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10936f)
    #1 0x55981f27aefd in glyph_to_unicode_init::glyph_to_unicode_init() (/home/bg/git/groff/build/grops+0x1eefd)
    #2 0x55981f27afd7 in __static_initialization_and_destruction_0(int, int) (/home/bg/git/groff/build/grops+0x1efd7)
    #3 0x55981f27afed in _GLOBAL__sub_I__ZN23glyph_to_unicode_passocC2Ev (/home/bg/git/groff/build/grops+0x1efed)
    #4 0x55981f28a2f4 in __libc_csu_init (/home/bg/git/groff/build/grops+0x2e2f4)

SUMMARY: AddressSanitizer: 3456 byte(s) leaked in 432 allocation(s).

=================================================================
==13428==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 3456 byte(s) in 432 object(s) allocated from:
    #0 0x7f605ef9636f in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10936f)
    #1 0x55c1dcc63737 in glyph_to_unicode_init::glyph_to_unicode_init() (/home/bg/git/groff/build/groff+0x11737)
    #2 0x55c1dcc63811 in __static_initialization_and_destruction_0(int, int) (/home/bg/git/groff/build/groff+0x11811)
    #3 0x55c1dcc63827 in _GLOBAL__sub_I__ZN23glyph_to_unicode_passocC2Ev (/home/bg/git/groff/build/groff+0x11827)
    #4 0x55c1dcc72284 in __libc_csu_init (/home/bg/git/groff/build/groff+0x20284)

SUMMARY: AddressSanitizer: 3456 byte(s) leaked in 432 allocation(s).

-- End of file "tmp/groff-regions-vCZUNF".


-- Begin of output from "test-groff":

=================================================================
==13542==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) on 0x6040000006d0
    #0 0x7fc3fe417137 in operator delete[](void*) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10a137)
    #1 0x56072324c5c5 in process_startup_file(char const*) (/home/bg/git/groff/build/troff+0x615c5)
    #2 0x56072324d795 in main (/home/bg/git/groff/build/troff+0x62795)
    #3 0x7fc3fd4d5bba in __libc_start_main ../csu/libc-start.c:308
    #4 0x560723220649 in _start (/home/bg/git/groff/build/troff+0x35649)

0x6040000006d0 is located 0 bytes inside of 41-byte region [0x6040000006d0,0x6040000006f9)
allocated by thread T0 here:
    #0 0x7fc3fe414628 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x107628)
    #1 0x560723279cb6 in strsave(char const*) (/home/bg/git/groff/build/troff+0x8ecb6)
    #2 0x560723278996 in search_path::open_file(char const*, char**) (/home/bg/git/groff/build/troff+0x8d996)
    #3 0x56072324c552 in process_startup_file(char const*) (/home/bg/git/groff/build/troff+0x61552)
    #4 0x56072324d795 in main (/home/bg/git/groff/build/troff+0x62795)
    #5 0x7fc3fd4d5bba in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10a137) in operator delete[](void*)
==13542==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==13542==ABORTING

=================================================================
==13543==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 3456 byte(s) in 432 object(s) allocated from:
    #0 0x7f33c7d7936f in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10936f)
    #1 0x55b91ba76efd in glyph_to_unicode_init::glyph_to_unicode_init() (/home/bg/git/groff/build/grops+0x1eefd)
    #2 0x55b91ba76fd7 in __static_initialization_and_destruction_0(int, int) (/home/bg/git/groff/build/grops+0x1efd7)
    #3 0x55b91ba76fed in _GLOBAL__sub_I__ZN23glyph_to_unicode_passocC2Ev (/home/bg/git/groff/build/grops+0x1efed)
    #4 0x55b91ba862f4 in __libc_csu_init (/home/bg/git/groff/build/grops+0x2e2f4)

SUMMARY: AddressSanitizer: 3456 byte(s) leaked in 432 allocation(s).

=================================================================
==13541==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 3456 byte(s) in 432 object(s) allocated from:
    #0 0x7fe54ce0436f in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10936f)
    #1 0x55ae07382737 in glyph_to_unicode_init::glyph_to_unicode_init() (/home/bg/git/groff/build/groff+0x11737)
    #2 0x55ae07382811 in __static_initialization_and_destruction_0(int, int) (/home/bg/git/groff/build/groff+0x11811)
    #3 0x55ae07382827 in _GLOBAL__sub_I__ZN23glyph_to_unicode_passocC2Ev (/home/bg/git/groff/build/groff+0x11827)
    #4 0x55ae07391284 in __libc_csu_init (/home/bg/git/groff/build/groff+0x20284)

SUMMARY: AddressSanitizer: 3456 byte(s) leaked in 432 allocation(s).

-- End of output from "test-groff".


Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-11-02 barx Carbon-CopyRemoved 93119 -
    2020-11-02 barx SummarySubject: Memory leaks shown by &quot;LDFLAGS=-fsanitize=address&quot; Memory leaks shown by "LDFLAGS=-fsanitize=address"

    Back to the top

    Powered by Savane 3.14-8eb0.
    Corresponding source code