Skip to content

Commit

Permalink
xprobe: avoid untracable symbols on wildcard matches
Browse files Browse the repository at this point in the history
No function in the init-section of the kernel will ever be tracable,
so skip them.

Additionally, skip all symbols containing a dot (.), which is
typically generated internally by the compiler.

TODO: Find some way of actually finding out if the "notrace" attribute
is set on a symbol or not.

Partially fixes iovisor#50.
  • Loading branch information
wkz committed Mar 8, 2020
1 parent b415905 commit db21005
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/libply/provider/xprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,23 @@ static int xprobe_create_pattern(struct ply_probe *pb)
{
struct xprobe *xp = pb->provider_data;
struct ksym *sym;
int err, pending = 0;
int err, init = 0, pending = 0;

ksyms_foreach(sym, pb->ply->ksyms) {
if (!strcmp(sym->sym, "_sinittext"))
init++;
if (!strcmp(sym->sym, "_einittext"))
init--;

/* Ignore all functions in the init segment. They are
* not tracable. */
if (init)
continue;

/* Ignore GCC-internal symbols. */
if (strchr(sym->sym, '.'))
continue;

if (fnmatch(xp->pattern, sym->sym, PLY_FNM_FLAGS))
continue;

Expand Down

0 comments on commit db21005

Please sign in to comment.