From 9c78d4d24924f3b87cf329041ecc949c9baa1fe3 Mon Sep 17 00:00:00 2001 From: "TOIDA,Suguru" Date: Tue, 9 Jul 2019 13:38:26 +0900 Subject: [PATCH] pmu: define event validation in architecture dependent code. Change-Id: Ia053af146ba3c89810892271cae93def6d9fd7c8 --- ihk | 2 +- kernel/syscall.c | 2 +- lib/include/ihk/cpu.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) 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,