All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: mpe@ellerman.id.au, peterz@infradead.org
Cc: jolsa@redhat.com, maddy@linux.vnet.ibm.com, acme@kernel.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: Re: [PATCH v2] perf ioctl: Add check for the sample_period value
Date: Mon, 17 Jun 2019 14:08:32 +0530	[thread overview]
Message-ID: <e1d0fcf5-d7f8-44a0-a3b8-339f2b79fb2c@linux.ibm.com> (raw)
In-Reply-To: <20190604042953.914-1-ravi.bangoria@linux.ibm.com>

Peter / mpe,

Is the v2 looks good? If so, can anyone of you please pick this up.

On 6/4/19 9:59 AM, Ravi Bangoria wrote:
> perf_event_open() limits the sample_period to 63 bits. See
> commit 0819b2e30ccb ("perf: Limit perf_event_attr::sample_period
> to 63 bits"). Make ioctl() consistent with it.
> 
> Also on powerpc, negative sample_period could cause a recursive
> PMIs leading to a hang (reported when running perf-fuzzer).
> 
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
>  kernel/events/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index abbd4b3b96c2..e44c90378940 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -5005,6 +5005,9 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg)
>  	if (perf_event_check_period(event, value))
>  		return -EINVAL;
>  
> +	if (!event->attr.freq && (value & (1ULL << 63)))
> +		return -EINVAL;
> +
>  	event_function_call(event, __perf_event_period, &value);
>  
>  	return 0;
> 


WARNING: multiple messages have this Message-ID (diff)
From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: mpe@ellerman.id.au, peterz@infradead.org
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
	maddy@linux.vnet.ibm.com, jolsa@redhat.com,
	linux-kernel@vger.kernel.org, acme@kernel.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] perf ioctl: Add check for the sample_period value
Date: Mon, 17 Jun 2019 14:08:32 +0530	[thread overview]
Message-ID: <e1d0fcf5-d7f8-44a0-a3b8-339f2b79fb2c@linux.ibm.com> (raw)
In-Reply-To: <20190604042953.914-1-ravi.bangoria@linux.ibm.com>

Peter / mpe,

Is the v2 looks good? If so, can anyone of you please pick this up.

On 6/4/19 9:59 AM, Ravi Bangoria wrote:
> perf_event_open() limits the sample_period to 63 bits. See
> commit 0819b2e30ccb ("perf: Limit perf_event_attr::sample_period
> to 63 bits"). Make ioctl() consistent with it.
> 
> Also on powerpc, negative sample_period could cause a recursive
> PMIs leading to a hang (reported when running perf-fuzzer).
> 
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
>  kernel/events/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index abbd4b3b96c2..e44c90378940 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -5005,6 +5005,9 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg)
>  	if (perf_event_check_period(event, value))
>  		return -EINVAL;
>  
> +	if (!event->attr.freq && (value & (1ULL << 63)))
> +		return -EINVAL;
> +
>  	event_function_call(event, __perf_event_period, &value);
>  
>  	return 0;
> 


  reply	other threads:[~2019-06-17  8:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-11  2:42 [PATCH 1/2] perf ioctl: Add check for the sample_period value Ravi Bangoria
2019-05-11  2:42 ` Ravi Bangoria
2019-05-11  2:42 ` [PATCH 2/2] powerpc/perf: Fix mmcra corruption by bhrb_filter Ravi Bangoria
2019-05-11  2:42   ` Ravi Bangoria
2019-05-11  2:47   ` Ravi Bangoria
2019-05-11  2:47     ` Ravi Bangoria
2019-05-22  5:01   ` Madhavan Srinivasan
2019-05-22  5:01     ` Madhavan Srinivasan
2019-05-25  0:54   ` Michael Ellerman
2019-05-13  7:42 ` [PATCH 1/2] perf ioctl: Add check for the sample_period value Peter Zijlstra
2019-05-13  7:42   ` Peter Zijlstra
2019-05-13  8:56   ` Peter Zijlstra
2019-05-13  8:56     ` Peter Zijlstra
2019-05-13 10:07     ` Ravi Bangoria
2019-05-13 10:07       ` Ravi Bangoria
2019-05-28  9:50       ` Michael Ellerman
2019-05-28  9:50         ` Michael Ellerman
2019-06-04  4:29         ` [PATCH v2] " Ravi Bangoria
2019-06-04  4:29           ` Ravi Bangoria
2019-06-17  8:38           ` Ravi Bangoria [this message]
2019-06-17  8:38             ` Ravi Bangoria
2019-06-18 12:28             ` Michael Ellerman
2019-06-18 12:28               ` Michael Ellerman
2019-06-25  8:19           ` [tip:perf/urgent] perf/ioctl: " tip-bot for Ravi Bangoria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1d0fcf5-d7f8-44a0-a3b8-339f2b79fb2c@linux.ibm.com \
    --to=ravi.bangoria@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.