1
0
Fork 0
alistair23-linux/arch/arm
Vincent Whitchurch 47634c0fc9 ARM: 8948/1: Prevent OOB access in stacktrace
[ Upstream commit 40ff1ddb55 ]

The stacktrace code can read beyond the stack size, when it attempts to
read pt_regs from exception frames.

This can happen on normal, non-corrupt stacks.  Since the unwind
information in the extable is not correct for function prologues, the
unwinding code can return data from the stack which is not actually the
caller function address, and if in_entry_text() happens to succeed on
this value, we can end up reading data from outside the task's stack
when attempting to read pt_regs, since there is no bounds check.

Example:

 [<8010e729>] (unwind_backtrace) from [<8010a9c9>] (show_stack+0x11/0x14)
 [<8010a9c9>] (show_stack) from [<8057d8d7>] (dump_stack+0x87/0xac)
 [<8057d8d7>] (dump_stack) from [<8012271d>] (tasklet_action_common.constprop.4+0xa5/0xa8)
 [<8012271d>] (tasklet_action_common.constprop.4) from [<80102333>] (__do_softirq+0x11b/0x31c)
 [<80102333>] (__do_softirq) from [<80122485>] (irq_exit+0xad/0xd8)
 [<80122485>] (irq_exit) from [<8015f3d7>] (__handle_domain_irq+0x47/0x84)
 [<8015f3d7>] (__handle_domain_irq) from [<8036a523>] (gic_handle_irq+0x43/0x78)
 [<8036a523>] (gic_handle_irq) from [<80101a49>] (__irq_svc+0x69/0xb4)
 Exception stack(0xeb491f58 to 0xeb491fa0)
 1f40:                                                       7eb14794 00000000
 1f60: ffffffff 008dd32c 008dd324 ffffffff 008dd314 0000002a 801011e4 eb490000
 1f80: 0000002a 7eb1478c 50c5387d eb491fa8 80101001 8023d09c 40080033 ffffffff
 [<80101a49>] (__irq_svc) from [<8023d09c>] (do_pipe2+0x0/0xac)
 [<8023d09c>] (do_pipe2) from [<ffffffff>] (0xffffffff)
 Exception stack(0xeb491fc8 to 0xeb492010)
 1fc0:                   008dd314 0000002a 00511ad8 008de4c8 7eb14790 7eb1478c
 1fe0: 00511e34 7eb14774 004c8557 76f44098 60080030 7eb14794 00000000 00000000
 2000: 00000001 00000000 ea846c00 ea847cc0

In this example, the stack limit is 0xeb492000, but 16 bytes outside the
stack have been read.

Fix it by adding bounds checks.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-01 13:17:29 +02:00
..
boot ARM: dts: vfxxx: Add syscon compatible with OCOTP 2020-09-17 13:47:55 +02:00
common ARM: scoop: Use the right include 2019-09-03 22:09:46 +02:00
configs scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2020-07-22 09:32:57 +02:00
crypto crypto: arch/nhpoly1305 - process in explicit 4k chunks 2020-05-14 07:58:25 +02:00
include KVM: Pass MMU notifier range flags to kvm_unmap_hva_range() 2020-08-26 10:41:08 +02:00
kernel ARM: 8948/1: Prevent OOB access in stacktrace 2020-10-01 13:17:29 +02:00
kvm kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) 2019-09-04 23:12:50 +09:00
lib ARM: 8958/1: rename missed uaccess .fixup section 2020-03-21 08:11:58 +01:00
mach-actions
mach-alpine
mach-artpec
mach-asm9260
mach-aspeed ARM: SoC fixes 2019-09-30 10:04:28 -07:00
mach-at91 ARM: at91: pm: add missing put_device() call in at91_pm_sram_init() 2020-08-19 08:15:56 +02:00
mach-axxia
mach-bcm ARM: SoC platform updates 2019-07-19 17:05:08 -07:00
mach-berlin
mach-clps711x
mach-cns3xxx
mach-davinci ARM: davinci: select CONFIG_RESET_CONTROLLER 2020-01-23 08:22:32 +01:00
mach-digicolor
mach-dove ARM: orion/mvebu: unify debug-ll virtual addresses 2019-08-14 19:24:58 +02:00
mach-ebsa110
mach-efm32
mach-ep93xx Merge branch 'spi-5.4' into spi-next 2019-09-15 10:32:06 +01:00
mach-exynos ARM: exynos: MCPM: Restore big.LITTLE cpuidle support 2020-08-19 08:15:55 +02:00
mach-footbridge
mach-gemini
mach-highbank ARM: SoC platform updates 2019-07-19 17:05:08 -07:00
mach-hisi
mach-imx ARM: imx6: add missing put_device() call in imx6q_suspend_init() 2020-07-16 08:16:35 +02:00
mach-integrator ARM: integrator: Add some Kconfig selections 2020-06-24 17:50:10 +02:00
mach-iop32x ARM: iop32x: merge everything into mach-iop32x/ 2019-08-14 15:36:22 +02:00
mach-ixp4xx docs: arm: convert docs to ReST and rename to *.rst 2019-07-15 09:20:24 -03:00
mach-keystone ARM: SoC platform updates 2019-07-19 17:05:08 -07:00
mach-lpc18xx
mach-lpc32xx ARM: lpc32xx: allow multiplatform build 2019-08-15 21:34:08 +02:00
mach-mediatek
mach-meson
mach-milbeaut
mach-mmp irqchip/mmp: Mask off interrupts from other cores 2019-08-30 15:23:30 +01:00
mach-moxart
mach-mv78xx0 ARM: orion/mvebu: unify debug-ll virtual addresses 2019-08-14 19:24:58 +02:00
mach-mvebu
mach-mxs
mach-nomadik
mach-npcm ARM: npcm: Bring back GPIOLIB support 2020-02-19 19:53:01 +01:00
mach-nspire ARM: mach-nspire: Kill off CLCD auxdata 2019-08-13 15:48:23 +02:00
mach-omap1 Merge branch 'asoc-5.3' into asoc-linus 2019-09-09 14:55:18 +01:00
mach-omap2 ARM: OMAP2+: use separate IOMMU pdata to fix DRA7 IPU1 boot 2020-07-22 09:32:56 +02:00
mach-orion5x ARM: orion/mvebu: unify debug-ll virtual addresses 2019-08-14 19:24:58 +02:00
mach-oxnas
mach-picoxcell
mach-prima2
mach-pxa ARM: SoC platform updates 2019-07-19 17:05:08 -07:00
mach-qcom
mach-rda
mach-realview
mach-rockchip
mach-rpc ARM: riscpc: Mark expected switch fall-through 2019-08-20 19:42:48 -05:00
mach-s3c24xx docs: arm: convert docs to ReST and rename to *.rst 2019-07-15 09:20:24 -03:00
mach-s3c64xx ARM: s3c64xx: squash samsung_usb_phy.h into setup-usb-phy.c 2019-08-21 19:50:40 +02:00
mach-s5pv210
mach-sa1100 ARM: SoC platform updates 2019-07-19 17:05:08 -07:00
mach-shmobile
mach-socfpga ARM: socfpga: PM: add missing put_device() call in socfpga_setup_ocram_self_refresh() 2020-08-19 08:15:58 +02:00
mach-spear
mach-sti
mach-stm32 ARM: SoC platform updates 2019-07-19 17:05:08 -07:00
mach-sunxi ARM: sunxi: Fix CPU powerdown on A83T 2019-10-29 09:09:56 +01:00
mach-tango
mach-tegra ARM: tegra: Correct PL310 Auxiliary Control Register initialization 2020-06-22 09:31:22 +02:00
mach-u300
mach-uniphier
mach-ux500 ARM: ux500: Stop populating the PRCMU devices early 2019-07-23 09:17:06 +02:00
mach-versatile
mach-vexpress ARM: vexpress: Set-up shared OPP table instead of individual for each CPU 2020-01-12 12:21:17 +01:00
mach-vt8500
mach-zx
mach-zynq ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up 2019-08-14 09:40:43 +02:00
mm ARM: 8978/1: mm: make act_mm() respect THREAD_SIZE 2020-06-22 09:30:56 +02:00
net arm, bpf: Fix offset overflow for BPF_MEM BPF_DW 2020-04-23 10:36:16 +02:00
nwfpe
oprofile
plat-omap ARM: OMAP: dma: Mark expected switch fall-throughs 2019-08-13 04:53:37 -07:00
plat-orion
plat-pxa
plat-samsung ARM: samsung: Fix system restart on S3C6410 2019-09-09 20:54:35 +02:00
plat-versatile
probes
tools docs: arm: convert docs to ReST and rename to *.rst 2019-07-15 09:20:24 -03:00
vdso kbuild: add --hash-style= and --build-id unconditionally 2019-07-17 22:37:51 +09:00
vfp
xen xen: fixes and cleanups for 5.4-rc2 2019-10-04 11:13:09 -07:00
Kconfig ARM: 8951/1: Fix Kexec compilation issue. 2020-02-24 08:36:57 +01:00
Kconfig-nommu
Kconfig.debug ARM updates for 5.4-rc1: 2019-09-22 09:39:09 -07:00
Makefile ARM: 8961/2: Fix Kbuild issue caused by per-task stack protector GCC plugin 2020-03-21 08:11:59 +01:00