lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 18 Feb 2019 14:44:15 +0100
From:   Greg Kroah-Hartman <>
Cc:     Greg Kroah-Hartman <>,, "Jin, Yao" <>,
        Julien Thierry <>,
        Mark Rutland <>,
        Alexander Shishkin <>,
        Arnaldo Carvalho de Melo <>,
        Jiri Olsa <>,
        Linus Torvalds <>,
        Namhyung Kim <>,
        Peter Zijlstra <>,
        Thomas Gleixner <>,
        Ingo Molnar <>, Borislav Petkov <>
Subject: [PATCH 4.4 127/143] perf/core: Fix impossible ring-buffer sizes warning

4.4-stable review patch.  If anyone has any objections, please let me know.


From: Ingo Molnar <>

commit 528871b456026e6127d95b1b2bd8e3a003dc1614 upstream.

The following commit:

  9dff0aa95a32 ("perf/core: Don't WARN() for impossible ring-buffer sizes")

results in perf recording failures with larger mmap areas:

  root@skl:/tmp# perf record -g -a
  failed to mmap with 12 (Cannot allocate memory)

The root cause is that the following condition is buggy:

	if (order_base_2(size) >= MAX_ORDER)
		goto fail;

The problem is that @size is in bytes and MAX_ORDER is in pages,
so the right test is:

	if (order_base_2(size) >= PAGE_SHIFT+MAX_ORDER)
		goto fail;

Fix it.

Reported-by: "Jin, Yao" <>
Bisected-by: Borislav Petkov <>
Analyzed-by: Peter Zijlstra <>
Cc: Julien Thierry <>
Cc: Mark Rutland <>
Cc: Alexander Shishkin <>
Cc: Arnaldo Carvalho de Melo <>
Cc: Jiri Olsa <>
Cc: Linus Torvalds <>
Cc: Namhyung Kim <>
Cc: Peter Zijlstra <>
Cc: Thomas Gleixner <>
Cc: Greg Kroah-Hartman <>
Cc: <>
Fixes: 9dff0aa95a32 ("perf/core: Don't WARN() for impossible ring-buffer sizes")
Signed-off-by: Ingo Molnar <>
Signed-off-by: Greg Kroah-Hartman <>

 kernel/events/ring_buffer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -637,7 +637,7 @@ struct ring_buffer *rb_alloc(int nr_page
 	size = sizeof(struct ring_buffer);
 	size += nr_pages * sizeof(void *);
-	if (order_base_2(size) >= MAX_ORDER)
+	if (order_base_2(size) >= PAGE_SHIFT+MAX_ORDER)
 		goto fail;
 	rb = kzalloc(size, GFP_KERNEL);

Powered by blists - more mailing lists