1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-13 10:49:13 +02:00
openwrt/package
Mathias Kresin 87b8f095af uboot-lantiq: fix out of bounds cache invalidate
With gcc10 the variables are placed more tightly to each other, which
uncovers a long existing bug in the lantiq DMA code. It can be observed
when using tftpboot with the filename parameter, which gets reset during
the tftpboot execution.

NetRxPackets[] points to cache line size aligned addresses. In
ltq_eth_rx_packet_align() the address NetRxPackets[] points to is
increased by LTQ_ETH_IP_ALIGN and the resulting not cache aligned
address is used further on. While doing so, the length/size is never
updated.

The "not cache aligned address" + len/size for a cache aligned address
is passed to invalidate_dcache_range(). Hence, invalidate_dcache_range()
invalidates the next 32 bit as well, which flashes the BootFile variable
as well.

   variable BootFile is at address: 0x83ffe12c
   NetRxPackets[] points to 0x83ffdb20 (len is 0x600)
   data points to: 0x83ffdb22 (len is 0x600)

   ltq_dma_dcache_inv: 0x83ffdb22 (for len 0x600)
   invalidate_dcache_range: 0x83ffdb20 to 0x83ffe120 (size: 32)
   invalidate_dcache_range: 0x83ffdb20 to 0x83ffdb40 (Bootfile: a.bin)
   ...
   invalidate_dcache_range: 0x83ffe100 to 0x83ffe120 (Bootfile: a.bin)
   invalidate_dcache_range: 0x83ffe120 to 0x83ffe140 (Bootfile: )

In ltq_dma_tx_map() and ltq_dma_rx_map() the start address passed to
ltq_dma_dcache_wb_inv() is incorrect. By considering the offset, the
start address passed to flush_dcache_range() is always aligned to 32, 64
or 128 bytes dependent on configured DMA burst size.

Fixes: FS#4113

Signed-off-by: Mathias Kresin <dev@kresin.me>
2021-11-14 20:15:35 +01:00
..
base-files base-files: stage2: improve /proc/*/stat parser 2021-11-13 18:36:52 +00:00
boot uboot-lantiq: fix out of bounds cache invalidate 2021-11-14 20:15:35 +01:00
devel gdb: Make only full gdb depend on libgmp 2021-11-07 18:32:21 +01:00
firmware ipq40xx: add support for P&W R619AC (aka G-DOCK 2.0) 2021-11-14 14:28:34 +01:00
kernel mac80211: Fix deadlock when configuring wifi 2021-11-13 19:09:22 +01:00
libs libubox: bump to git HEAD 2021-11-04 13:18:13 +02:00
network qosify: add missing alias support in the init script 2021-11-14 19:36:34 +01:00
system procd: update to git HEAD 2021-11-11 14:09:25 +00:00
utils f2fstools: set each library package VARIANT 2021-11-01 20:18:55 +01:00
Makefile build: fix opkg install step for large package selection 2021-05-12 11:13:53 +02:00