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:09 +0100
From:   Greg Kroah-Hartman <>
Cc:     Greg Kroah-Hartman <>,, Julien Thierry <>,
        Mark Rutland <>,
        "Peter Zijlstra (Intel)" <>,
        Alexander Shishkin <>,
        Arnaldo Carvalho de Melo <>,
        Jiri Olsa <>,
        Linus Torvalds <>,
        Namhyung Kim <>,
        Thomas Gleixner <>,
        Ingo Molnar <>
Subject: [PATCH 3.18 073/108] perf/core: Dont WARN() for impossible ring-buffer sizes

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


From: Mark Rutland <>

commit 9dff0aa95a324e262ffb03f425d00e4751f3294e upstream.

The perf tool uses /proc/sys/kernel/perf_event_mlock_kb to determine how
large its ringbuffer mmap should be. This can be configured to arbitrary
values, which can be larger than the maximum possible allocation from

When this is configured to a suitably large value (e.g. thanks to the
perf fuzzer), attempting to use perf record triggers a WARN_ON_ONCE() in

   WARNING: CPU: 2 PID: 5666 at mm/page_alloc.c:4511 __alloc_pages_nodemask+0x3f8/0xbc8

Let's avoid this by checking that the requested allocation is possible
before calling kzalloc.

Reported-by: Julien Thierry <>
Signed-off-by: Mark Rutland <>
Signed-off-by: Peter Zijlstra (Intel) <>
Reviewed-by: Julien Thierry <>
Cc: Alexander Shishkin <>
Cc: Arnaldo Carvalho de Melo <>
Cc: Jiri Olsa <>
Cc: Linus Torvalds <>
Cc: Namhyung Kim <>
Cc: Peter Zijlstra <>
Cc: Thomas Gleixner <>
Cc: <>
Signed-off-by: Ingo Molnar <>
Signed-off-by: Greg Kroah-Hartman <>

 kernel/events/ring_buffer.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -282,6 +282,9 @@ 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)
+		goto fail;
 	rb = kzalloc(size, GFP_KERNEL);
 	if (!rb)
 		goto fail;

Powered by blists - more mailing lists