stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changbin Du <changbin.du@gmail.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Julien Thierry <julien.thierry@arm.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	Changbin Du <changbin.du@gmail.com>
Subject: Re: [PATCH] perf/core: Fix mmap failure caused by bad size check
Date: Thu, 14 Feb 2019 03:34:28 +0000	[thread overview]
Message-ID: <20190214033426.qbhlhjdv6qq75tf7@mail.google.com> (raw)
In-Reply-To: <20190212155221.32753-1-changbin.du@gmail.com>

Hi Peter, Ingo and Arnaldo,
Could you help review this and have this fix merged in next RC? The perf
is totaly broken now! Thanks.

On Tue, Feb 12, 2019 at 11:52:21PM +0800, Changbin Du wrote:
> Perf tool now is broken by commit 9dff0aa95a32 ("perf/core: Don't WARN()
> for impossible ring-buffer sizes"). The get_order() should be used but not
> the order_base_2(). This mistake makes mmap() on perf fd always fail.
> 
> Fixes: 9dff0aa95a32 ("perf/core: Don't WARN() for impossible ring-buffer sizes")
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Julien Thierry <julien.thierry@arm.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: <stable@vger.kernel.org>
> ---
>  kernel/events/ring_buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> index 309ef5a64af5..55faafca4a6e 100644
> --- a/kernel/events/ring_buffer.c
> +++ b/kernel/events/ring_buffer.c
> @@ -734,7 +734,7 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)
>  	size = sizeof(struct ring_buffer);
>  	size += nr_pages * sizeof(void *);
>  
> -	if (order_base_2(size) >= MAX_ORDER)
> +	if (get_order(size) >= MAX_ORDER)
>  		goto fail;
>  
>  	rb = kzalloc(size, GFP_KERNEL);
> -- 
> 2.19.1
> 

-- 
Cheers,
Changbin Du

      reply	other threads:[~2019-02-14  3:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 15:52 [PATCH] perf/core: Fix mmap failure caused by bad size check Changbin Du
2019-02-14  3:34 ` Changbin Du [this message]

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=20190214033426.qbhlhjdv6qq75tf7@mail.google.com \
    --to=changbin.du@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=julien.thierry@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 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).