PAPI/perf_event allows creating events that have invalid names

Issue #33 resolved
Vince Weaver created an issue

Yan Liu reports that PAPI lets her create the following event without error: DTLB_LOAD_MISSES:MISS_CAUSES_A_WALK,DTLB_STORE_MISSES:MISS_CAUSES_A_WALK:u=1

PAPI seems to be treating the second event stuck on the end as a umask, but doesn't seem to mind that it's not a valid umask.

Comments (5)

  1. Vince Weaver reporter

    The pe_libpfm4 code is difficult to wade through, especially since user/kernel u=1/k=1 mask support was added.

    The issue seems to be we parse out the event names and umasks separately.

    To match umasks, we do a strncmp() of each mask in the proposed event against each possible umask. The problem is we strncmp with the size set to the possible umask, so if our umask matches but is longer it will be detected as a match even if what we are passing in is much longer.

    So I guess the fix is to do a size check. This is actually a tricky bug, it means if there are multiple umasks that start with the same characters we might accidentally match to the wrong one.

  2. Vince Weaver reporter

    I take it back, we actually do match exactly and check for size. Yet somehow a umask with garbage on the end still gets accepted as good. Still investigating.

  3. Vince Weaver reporter

    as a follow up, PAPI wasn't handling this right, but indeed libpfm4 also has a bug and is accepting events with invalid umasks. I'll report this upstream too.

  4. Log in to comment