perf/amd/uncore: Fix sysfs type mismatch
authorNathan Chancellor <nathan@kernel.org>
Thu, 15 Apr 2021 00:11:12 +0000 (17:11 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 16 Apr 2021 16:58:52 +0000 (18:58 +0200)
commit5deac80d4571dffb51f452f0027979d72259a1b9
tree6f3eaa033b97f8cf44ae3b6d19de8a4ff5a1c22b
parentde5bc7b425d4c27ae5faa00ea7eb6b9780b9a355
perf/amd/uncore: Fix sysfs type mismatch

dev_attr_show() calls the __uncore_*_show() functions via an indirect
call but their type does not currently match the type of the show()
member in 'struct device_attribute', resulting in a Control Flow
Integrity violation.

$ cat /sys/devices/amd_l3/format/umask
config:8-15

$ dmesg | grep "CFI failure"
[ 1258.174653] CFI failure (target: __uncore_umask_show...):

Update the type in the DEFINE_UNCORE_FORMAT_ATTR macro to match
'struct device_attribute' so that there is no more CFI violation.

Fixes: 06f2c24584f3 ("perf/amd/uncore: Prepare to scale for more attributes that vary per family")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210415001112.3024673-2-nathan@kernel.org
arch/x86/events/amd/uncore.c