-
Notifications
You must be signed in to change notification settings - Fork 419
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
dynamic: Fix -U for -fpatchable-function-entry #1799
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -508,6 +508,8 @@ static void patch_patchable_func_matched(struct mcount_dynamic_info *mdi, struct | |
.size = UINT_MAX, | ||
.name = namebuf, | ||
}; | ||
bool found = false; | ||
int match; | ||
char *soname = get_soname(map->libname); | ||
|
||
symtab = &map->mod->symtab; | ||
|
@@ -531,9 +533,19 @@ static void patch_patchable_func_matched(struct mcount_dynamic_info *mdi, struct | |
continue; | ||
} | ||
|
||
mcount_patch_func_with_stats(mdi, sym); | ||
found = true; | ||
match = match_pattern_list(map, soname, sym->name); | ||
if (!match) | ||
continue; | ||
else if (match == 1) | ||
mcount_patch_func_with_stats(mdi, sym); | ||
else | ||
mcount_unpatch_func(mdi, sym, NULL); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC I saw this change in the Ciena's work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, it looks 151fb61 missed fixing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As it has other problems, I think I can merge this one first. |
||
} | ||
|
||
if (!found) | ||
stats.nomatch++; | ||
|
||
free(soname); | ||
} | ||
|
||
|
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.
But there's nothing to unpatch for
-fpatchable-function-entry
as they are already NOPs.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.
It does its job in the following example.
Since
-P.
asks patching all the available functions, we need a way to suppress the previous patching request.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.
Ok, multiple updates also make it useful.