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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 13 Feb 2019 09:40:05 +0800
From:   "Jin, Yao" <yao.jin@...ux.intel.com>
To:     Peter Zijlstra <peterz@...radead.org>
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 2/12/2019 9:07 PM, Peter Zijlstra wrote:
> 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)
> 
> 

Thanks Peter! This fix works!

Thanks
Jin Yao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ