Re: perf/ring-buffer: Undefined behaviour in kernel/events/ring_buffer.c:685:22
From: Andrey Ryabinin
Date: Fri Jan 22 2016 - 07:49:08 EST
2016-01-19 17:31 GMT+03:00 Peter Zijlstra <peterz@xxxxxxxxxxxxx>:
> On Sun, Jan 10, 2016 at 03:55:13PM -0500, Sasha Levin wrote:
>> Hi all,
>>
>> While fuzzing with trinity inside a KVM tools guest, running the latest -next
>> kernel, I've hit the following warning:
>>
>> [ 3494.030114] UBSAN: Undefined behaviour in kernel/events/ring_buffer.c:685:22
>> [ 3494.030647] shift exponent -1 is negative
>
> That's rb->page_order == -1, which should 'never' happen, curious!
>
It happens if nr_pages = 0:
rb->page_order = ilog2(nr_pages);