Segmentation fault on info level logging
aufarg opened this issue · comments
Hello,
I'm trying to run hello
on the test directory with mallocwatch.so
and info level logging. It gave me segmentation fault.
$ LD_PRELOAD=x86_64-pc-linux-gnu/mallocwatch.so PREENY_INFO=1 tests/hello
[1] 6269 segmentation fault (core dumped) LD_PRELOAD=x86_64-pc-linux-gnu/mallocwatch.so PREENY_INFO=1 tests/hello
But running without PREENY_INFO=1
results in successful execution.
$ LD_PRELOAD=x86_64-pc-linux-gnu/mallocwatch.so tests/hello
Hello world!
After some code modification on mallocwatch.c
and logging.c
, I found that it's because it segfaults because it tries to call vprintf
and printf
from libc. Removing the vprintf
and printf
from preeny_info
works (without logging too). I'm not sure why though.
$ gcc -v
gcc (GCC) 8.2.1 20180831
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ ldd --version
ldd (GNU libc) 2.28
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.