linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/arm-cmn: Validate cycles events fully
@ 2023-04-03 11:49 Robin Murphy
  2023-04-04  6:05 ` Ilkka Koskinen
  2023-04-06 15:51 ` Will Deacon
  0 siblings, 2 replies; 3+ messages in thread
From: Robin Murphy @ 2023-04-03 11:49 UTC (permalink / raw)
  To: will; +Cc: mark.rutland, linux-arm-kernel, linux-kernel

DTC cycle count events don't have anything to validate or initialise in
themselves, but we should not forget to still validate their whole group
context. Otherwise, we may fail to correctly reject a contrived group
containing an impossible number of cycles events.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/perf/arm-cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 367d41c5d983..45819528facb 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1558,7 +1558,7 @@ static int arm_cmn_event_init(struct perf_event *event)
 	type = CMN_EVENT_TYPE(event);
 	/* DTC events (i.e. cycles) already have everything they need */
 	if (type == CMN_TYPE_DTC)
-		return 0;
+		return arm_cmn_validate_group(cmn, event);
 
 	eventid = CMN_EVENT_EVENTID(event);
 	/* For watchpoints we need the actual XP node here */
-- 
2.39.2.101.g768bb238c484.dirty


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf/arm-cmn: Validate cycles events fully
  2023-04-03 11:49 [PATCH] perf/arm-cmn: Validate cycles events fully Robin Murphy
@ 2023-04-04  6:05 ` Ilkka Koskinen
  2023-04-06 15:51 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Ilkka Koskinen @ 2023-04-04  6:05 UTC (permalink / raw)
  To: Robin Murphy; +Cc: will, mark.rutland, linux-arm-kernel, linux-kernel


On Mon, 3 Apr 2023, Robin Murphy wrote:
> DTC cycle count events don't have anything to validate or initialise in
> themselves, but we should not forget to still validate their whole group
> context. Otherwise, we may fail to correctly reject a contrived group
> containing an impossible number of cycles events.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

Looks good to me and works as expected.

Cheers, Ilkka

> ---
> drivers/perf/arm-cmn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 367d41c5d983..45819528facb 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1558,7 +1558,7 @@ static int arm_cmn_event_init(struct perf_event *event)
> 	type = CMN_EVENT_TYPE(event);
> 	/* DTC events (i.e. cycles) already have everything they need */
> 	if (type == CMN_TYPE_DTC)
> -		return 0;
> +		return arm_cmn_validate_group(cmn, event);
>
> 	eventid = CMN_EVENT_EVENTID(event);
> 	/* For watchpoints we need the actual XP node here */
> -- 
> 2.39.2.101.g768bb238c484.dirty
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf/arm-cmn: Validate cycles events fully
  2023-04-03 11:49 [PATCH] perf/arm-cmn: Validate cycles events fully Robin Murphy
  2023-04-04  6:05 ` Ilkka Koskinen
@ 2023-04-06 15:51 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2023-04-06 15:51 UTC (permalink / raw)
  To: Robin Murphy
  Cc: catalin.marinas, kernel-team, Will Deacon, linux-arm-kernel,
	mark.rutland, linux-kernel

On Mon, 3 Apr 2023 12:49:05 +0100, Robin Murphy wrote:
> DTC cycle count events don't have anything to validate or initialise in
> themselves, but we should not forget to still validate their whole group
> context. Otherwise, we may fail to correctly reject a contrived group
> containing an impossible number of cycles events.
> 
> 

Applied to will (for-next/perf), thanks!

[1/1] perf/arm-cmn: Validate cycles events fully
      https://git.kernel.org/will/c/23b2fd839489

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-06 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03 11:49 [PATCH] perf/arm-cmn: Validate cycles events fully Robin Murphy
2023-04-04  6:05 ` Ilkka Koskinen
2023-04-06 15:51 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).