TencentOS-kernel/drivers/acpi
Nathan Chancellor 9e2c43e986 ACPI: CPPC: Replace cppc_attr with kobj_attribute
[ Upstream commit 2bc6262c6117dd18106d5aa50d53e945b5d99c51 ]

All of the CPPC sysfs show functions are called via indirect call in
kobj_attr_show(), where they should be of type

ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf);

because that is the type of the ->show() member in
'struct kobj_attribute' but they are actually of type

ssize_t (*show)(struct kobject *kobj, struct attribute *attr, char *buf);

because of the ->show() member in 'struct cppc_attr', resulting in a
Control Flow Integrity violation [1].

$ cat /sys/devices/system/cpu/cpu0/acpi_cppc/highest_perf
3400

$ dmesg | grep "CFI failure"
[  175.970559] CFI failure (target: show_highest_perf+0x0/0x8):

As far as I can tell, the only difference between 'struct cppc_attr'
and 'struct kobj_attribute' aside from the type of the attr parameter
is the type of the count parameter in the ->store() member (ssize_t vs.
size_t), which does not actually matter because all of these nodes are
read-only.

Eliminate 'struct cppc_attr' in favor of 'struct kobj_attribute' to fix
the violation.

[1]: https://lore.kernel.org/r/20210401233216.2540591-1-samitolvanen@google.com/

Fixes: 158c998ea44b ("ACPI / CPPC: add sysfs support to compute delivered performance")
Link: https://github.com/ClangBuiltLinux/linux/issues/1343
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:07:49 +08:00
..
acpica ACPICA: Fix race in generic_serial_bus (I2C) and GPIO op_region parameter handling 2021-04-12 12:52:53 +08:00
apei BACKPORT: ACPI / APEI: Kick the memory_failure() queue for synchronous errors 2021-03-16 16:43:59 +08:00
arm64 ACPI: GTDT: Don't corrupt interrupt mappings on watchdow probe failure 2021-05-20 16:07:33 +08:00
dptf Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hmat ACPI: HMAT: Fix handling of changes from ACPI 6.2 to ACPI 6.3 2021-03-16 16:39:49 +08:00
nfit Intel: x86/mce: Fix all mce notifiers to update the mce->kflags bitmask 2021-04-25 14:31:15 +08:00
pmic Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
x86 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig Intel: ACPI: processor: Make ACPI_PROCESSOR_CSTATE depend on ACPI_PROCESSOR 2021-04-25 14:31:12 +08:00
Makefile ACPI: Always build evged in 2021-03-16 16:38:08 +08:00
ac.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_adxl.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_amba.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_apd.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_cmos_rtc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_configfs.c ACPI: configfs: add missing check after configfs_register_default_group() 2021-04-12 12:52:32 +08:00
acpi_dbg.c ACPI: debug: don't allow debugging when ACPI is disabled 2021-03-16 16:39:57 +08:00
acpi_extlog.c Intel: x86/mce: Fix all mce notifiers to update the mce->kflags bitmask 2021-04-25 14:31:15 +08:00
acpi_ipmi.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_lpat.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_lpit.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_lpss.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_memhotplug.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_pad.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_platform.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_pnp.c ACPI: PNP: compare the string length in the matching_id() 2021-03-16 16:43:24 +08:00
acpi_processor.c Intel: ACPI: processor: Export acpi_processor_evaluate_cst() 2021-04-25 14:31:11 +08:00
acpi_tad.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_video.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
acpi_watchdog.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
battery.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
bgrt.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
blacklist.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
bus.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
button.c ACPI: button: Add DMI quirk for Medion Akoya E2228T 2021-03-16 16:41:10 +08:00
cm_sbs.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
container.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
cppc_acpi.c ACPI: CPPC: Replace cppc_attr with kobj_attribute 2021-05-20 16:07:49 +08:00
custom_method.c ACPI: custom_method: fix a possible memory leak 2021-05-20 16:07:19 +08:00
debugfs.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
device_pm.c PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() 2021-03-16 16:43:23 +08:00
device_sysfs.c ACPI: sysfs: Prefer "compatible" modalias 2021-04-12 12:51:42 +08:00
dock.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ec.c ACPI: EC: PM: Drop ec_no_wakeup check from acpi_ec_dispatch_gpe() 2021-03-16 16:39:58 +08:00
ec_sys.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
event.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
evged.c ACPI: GED: fix -Wformat 2021-03-16 16:41:03 +08:00
fan.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
glue.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hed.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
internal.h ACPI: scan: Use unique number for instance_no 2021-04-12 12:53:31 +08:00
ioapic.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
irq.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
numa.c ACPI: Add out of bounds and numa_off protections to pxm_to_node() 2021-03-16 16:39:48 +08:00
nvs.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
osi.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
osl.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pci_irq.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pci_link.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pci_mcfg.c drivers/pci: Add ecam quirk for Ampere Altra SOC. 2021-03-16 16:43:59 +08:00
pci_root.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pci_slot.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
power.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pptt.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
proc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
processor_core.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
processor_driver.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
processor_idle.c Intel: ACPI: processor: Export acpi_processor_evaluate_cst() 2021-04-25 14:31:11 +08:00
processor_pdc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
processor_perflib.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
processor_thermal.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
processor_throttling.c x86: ACPI: fix CPU hotplug deadlock 2021-03-16 16:26:37 +08:00
property.c ACPI: property: Fix fwnode string properties matching 2021-04-12 12:52:32 +08:00
reboot.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
resource.c Revert "ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks" 2021-03-16 16:43:24 +08:00
sbs.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sbshc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sbshc.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
scan.c ACPI: scan: Use unique number for instance_no 2021-04-12 12:53:31 +08:00
sleep.c ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactive 2021-03-16 16:28:06 +08:00
sleep.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
spcr.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sysfs.c ACPI: sysfs: Fix pm_profile_attr type 2021-03-16 16:31:07 +08:00
tables.c ACPI: tables: x86: Reserve memory occupied by ACPI tables 2021-05-20 16:07:17 +08:00
thermal.c ACPI: thermal: Do not call acpi_thermal_check() directly 2021-04-12 12:51:49 +08:00
utils.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
video_detect.c ACPI: video: Add missing callback back for Sony VPCEH3U1E 2021-04-12 12:53:26 +08:00
wakeup.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00