diff mbox series

drm/i915/perf: add sentinel to xehp_oa_b_counters

Message ID 20230711153410.1224997-1-andrzej.hajda@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/perf: add sentinel to xehp_oa_b_counters | expand

Commit Message

Andrzej Hajda July 11, 2023, 3:34 p.m. UTC
Arrays passed to reg_in_range_table should end with empty record.

The patch solves KASAN detected bug with signature:
BUG: KASAN: global-out-of-bounds in xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
Read of size 4 at addr ffffffffa1555d90 by task perf/1518

CPU: 4 PID: 1518 Comm: perf Tainted: G U 6.4.0-kasan_438-g3303d06107f3+ #1
Hardware name: Intel Corporation Meteor Lake Client Platform/MTL-P DDR5 SODIMM SBS RVP, BIOS MTLPFWI1.R00.3223.D80.2305311348 05/31/2023
Call Trace:
<TASK>
...
xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]

Fixes: 0fa9349dda030f ("drm/i915/perf: complete programming whitelisting for XEHPSDV")
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
---
 drivers/gpu/drm/i915/i915_perf.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andi Shyti July 11, 2023, 3:35 p.m. UTC | #1
Hi Andrzej,

On Tue, Jul 11, 2023 at 05:34:10PM +0200, Andrzej Hajda wrote:
> Arrays passed to reg_in_range_table should end with empty record.
> 
> The patch solves KASAN detected bug with signature:
> BUG: KASAN: global-out-of-bounds in xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
> Read of size 4 at addr ffffffffa1555d90 by task perf/1518
> 
> CPU: 4 PID: 1518 Comm: perf Tainted: G U 6.4.0-kasan_438-g3303d06107f3+ #1
> Hardware name: Intel Corporation Meteor Lake Client Platform/MTL-P DDR5 SODIMM SBS RVP, BIOS MTLPFWI1.R00.3223.D80.2305311348 05/31/2023
> Call Trace:
> <TASK>
> ...
> xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
> 
> Fixes: 0fa9349dda030f ("drm/i915/perf: complete programming whitelisting for XEHPSDV")
> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Andi
Nirmoy Das July 11, 2023, 10:10 p.m. UTC | #2
On 7/11/2023 5:34 PM, Andrzej Hajda wrote:
> Arrays passed to reg_in_range_table should end with empty record.
>
> The patch solves KASAN detected bug with signature:
> BUG: KASAN: global-out-of-bounds in xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
> Read of size 4 at addr ffffffffa1555d90 by task perf/1518
>
> CPU: 4 PID: 1518 Comm: perf Tainted: G U 6.4.0-kasan_438-g3303d06107f3+ #1
> Hardware name: Intel Corporation Meteor Lake Client Platform/MTL-P DDR5 SODIMM SBS RVP, BIOS MTLPFWI1.R00.3223.D80.2305311348 05/31/2023
> Call Trace:
> <TASK>
> ...
> xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
>
> Fixes: 0fa9349dda030f ("drm/i915/perf: complete programming whitelisting for XEHPSDV")
> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_perf.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 7413c11fb562e9..49c6f1ff11284f 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -4431,6 +4431,7 @@ static const struct i915_range mtl_oam_b_counters[] = {
>   static const struct i915_range xehp_oa_b_counters[] = {
>   	{ .start = 0xdc48, .end = 0xdc48 },	/* OAA_ENABLE_REG */
>   	{ .start = 0xdd00, .end = 0xdd48 },	/* OAG_LCE0_0 - OAA_LENABLE_REG */
> +	{}
>   };
>   
>   static const struct i915_range gen7_oa_mux_regs[] = {
Andrzej Hajda July 12, 2023, 9:02 a.m. UTC | #3
On 12.07.2023 00:10, Nirmoy Das wrote:
> 
> On 7/11/2023 5:34 PM, Andrzej Hajda wrote:
>> Arrays passed to reg_in_range_table should end with empty record.
>>
>> The patch solves KASAN detected bug with signature:
>> BUG: KASAN: global-out-of-bounds in 
>> xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
>> Read of size 4 at addr ffffffffa1555d90 by task perf/1518
>>
>> CPU: 4 PID: 1518 Comm: perf Tainted: G U 
>> 6.4.0-kasan_438-g3303d06107f3+ #1
>> Hardware name: Intel Corporation Meteor Lake Client Platform/MTL-P 
>> DDR5 SODIMM SBS RVP, BIOS MTLPFWI1.R00.3223.D80.2305311348 05/31/2023
>> Call Trace:
>> <TASK>
>> ...
>> xehp_is_valid_b_counter_addr+0x2c7/0x350 [i915]
>>
>> Fixes: 0fa9349dda030f ("drm/i915/perf: complete programming 
>> whitelisting for XEHPSDV")
>> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>


Thx, pushed.

Regards
Andrzej

>> ---
>>   drivers/gpu/drm/i915/i915_perf.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_perf.c 
>> b/drivers/gpu/drm/i915/i915_perf.c
>> index 7413c11fb562e9..49c6f1ff11284f 100644
>> --- a/drivers/gpu/drm/i915/i915_perf.c
>> +++ b/drivers/gpu/drm/i915/i915_perf.c
>> @@ -4431,6 +4431,7 @@ static const struct i915_range 
>> mtl_oam_b_counters[] = {
>>   static const struct i915_range xehp_oa_b_counters[] = {
>>       { .start = 0xdc48, .end = 0xdc48 },    /* OAA_ENABLE_REG */
>>       { .start = 0xdd00, .end = 0xdd48 },    /* OAG_LCE0_0 - 
>> OAA_LENABLE_REG */
>> +    {}
>>   };
>>   static const struct i915_range gen7_oa_mux_regs[] = {
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 7413c11fb562e9..49c6f1ff11284f 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -4431,6 +4431,7 @@  static const struct i915_range mtl_oam_b_counters[] = {
 static const struct i915_range xehp_oa_b_counters[] = {
 	{ .start = 0xdc48, .end = 0xdc48 },	/* OAA_ENABLE_REG */
 	{ .start = 0xdd00, .end = 0xdd48 },	/* OAG_LCE0_0 - OAA_LENABLE_REG */
+	{}
 };
 
 static const struct i915_range gen7_oa_mux_regs[] = {