diff mbox series

[SRU,K/raspi,1/3] drivers: dwc_otg: stop GCC from patching FIQ functions

Message ID 20221108104632.12140-2-juerg.haefliger@canonical.com
State New
Headers show
Series armhf kernels are compiled with gcc-11 (LP: #1995853) | expand

Commit Message

Juerg Haefliger Nov. 8, 2022, 10:46 a.m. UTC
From: Jonathan Bell <jonathan@raspberrypi.com>

BugLink: https://bugs.launchpad.net/bugs/1995853

Configuring GCC to use task stack protector canaries means it will
insert calls to check functions in FIQ code. This is bad, as a) the
FIQ's stack is banked and b) the failure invokes __stack_chk_fail which
eventually tries to call printk(). Printing to the console inside the
FIQ is generally fatal.

Add CFLAGS to stop this happening in FIQ code.

Also catch one function where notrace wasn't specified.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>

(cherry picked from commit 1a62e5b2363d26320b01d8377ea13dc24a6f32d1 rpi-5.19.y)
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 drivers/usb/host/dwc_otg/Makefile          | 1 +
 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/usb/host/dwc_otg/Makefile b/drivers/usb/host/dwc_otg/Makefile
index 7ea65a6bcdb7..8cbe3e684f26 100644
--- a/drivers/usb/host/dwc_otg/Makefile
+++ b/drivers/usb/host/dwc_otg/Makefile
@@ -28,6 +28,7 @@  ccflags-y   	+= -DDWC_LINUX
 ccflags-y   	+= $(CFI)
 ccflags-y	+= $(BUS_INTERFACE)
 #ccflags-y	+= -DDWC_DEV_SRPCAP
+CFLAGS_dwc_otg_fiq_fsm.o += -fno-stack-protector
 
 obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o
 
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
index f644acbce748..67e277804b2e 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
@@ -142,7 +142,7 @@  inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) { }
  * fiq_fsm_restart_channel() - Poke channel enable bit for a split transaction
  * @channel: channel to re-enable
  */
-static void fiq_fsm_restart_channel(struct fiq_state *st, int n, int force)
+static void notrace fiq_fsm_restart_channel(struct fiq_state *st, int n, int force)
 {
 	hcchar_data_t hcchar = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR) };