linux/drivers/platform/x86/amd/hsmp
Muralidhara M K d20457b46e
platform/x86/amd/hsmp: Clamp ioctl/send_message indices (Spectre v1)
Although validate_message() checks msg_id, a mispredicted branch can
still allow speculative indexing into hsmp_msg_desc_table[]. Clamp
msg.msg_id with array_index_nospec() at entry to hsmp_ioctl_msg() so
downstream dereferences (including via is_get_msg() and
hsmp_send_message()) see a bounded index.

Similarly, hsmp_send_message() bounds-checks msg->sock_ind before
indexing hsmp_pdev.sock[], but a mispredicted branch can still
speculatively use the raw index (Spectre v1, CVE-2017-5753). Apply
array_index_nospec() after the check so every caller that reaches
hsmp_pdev.sock[] through this helper sees a clamped socket
index—including hsmp_ioctl_msg() and any other path that hands a
user-derived struct hsmp_message to hsmp_send_message().

Reviewed-by: Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>
Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
Link: https://patch.msgid.link/20260612042610.1629037-7-muralidhara.mk@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2026-06-12 15:24:04 +03:00
..
acpi.c platform/x86/amd/hsmp: Replace amd_num_nodes() with topology_max_packages() 2025-10-15 11:53:03 +03:00
hsmp.c platform/x86/amd/hsmp: Clamp ioctl/send_message indices (Spectre v1) 2026-06-12 15:24:04 +03:00
hsmp.h platform/x86/amd/hsmp: Use IS_ENABLED() instead of IS_REACHABLE() 2025-06-09 12:37:02 +03:00
hwmon.c platform-drivers-x86 for v6.16-1 2025-05-29 10:19:22 -07:00
Kconfig platform/x86/amd/hsmp: fix building with CONFIG_HWMON=m 2025-05-25 23:49:03 +03:00
Makefile platform/x86/amd/hsmp: Report power via hwmon sensors 2025-05-12 13:20:17 +03:00
plat.c platform/x86/amd/hsmp: Replace dev_err() with dev_info() for non-fatal errors 2025-08-28 14:53:39 +03:00