x86/events/amd/iommu: Fix sysfs type mismatch
[ Upstream commitde5bc7b425
] dev_attr_show() calls _iommu_event_show() via an indirect call but _iommu_event_show()'s 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_iommu_1/events/mem_dte_hit csource=0x0a $ dmesg | grep "CFI failure" [ 3526.735140] CFI failure (target: _iommu_event_show...): Change _iommu_event_show() and 'struct amd_iommu_event_desc' to 'struct device_attribute' so that there is no more CFI violation. Fixes:7be6296fdd
("perf/x86/amd: AMD IOMMU Performance Counter PERF uncore PMU implementation") 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-1-nathan@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
08557db2c9
commit
04e7be5c78
@ -80,12 +80,12 @@ static struct attribute_group amd_iommu_format_group = {
|
|||||||
* sysfs events attributes
|
* sysfs events attributes
|
||||||
*---------------------------------------------*/
|
*---------------------------------------------*/
|
||||||
struct amd_iommu_event_desc {
|
struct amd_iommu_event_desc {
|
||||||
struct kobj_attribute attr;
|
struct device_attribute attr;
|
||||||
const char *event;
|
const char *event;
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t _iommu_event_show(struct kobject *kobj,
|
static ssize_t _iommu_event_show(struct device *dev,
|
||||||
struct kobj_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct amd_iommu_event_desc *event =
|
struct amd_iommu_event_desc *event =
|
||||||
container_of(attr, struct amd_iommu_event_desc, attr);
|
container_of(attr, struct amd_iommu_event_desc, attr);
|
||||||
|
Reference in New Issue
Block a user