[PATCH 0/8] perf/amd/ibs: Fix sample period computations

Ravi Bangoria posted 8 patches 1 month, 3 weeks ago
arch/x86/events/amd/ibs.c         | 97 +++++++++++++++++++++++--------
arch/x86/include/asm/perf_event.h |  1 +
include/linux/perf_event.h        |  5 ++
kernel/events/core.c              | 12 +++-
4 files changed, 88 insertions(+), 27 deletions(-)
[PATCH 0/8] perf/amd/ibs: Fix sample period computations
Posted by Ravi Bangoria 1 month, 3 weeks ago
IBS Fetch and IBS Op pmus have constraints on supported sample period
values. The IBS hw behavior could be undefined if they are not followed.
Currently, IBS driver does not honor them correctly and thus a malicious
event could cause issues to the system. Fortunately, the IBS hw is very
resilient so far and IBS pmus are restricted to root only, so the attack
vector is minimal. In any case, these are genuine bugs and must be fixed.

Patches are prepared on v6.11.

Ravi Bangoria (8):
  perf/amd/ibs: Remove IBS_{FETCH|OP}_CONFIG_MASK macros
  perf/amd/ibs: Remove pointless sample period check
  perf/amd/ibs: Fix ->config to sample period calculation for OP pmu
  perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt
  perf/amd/ibs: Don't allow freq mode event creation through ->config
    interface
  perf/amd/ibs: Add pmu specific minimum period
  perf/amd/ibs: Add ->check_period() callback
  perf/core: Introduce pmu->adjust_period() callback

 arch/x86/events/amd/ibs.c         | 97 +++++++++++++++++++++++--------
 arch/x86/include/asm/perf_event.h |  1 +
 include/linux/perf_event.h        |  5 ++
 kernel/events/core.c              | 12 +++-
 4 files changed, 88 insertions(+), 27 deletions(-)

-- 
2.46.2
Re: [PATCH 0/8] perf/amd/ibs: Fix sample period computations
Posted by Namhyung Kim 1 month, 2 weeks ago
On Mon, Oct 07, 2024 at 03:48:02AM +0000, Ravi Bangoria wrote:
> IBS Fetch and IBS Op pmus have constraints on supported sample period
> values. The IBS hw behavior could be undefined if they are not followed.
> Currently, IBS driver does not honor them correctly and thus a malicious
> event could cause issues to the system. Fortunately, the IBS hw is very
> resilient so far and IBS pmus are restricted to root only, so the attack
> vector is minimal. In any case, these are genuine bugs and must be fixed.
> 
> Patches are prepared on v6.11.
> 
> Ravi Bangoria (8):
>   perf/amd/ibs: Remove IBS_{FETCH|OP}_CONFIG_MASK macros
>   perf/amd/ibs: Remove pointless sample period check
>   perf/amd/ibs: Fix ->config to sample period calculation for OP pmu
>   perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt
>   perf/amd/ibs: Don't allow freq mode event creation through ->config
>     interface
>   perf/amd/ibs: Add pmu specific minimum period
>   perf/amd/ibs: Add ->check_period() callback
>   perf/core: Introduce pmu->adjust_period() callback

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> 
>  arch/x86/events/amd/ibs.c         | 97 +++++++++++++++++++++++--------
>  arch/x86/include/asm/perf_event.h |  1 +
>  include/linux/perf_event.h        |  5 ++
>  kernel/events/core.c              | 12 +++-
>  4 files changed, 88 insertions(+), 27 deletions(-)
> 
> -- 
> 2.46.2
>
Re: [PATCH 0/8] perf/amd/ibs: Fix sample period computations
Posted by Ravi Bangoria 1 week, 1 day ago
On 09-Oct-24 12:03 PM, Namhyung Kim wrote:
> On Mon, Oct 07, 2024 at 03:48:02AM +0000, Ravi Bangoria wrote:
>> IBS Fetch and IBS Op pmus have constraints on supported sample period
>> values. The IBS hw behavior could be undefined if they are not followed.
>> Currently, IBS driver does not honor them correctly and thus a malicious
>> event could cause issues to the system. Fortunately, the IBS hw is very
>> resilient so far and IBS pmus are restricted to root only, so the attack
>> vector is minimal. In any case, these are genuine bugs and must be fixed.
>>
>> Patches are prepared on v6.11.
>>
>> Ravi Bangoria (8):
>>   perf/amd/ibs: Remove IBS_{FETCH|OP}_CONFIG_MASK macros
>>   perf/amd/ibs: Remove pointless sample period check
>>   perf/amd/ibs: Fix ->config to sample period calculation for OP pmu
>>   perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt
>>   perf/amd/ibs: Don't allow freq mode event creation through ->config
>>     interface
>>   perf/amd/ibs: Add pmu specific minimum period
>>   perf/amd/ibs: Add ->check_period() callback
>>   perf/core: Introduce pmu->adjust_period() callback
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks Namhyung.

Peter/Ingo, gentle reminder :)

Thanks,
Ravi