]> git.proxmox.com Git - mirror_ubuntu-artful-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 13 Mar 2018 10:29:39 +0000 (11:29 +0100)
commit86aa63ac2a81f03afef8a6b3f21b3eb73f21b05a
tree38187ea112d3f40a5668d1de15cd04f4e554fdcb
parentb433f3c723815d1a94ff922b374bf1bbe327fea5
ring-buffer: Mask out the info bits when returning buffer page length

BugLink: http://bugs.launchpad.net/bugs/1745069
commit 45d8b80c2ac5d21cd1e2954431fb676bc2b1e099 upstream.

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.

Fixes: 66a8cb95ed040 ("ring-buffer: Add place holder recording of dropped events")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
kernel/trace/ring_buffer.c