lists.openwall.net   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  linux-cve-announce  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:   Tue, 12 Feb 2019 14:07:56 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     "Jin, Yao" <yao.jin@...ux.intel.com>
Cc:     Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org,
        julien.thierry@....com,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Ingo Molnar <mingo@...hat.com>, Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        "Jin, Yao" <yao.jin@...el.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: Re: [PATCH] perf/core: don't WARN for impossible rb sizes

On Tue, Feb 12, 2019 at 10:42:38AM +0800, Jin, Yao wrote:
> > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> > index 4a9937076331..309ef5a64af5 100644
> > --- a/kernel/events/ring_buffer.c
> > +++ b/kernel/events/ring_buffer.c
> > @@ -734,6 +734,9 @@ 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)
> > +		goto fail;
> > +
> >   	rb = kzalloc(size, GFP_KERNEL);

Yes, Boris also send the entire morning bisecting this.

The problem is that @size is in bytes and MAX_ORDER is in pages.

That should be:

  if (order_base_2(size) >= PAGE_SHIFT+MAX_ORDER)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ