[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f804e10-97c0-9861-4131-b33ca977d2eb@linux.intel.com>
Date: Thu, 28 May 2020 09:46:42 -0400
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: Andi Kleen <ak@...ux.intel.com>
Cc: peterz@...radead.org, mingo@...hat.com,
linux-kernel@...r.kernel.org, David.Laight@...lab.com
Subject: Re: [PATCH V2 3/3] perf/x86/intel/uncore: Validate MMIO address
before accessing
On 5/28/2020 9:30 AM, Andi Kleen wrote:
> On Thu, May 28, 2020 at 06:15:27AM -0700, kan.liang@...ux.intel.com wrote:
>> From: Kan Liang <kan.liang@...ux.intel.com>
>>
>> An oops will be triggered, if perf tries to access an invalid address
>> which exceeds the mapped area.
>>
>> Check the address before the actual access to MMIO sapce of an uncore
>> unit.
>
> Ah ok the range check is here
>
>>
>> Suggested-by: David Laight <David.Laight@...LAB.COM>
>> Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
>> ---
>> arch/x86/events/intel/uncore.c | 3 +++
>> arch/x86/events/intel/uncore.h | 12 ++++++++++++
>> arch/x86/events/intel/uncore_snbep.c | 6 ++++++
>> 3 files changed, 21 insertions(+)
>>
>> diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
>> index cf76d66..284f8e7 100644
>> --- a/arch/x86/events/intel/uncore.c
>> +++ b/arch/x86/events/intel/uncore.c
>> @@ -132,6 +132,9 @@ u64 uncore_mmio_read_counter(struct intel_uncore_box *box,
>> if (!box->io_addr)
>> return 0;
>>
>> + if (!is_valid_mmio_offset(box, event->hw.event_base))
>> + return 0;
>
> Is this function used somewhere else? Otherwise it should be added
> together with its users.
>
Yes, it's generic function. Current MMIO uncore units invoke it to read
counter.
Thanks,
Kan
Powered by blists - more mailing lists