KEMBAR78
async-profiler incorrect installation of hooks · Issue #1266 · async-profiler/async-profiler · GitHub
Skip to content

async-profiler incorrect installation of hooks #1266

@Baraa-Hasheesh

Description

@Baraa-Hasheesh

Describe the bug

It's possible for async-profiler to incorrectly install hooks while doing it's profiling
This leads the profiler to call the wrong method which changes the behaviour of the program when compared to running with & without profiler

This leads to having different outputs for certain method calls depending if profiler is being used or not

Expected vs. actual behavior

profiler shouldn't change the fundamental behaviour of the program being profiled

Reproduction Steps

You can find the test case here https://github.com/Baraa-Hasheesh/asprof-reproducers/tree/main/malloc

You just need to do the following

  • set PATH_TO_ASYNC_PROFILER_LIB_DIR to point to the directory that contains the profiler so
  • execute make
  • execute ./runner.sh
  • execute ./runner.sh 1

You can observe that malloc behavior changes here

Additional Information/Context

In the mentioned test case originally the malloc will be called from the preloaded Library

However when profiler is started it incorrectly redirect malloc to the original malloc call rather than the custom malloc declaration in the preloaded Library

Async-profiler version

latest

Environment details

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions