openwrtv4/target/linux
André Draszik ace1686200 ramips: mt7620: eMMC: stop invalid memory access if only one device is defined
pdev->id is -1 when only one device exists, and is used:
* as an index into drv_mode[] to determine whether to use
  PIO or DMA mode (via host->id)
* as an index into msdc_6575_host[], to store the
  mmc_priv() data.

Obviously, -1 is not a valid index in either case, causing
us to read invalid memory, and memory corruption,
respectively.

The invalid memory read is causing non-deterministic
behaviour, in particular in the v4.4 kernel it still
picked DMA mode, but in the v4.9 it now always picks
PIO mode.
Also, PIO mode doesn't work, causing the following:

/ # echo 3 > /proc/sys/vm/drop_caches
[ 3845.249237] sh (128): drop_caches: 3

/ # /root/usr/lib/libc.so
[ 3846.096070] do_page_fault(): sending SIGSEGV to libc.so for invalid read access from 7f9cb5a0
[ 3846.104758] epc = 779b0ea4 in libc.so[7792f000+c3000]
[ 3846.109907] ra  = 779a8004 in libc.so[7792f000+c3000]
Segmentation fault

/ # /root/usr/lib/libc.so
musl libc (mipsel-sf)
Version 1.1.16-git-40-g54807d47
Dynamic Program Loader
Usage: /root/usr/lib/libc.so [options] [--] pathname [args]

(i.e. initial page-in of any binary causes a segfault,
subsequent access works.)

While this change doesn't fix PIO mode, it at least makes
us deterministically use DMA (which works), and it also
stops us from corrupting memory.

Signed-off-by: André Draszik <git@andred.net>
2018-04-04 08:29:17 +02:00
..
adm5120 treewide: remove obsolete sysupgrade watchdog kill 2018-02-16 14:44:02 +01:00
adm8668 build: fix subtarget descriptions 2016-09-04 13:35:11 +02:00
apm821xx apm821xx: increase WNDR4700's dtb+kernel partition to 3.5 MiB 2018-03-30 00:30:52 +02:00
ar7 kernel: bump 4.9 to 4.9.82 2018-02-18 02:59:57 +01:00
ar71xx ar71xx: fix ar934x usb controller resource conflict 2018-03-28 23:08:37 +02:00
arc770 arc770: mark as source-only 2017-10-28 13:59:03 +02:00
archs38 kernel: bump 4.14 to 4.14.20 2018-02-18 02:59:48 +01:00
armvirt armvirt: Resync kernel configuration 2018-01-12 15:14:27 -08:00
at91 at91: fix image building with CONFIG_TARGET_MULTI_PROFILE 2018-02-14 15:47:16 +01:00
ath25 build: replace uses of OpenWrt with $(VERSION_DIST) 2018-02-05 10:15:53 +01:00
au1000 treewide: remove obsolete sysupgrade watchdog kill 2018-02-16 14:44:02 +01:00
bcm53xx bcm53xx: switch to kernel 4.14 2018-03-29 15:31:29 +02:00
brcm47xx brcm47xx: add kernel 4.14 support 2018-04-03 22:57:10 +02:00
brcm63xx kernel: update kernel 4.9 to version 4.9.91 2018-03-31 16:31:26 +02:00
brcm2708 kernel: update kernel 4.9 to version 4.9.91 2018-03-31 16:31:26 +02:00
cns3xxx treewide: remove obsolete sysupgrade watchdog kill 2018-02-16 14:44:02 +01:00
gemini kernel: Update kernel 4.4 to 4.4.100 2017-11-25 19:48:39 +01:00
generic kernel: update kernel 4.14 to 4.14.32 2018-04-03 23:26:45 +02:00
imx6 kernel: generic: Move config option to generic 2018-03-02 21:32:19 +01:00
ipq40xx Kernel: bump 4.14 to 4.14.29 2018-03-23 23:49:55 +01:00
ipq806x ipq806x: add support for Compex WPQ864 2018-03-15 08:17:10 +01:00
ixp4xx kernel: update kernel 4.9 to version 4.9.91 2018-03-31 16:31:26 +02:00
kirkwood kirkwood: fix initramfs boot warning on iconnect 2018-03-20 21:45:27 +01:00
lantiq kernel: update kernel 4.14 to 4.14.32 2018-04-03 23:26:45 +02:00
layerscape kernel: update kernel 4.9 to version 4.9.91 2018-03-31 16:31:26 +02:00
malta malta: bump tp v4.14 2018-01-09 10:26:16 +01:00
mcs814x build: replace uses of OpenWrt with $(VERSION_DIST) 2018-02-05 10:15:53 +01:00
mediatek kernel: update kernel 4.14 to 4.14.32 2018-04-03 23:26:45 +02:00
mpc85xx kernel: bump 4.9 to 4.9.82 2018-02-18 02:59:57 +01:00
mvebu kernel: update kernel 4.14 to 4.14.32 2018-04-03 23:26:45 +02:00
mxs mxs: drop support for 4.9 2018-02-20 13:25:00 +01:00
octeon octeon: switch to kernel 4.14 2018-02-08 19:04:38 +01:00
octeontx octeontx: use the generic board detection 2018-02-23 08:21:50 +01:00
omap omap: clean up configuration 2017-10-18 21:46:05 +02:00
omap24xx omap24xx: remove referece to not existing kmod-usb-musb-tusb6010 2018-01-15 13:13:34 +01:00
orion orion: Switch to 4.9 kernel 2017-10-24 18:39:17 -07:00
oxnas kernel: bump 4.4 to 4.4.119 2018-03-03 12:58:56 +01:00
pistachio pistachio: remove kernel 4.9 support 2018-03-31 16:13:19 +02:00
ppc40x treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
ppc44x ppc44x: mark as broken 2017-01-10 12:49:34 +01:00
ramips ramips: mt7620: eMMC: stop invalid memory access if only one device is defined 2018-04-04 08:29:17 +02:00
rb532 treewide: move nand_do_upgrade call to platform_do_upgrade 2018-02-16 14:44:02 +01:00
sunxi sunxi: add build for sopine 2018-03-23 23:53:20 +01:00
uml uml: Remove 4.4 patches 2018-03-08 11:44:26 -08:00
x86 x86: Use kernel 4.14 by default 2018-02-18 19:51:58 +01:00
xburst target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
zynq target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
Makefile