diff --git a/ihk b/ihk index 9a15ade2..7880d778 160000 --- a/ihk +++ b/ihk @@ -1 +1 @@ -Subproject commit 9a15ade2abc344b37797a6124769992cb7d80226 +Subproject commit 7880d7786a39bde6bd7f195a8142928b29a95170 diff --git a/kernel/syscall.c b/kernel/syscall.c index 90fc81ff..450eb566 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -4103,7 +4103,7 @@ static int mc_perf_event_alloc(struct mc_perf_event **out, goto out; } - if (val == 0) { + if (!ihk_mc_validate_event(val)) { ret = -ENOENT; goto out; } diff --git a/lib/include/ihk/cpu.h b/lib/include/ihk/cpu.h index 711e19d3..1890a4d1 100644 --- a/lib/include/ihk/cpu.h +++ b/lib/include/ihk/cpu.h @@ -87,6 +87,7 @@ unsigned long ihk_mc_hw_event_map(unsigned long hw_event); unsigned long ihk_mc_hw_cache_event_map(unsigned long hw_cache_event); unsigned long ihk_mc_hw_cache_extra_reg_map(unsigned long hw_cache_event); unsigned long ihk_mc_raw_event_map(unsigned long raw_event); +int ihk_mc_validate_event(unsigned long hw_config); /* returns the 'prev' argument of the call that caused the switch to the context returned. */ void *ihk_mc_switch_context(ihk_mc_kernel_context_t *old_ctx,