Skip to content

Conversation

@michalbiesek
Copy link
Contributor

@michalbiesek michalbiesek commented Jun 3, 2022

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

@michalbiesek michalbiesek force-pushed the feat-malloc-interpose branch 4 times, most recently from 247ea3f to f48575e Compare June 6, 2022 14:33
@michalbiesek michalbiesek force-pushed the feat-malloc-interpose branch from f48575e to 5f5c87e Compare June 6, 2022 14:40
@michalbiesek michalbiesek force-pushed the feat-malloc-interpose branch from 9aff8d0 to adfe976 Compare June 7, 2022 13:50
@michalbiesek michalbiesek force-pushed the feat-malloc-interpose branch from adfe976 to d57495d Compare June 7, 2022 14:21
- `full`
- `filter`
- `none` by default

Add env variable SCOPE_BACKTRACE_FILTER

- passing path to a file with filter list
@michalbiesek
Copy link
Contributor Author

michalbiesek commented Jun 8, 2022

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 the full 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 the filter 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 the openat setting

Example command

SCOPE_BACKTRACE=openat scope foo_cmd

@seanvaleo seanvaleo changed the title [DRAFT] Do not merge Funchook memory management functions [HOLD] Funchook memory management functions Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants