linux-brain/drivers/hwtracing/coresight
Robin Murphy eb543ccfb0 coresight: tpiu: Fix disabling timeouts
[ Upstream commit ccff2dface ]

Probing the TPIU driver under UBSan triggers an out-of-bounds shift
warning in coresight_timeout():

...
[    5.677530] UBSAN: Undefined behaviour in drivers/hwtracing/coresight/coresight.c:929:16
[    5.685542] shift exponent 64 is too large for 64-bit type 'long unsigned int'
...

On closer inspection things are exponentially out of whack because we're
passing a bitmask where a bit number should be. Amusingly, it seems that
both calls will find their expected values by sheer luck and appear to
succeed: 1 << FFCR_FON_MAN ends up at bit 64 which whilst undefined
evaluates as zero in practice, while 1 << FFSR_FT_STOPPED finds bit 2
(TCPresent) which apparently is usually tied high.

Following the examples of other drivers, define separate FOO and FOO_BIT
macros for masks vs. indices, and put things right.

CC: Robert Walker <robert.walker@arm.com>
CC: Mike Leach <mike.leach@linaro.org>
CC: Mathieu Poirier <mathieu.poirier@linaro.org>
Fixes: 11595db8e1 ("coresight: Fix disabling of CoreSight TPIU")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:36:39 +02:00
..
coresight-etb10.c coresight: fix handling of ETM trace register access via sysfs 2016-08-31 13:05:43 +02:00
coresight-etm-cp14.c coresight: moving to new "hwtracing" directory 2015-04-03 16:17:04 +02:00
coresight-etm-perf.c coresight: perf: deal with error condition properly 2016-09-09 13:52:59 +02:00
coresight-etm-perf.h coresight: etm-perf: configuring filters from perf core 2016-08-31 13:05:43 +02:00
coresight-etm.h coresight: remove duplicated enumeration 2016-08-31 13:05:43 +02:00
coresight-etm3x-sysfs.c coresight: remove duplicated enumeration 2016-08-31 13:05:43 +02:00
coresight-etm3x.c coresight: etm-perf: pass struct perf_event to source::enable/disable() 2016-08-31 13:05:43 +02:00
coresight-etm4x-sysfs.c coresight: remove duplicated enumeration 2016-08-31 13:05:43 +02:00
coresight-etm4x.c coresight: etm4x: adding configurable start/stop filtering 2016-08-31 13:05:44 +02:00
coresight-etm4x.h coresight: remove duplicated enumeration 2016-08-31 13:05:43 +02:00
coresight-funnel.c coresight: Use local coresight_desc instances 2016-08-31 13:05:43 +02:00
coresight-priv.h coresight: remove duplicated enumeration 2016-08-31 13:05:43 +02:00
coresight-replicator-qcom.c coresight: Use local coresight_desc instances 2016-08-31 13:05:43 +02:00
coresight-replicator.c coresight: Use local coresight_desc instances 2016-08-31 13:05:43 +02:00
coresight-stm.c coresight: STM: Balance enable/disable 2017-03-12 06:41:42 +01:00
coresight-tmc-etf.c coresight: tmc: mark symbols static where possible 2016-09-09 13:53:00 +02:00
coresight-tmc-etr.c coresight: tmc: mark symbols static where possible 2016-09-09 13:53:00 +02:00
coresight-tmc.c coresight: tmc: Configure DMA mask appropriately 2018-04-13 19:48:26 +02:00
coresight-tmc.h coresight: tmc: Limit the trace to available data 2016-08-31 13:05:42 +02:00
coresight-tpiu.c coresight: tpiu: Fix disabling timeouts 2018-09-26 08:36:39 +02:00
coresight.c coresight: Handle errors in finding input/output ports 2018-09-26 08:36:39 +02:00
Kconfig coresight: stm: adding driver for CoreSight STM component 2016-05-03 14:59:30 -07:00
Makefile coresight: tmc: splitting driver in ETB/ETF and ETR components 2016-05-03 14:59:30 -07:00
of_coresight.c coresight: Fixes coresight DT parse to get correct output port ID. 2018-03-22 09:17:49 +01:00