[PATCH 6/9] PCI: hotplug: Constify hotplug_slot_ops
Rafael J. Wysocki
rafael at kernel.org
Mon Aug 20 18:10:19 AEST 2018
On Sun, Aug 19, 2018 at 4:36 PM Lukas Wunner <lukas at wunner.de> wrote:
>
> Hotplug drivers cannot declare their hotplug_slot_ops const, making them
> attractive targets for attackers, because upon registration of a hotplug
> slot, __pci_hp_initialize() writes to the "owner" and "mod_name" members
> in that struct.
>
> Fix by moving these members to struct hotplug_slot and constify every
> driver's hotplug_slot_ops except for pciehp.
>
> pciehp constructs its hotplug_slot_ops at runtime based on the PCIe
> port's capabilities, hence cannot declare them const. It can be
> converted to __write_rarely once that's mainlined:
> http://www.openwall.com/lists/kernel-hardening/2016/11/16/3
>
> Signed-off-by: Lukas Wunner <lukas at wunner.de>
> Cc: Rafael J. Wysocki <rjw at rjwysocki.net>
> Cc: Len Brown <lenb at kernel.org>
> Cc: Scott Murray <scott at spiteful.org>
> Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> Cc: Paul Mackerras <paulus at samba.org>
> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Cc: Gavin Shan <gwshan at linux.vnet.ibm.com>
> Cc: Sebastian Ott <sebott at linux.vnet.ibm.com>
> Cc: Gerald Schaefer <gerald.schaefer at de.ibm.com>
> Cc: Corentin Chary <corentin.chary at gmail.com>
> Cc: Darren Hart <dvhart at infradead.org>
> Cc: Andy Shevchenko <andy at infradead.org>
> ---
> drivers/pci/hotplug/acpiphp_core.c | 2 +-
> drivers/pci/hotplug/cpci_hotplug_core.c | 2 +-
> drivers/pci/hotplug/cpqphp_core.c | 2 +-
> drivers/pci/hotplug/ibmphp.h | 2 +-
> drivers/pci/hotplug/ibmphp_core.c | 2 +-
> drivers/pci/hotplug/pci_hotplug_core.c | 27 +++++++++++++------------
> drivers/pci/hotplug/pnv_php.c | 2 +-
> drivers/pci/hotplug/rpaphp.h | 2 +-
> drivers/pci/hotplug/rpaphp_core.c | 2 +-
> drivers/pci/hotplug/s390_pci_hpc.c | 2 +-
> drivers/pci/hotplug/sgi_hotplug.c | 2 +-
> drivers/pci/hotplug/shpchp_core.c | 2 +-
> drivers/pci/pci.c | 4 ++--
> drivers/pci/slot.c | 2 +-
> drivers/platform/x86/asus-wmi.c | 3 +--
> drivers/platform/x86/eeepc-laptop.c | 3 +--
> include/linux/pci_hotplug.h | 10 ++++-----
> 17 files changed, 35 insertions(+), 36 deletions(-)
Nice!
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
More information about the Linuxppc-dev
mailing list