appscope
appscope copied to clipboard
[HOLD] Funchook memory management functions
This is a proof of concept of tracking the memory management functions. Next steps:
- check node environment hello_world and unwind
- ~~check if usable_size will work~~
- ~~check strdup, posix_memalign,mmap, munmap functions~~
Current configuration options
Default Variant
By default backtrace logging is disabled
Example command
scope ls
Full Backtrace Variant
To enable full backtrace logging for memory management functions please use:
- the environment variable
SCOPE_BACKTRACE
with thefull
setting
Example command
SCOPE_BACKTRACE=full scope ls
Filter/Limited Backtrace Variant
To enable full backtrace logging for memory management functions please use:
- the environment variable
SCOPE_BACKTRACE
with thefilter
setting - the environment variable
SCOPE_BACKTRACE_FILTER
with path to the file which contains the searched phrases
test_filter.txt
fclose
Example command
SCOPE_BACKTRACE=filter SCOPE_BACKTRACE_FILTER=test_filter.txt scope ls
Output
root@b53be13e8361:/# scope logs
Scope: ls(pid:292): [2022-06-08T11:11:02.135+0000] scopeBacktraceFilter begin
Scope: ls(pid:292): [2022-06-08T11:11:02.135+0000] func symbol: fclose, malloc_fun: free, size allocated: -1032, total size allocated: 30864
Scope: ls(pid:292): [2022-06-08T11:11:02.135+0000] scopeBacktraceFilter end
Openat/dlopen Backtrace Variant
To backtrace logging for dlopen
and openat
family functions please use:
- the environment variable
SCOPE_BACKTRACE
with theopenat
setting
Example command
SCOPE_BACKTRACE=openat scope foo_cmd