linux/drivers/hwtracing/coresight
Robin Murphy ccff2dface coresight: tpiu: Fix disabling timeouts
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>
2018-07-15 13:52:59 +02:00
..
Kconfig coresight: Introduce support for Coresight Address Translation Unit 2018-07-15 13:52:58 +02:00
Makefile coresight: Introduce support for Coresight Address Translation Unit 2018-07-15 13:52:58 +02:00
coresight-catu.c coresight: catu: Plug in CATU as a backend for ETR buffer 2018-07-15 13:52:59 +02:00
coresight-catu.h coresight: catu: Plug in CATU as a backend for ETR buffer 2018-07-15 13:52:59 +02:00
coresight-cpu-debug.c coresight: Remove %px for printing pcsr value 2018-05-14 16:20:00 +02:00
coresight-dynamic-replicator.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-etb10.c coresight: Add helper for inserting synchronization packets 2018-07-15 13:52:57 +02:00
coresight-etm-cp14.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-etm-perf.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-etm-perf.h coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-etm.h coresight: etm3x: Don't use contextID with PID namespaces 2018-07-15 13:52:56 +02:00
coresight-etm3x-sysfs.c coresight: etm3x: Don't use contextID with PID namespaces 2018-07-15 13:52:56 +02:00
coresight-etm3x.c coresight: etm3x: Don't use contextID with PID namespaces 2018-07-15 13:52:56 +02:00
coresight-etm4x-sysfs.c coresight: etm4x: Don't use contextID with PID namespaces 2018-07-15 13:52:56 +02:00
coresight-etm4x.c coresight: ETM: Add support for Arm Cortex-A73 and Cortex-A35 2018-07-15 13:52:56 +02:00
coresight-etm4x.h coresight: etm4x: Don't use contextID with PID namespaces 2018-07-15 13:52:56 +02:00
coresight-funnel.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-priv.h coresight: Add helper for inserting synchronization packets 2018-07-15 13:52:57 +02:00
coresight-replicator.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-stm.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-tmc-etf.c coresight: Add helper for inserting synchronization packets 2018-07-15 13:52:57 +02:00
coresight-tmc-etr.c coresight: catu: Plug in CATU as a backend for ETR buffer 2018-07-15 13:52:59 +02:00
coresight-tmc.c coresight: tmc: Add configuration support for trace buffer size 2018-07-15 13:52:57 +02:00
coresight-tmc.h coresight: catu: Plug in CATU as a backend for ETR buffer 2018-07-15 13:52:59 +02:00
coresight-tpiu.c coresight: tpiu: Fix disabling timeouts 2018-07-15 13:52:59 +02:00
coresight.c coresight: Add helper device type 2018-07-15 13:52:58 +02:00
of_coresight.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00