Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD] Funchook memory management functions #984

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

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
- `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

src/cfg.c Outdated Show resolved Hide resolved
@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.

2 participants