]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tracing: Have the histogram compare functions convert to u64 first
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 11 Dec 2019 20:44:22 +0000 (15:44 -0500)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:47:27 +0000 (23:47 -0500)
commit8fd9696de2bdbdf8c19d2de351ca90a1d313bb9b
treead84b32b17142b5b3b92c65a1b43a21876ce5c7b
parentc24f379fe2fde3f103a25de12f64886b05b279a1
tracing: Have the histogram compare functions convert to u64 first

BugLink: https://bugs.launchpad.net/bugs/1860602
commit 106f41f5a302cb1f36c7543fae6a05de12e96fa4 upstream.

The compare functions of the histogram code would be specific for the size
of the value being compared (byte, short, int, long long). It would
reference the value from the array via the type of the compare, but the
value was stored in a 64 bit number. This is fine for little endian
machines, but for big endian machines, it would end up comparing zeros or
all ones (depending on the sign) for anything but 64 bit numbers.

To fix this, first derference the value as a u64 then convert it to the type
being compared.

Link: http://lkml.kernel.org/r/20191211103557.7bed6928@gandalf.local.home
Cc: stable@vger.kernel.org
Fixes: 08d43a5fa063e ("tracing: Add lock-free tracing_map")
Acked-by: Tom Zanussi <zanussi@kernel.org>
Reported-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
kernel/trace/tracing_map.c