]> git.baikalelectronics.ru Git - kernel.git/commit
ring-buffer: Mask out the info bits when returning buffer page length
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Sat, 23 Dec 2017 01:32:35 +0000 (20:32 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 27 Dec 2017 19:18:10 +0000 (14:18 -0500)
commit28b91a6e551070ceff912dac71c56adce3b92878
tree2be812c53e77e4f2e2f0dd57d3accd344fe0d913
parent6d26e52fc39dd1b277640428ccc4ab1abd836cd8
ring-buffer: Mask out the info bits when returning buffer page length

Two info bits were added to the "commit" part of the ring buffer data page
when returned to be consumed. This was to inform the user space readers that
events have been missed, and that the count may be stored at the end of the
page.

What wasn't handled, was the splice code that actually called a function to
return the length of the data in order to zero out the rest of the page
before sending it up to user space. These data bits were returned with the
length making the value negative, and that negative value was not checked.
It was compared to PAGE_SIZE, and only used if the size was less than
PAGE_SIZE. Luckily PAGE_SIZE is unsigned long which made the compare an
unsigned compare, meaning the negative size value did not end up causing a
large portion of memory to be randomly zeroed out.

Cc: stable@vger.kernel.org
Fixes: 21e6f2738fd31 ("ring-buffer: Add place holder recording of dropped events")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c