apache / apache/brpc

qnx core dump

Open
#2,383 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
17.6k
Forks
4.1k
Avg merge
2d 12h
Merged PRs (30d)
69

Description

demo program:
`#include
#include

int main()
{
char *ptr = (char *)tc_malloc(sizeof(char));
if(ptr){
printf("tcmalloc works failed!\n");
}
tc_free(ptr);

printf("tcmalloc works fine.\n");

return 0;
}`

Execution issues after cross compilation:
ldd test
./test:
libtcmalloc.so.9 => /var/data/demo_test/libtcmalloc.so.9 (0x268c1ce000)
libc++.so.1 => /lib64/libc++.so.1 (0x268c3d1000)
libm.so.3 => /lib64/libm.so.3 (0x268c4c0000)
libc.so.4 => /usr/lib/ldqnx-64.so.2 (0x268c11b000)
./test

Process 905670781 (test) terminated SIGSEGV code=1 fltno=11 ip=0000000defa9a868(/var/data/demo_test/libtcmalloc.so.9@calloc+0x0000000000000000) mapaddr=000000000002e868. ref=000000368d29cfc0
Memory fault (core dumped)

debug:
(gdb) set solib-search-path ./lib
(gdb) file test
Reading symbols from test...done.
(gdb) core-file test.core
[New pid 39800955 tid 1]
Program terminated with signal SIGSEGV, Segmentation fault.
#0 tc_calloc (n=n@entry=34, elem_size=elem_size@entry=8) at src/tcmalloc.cc:1984
1984 size_t elem_size) PERFTOOLS_NOTHROW {
(gdb) f 1
#1 0x00000033358c4e04 in __emutls_get_address (obj=0x33358e4040 <__emutls_v._ZN8tcmalloc11ThreadCache17threadlocal_data_E>) at ../../../../libgcc/emutls.c:159
159 ../../../../libgcc/emutls.c: No such file or directory.
(gdb) f 1
#1 0x00000033358c4e04 in __emutls_get_address (obj=0x33358e4040 <__emutls_v._ZN8tcmalloc11ThreadCache17threadlocal_data_E>) at ../../../../libgcc/emutls.c:159
159 in ../../../../libgcc/emutls.c
(gdb) p list
No symbol "list" in current context.
(gdb) p next
$1 = 1
(gdb) p list
No symbol "list" in current context.
(gdb)

why ?

_Originally posted by @tangzhiqiang3 in https://github.com/apache/brpc/issues/1979#issuecomment-1720709755_

Contributor guide

Open the contributing guide

Research direction

Start with the QNX reproduction in the issue and inspect the crash at tc_calloc in src/tcmalloc.cc:1984. Read the __emutls_get_address frame in libgcc/emutls.c and compare the cross-compiled test's runtime libraries and symbols. Done means identifying the QNX-specific cause of the SIGSEGV and documenting or fixing a reproducible solution.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.