-
Notifications
You must be signed in to change notification settings - Fork 478
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
Support patternized module name for dynamic patch #1211
base: master
Are you sure you want to change the base?
Conversation
a new struct 'module_patt_list' has been added to support pattern matching on module names. this structure divides the list of function name patterns by module and stores them in a list format. Signed-off-by: Hanbum Park <[email protected]>
prior to pattern support for module names, patt_list was used simultaneous to match module names and function names. after pattern support for module names patt_list will only be used for function name matching, so we have renamed it to clarify this. Signed-off-by: Hanbum Park <[email protected]>
functions have been added to support the pattern support for module names. Signed-off-by: Hanbum Park <[email protected]>
libraries that affect the operation of Uftrace should be excluded from the dynamic code patch list. added list of affected libraries. Signed-off-by: Hanbum Park <[email protected]>
the changed logic is as follows: when creating a list to be dynamically patched, -. creates a list of functions to patch by module by separating the specified dynamic patch targets. when performing dynamic patching for each module, -. if the name of the currently searched module exists in skip_libs, it moves to the next module. -. search the module list and check whether the current target module name is a dynamic patch target. -. searching the symbol of the module registered in the function list of the module list. perform dynamic patching if find matched symbol. Signed-off-by: Hanbum Park <[email protected]>
since the module list is additionally allocated to support pattern matching for the module name, we added logic to release it. Signed-off-by: Hanbum Park <[email protected]>
Hi @ParkHanbum, it'd be better if you post the way how we can reproduce the difference with a simple example using "Before" and "After". |
@honggyukim I should have done it, thank you for telling me. it was updated at first comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simply change type of patt_list.module to struct uftrace_pattern, no?
struct uftrace_pattern module_patt; | ||
char *module; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be a separate commit. Please merge this into where it's actually used.
free(pl); | ||
list_del(&ml->list); | ||
free(ml->module); | ||
free(ml); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I think it's better to put the release code along with the allocation code. So we can easily find where they are and make sure not to create any leaks.
Also please consider adding an unit test for new functionalities. It's also good to check memory errors with ASAN.
uftrace provides pattern matching on function names However, that is not supported for module names.
so, I added pattern matching for module names.
here is use case against testcase 224 dynamic_lib
ORIGIN
CHANGED