OpenWrt/LEDE Project

  • Status Unconfirmed
  • Percent Complete
    0%
  • Task Type Bug Report
  • Category Kernel
  • Assigned To No-one
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version Trunk
  • Due in Version Undecided
  • Due Date Undecided
  • Private
Attached to Project: OpenWrt/LEDE Project
Opened by Anton R - 31.10.2020

FS#3416 - Kernel Oops on mtd_block_markbad

I’m trying to install snapshot version onto my Asus RT-AC65P router. The device has a broken (but not marked as bad) block in the end of `ubi` (`mtd5`) partition.

With `squashfs-factory.bin` router boots only once and then falls into restarts loop — I assume it can’t initialize overlayfs after it was resized during first boot.

`initramfs-kernel.bin` doesn’t touch that block and works fine.

To isolate the root cause I’ve used simple C code (adopted from `nandtest.c`):

#include <fcntl.h>
#include <sys/ioctl.h>
#include <mtd/mtd-abi.h>

int main(void) {
    int fd = open("/dev/mtd5", O_RDWR);
    __kernel_loff_t offset = 18612224;  // Bad block offset
    ioctl(fd, MEMSETBADBLOCK, &offset);
}

That caused a Kernel Oops. With `cat /dev/kmsg` I caught that message:

mt7621-nand 1e003000.nand: Using programmed access timing: 31c07388
 SUBSYSTEM=platform
 DEVICE=+platform:1e003000.nand
mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
 SUBSYSTEM=platform
 DEVICE=+platform:1e003000.nand
CPU 2 Unable to handle kernel paging request at virtual address 00000000, epc == 80382d4c, ra == 80378d94
Oops[#1]:
CPU: 2 PID: 2168 Comm: do_mark Not tainted 5.4.72 #0
$ 0   : 00000000 00000001 80382f24 00000800
$ 4   : 8fc33898 00000000 00000001 00003340
$ 8   : 00000000 00000000 00000001 00001cb3
$12   : 00000061 00000016 00000000 00061916
$16   : 8fc33898 00003340 8fc79c00 00000000
$20   : 00000000 00000000 00000000 00000000
$24   : 00000002 00000000
$28   : 8fc78000 8fc79ba8 7fbf3d48 80378d94
Hi    : 00001cb3
Lo    : 156422a6
epc   : 80382d4c mt7621_nfc_write_page_hwecc+0xc/0x1e4
ra    : 80378d94 nand_do_write_oob+0x154/0x1f0
Status: 11007c03\x09KERNEL EXL IE
Cause : 40800008 (ExcCode 02)
BadVA : 00000000
PrId  : 0001992f (MIPS 1004Kc)
Modules linked in: pppoe ppp_async iptable_nat xt_state xt_nat xt_conntrack xt_REDIRECT xt_MASQUERADE xt_FLOWOFFLOAD pppox ppp_generic nf_nat nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack mt7615e mt7615_common mt76 mac80211 ipt_REJECT cfg80211 xt_time xt_tcpudp xt_multiport xt_mark xt_mac xt_limit xt_comment xt_TCPMSS xt_LOG slhc nf_reject_ipv4 nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 iptable_mangle iptable_filter ip_tables crc_ccitt compat ledtrig_heartbeat nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 leds_gpio xhci_plat_hcd xhci_pci xhci_mtk xhci_hcd gpio_button_hotplug usbcore nls_base usb_common
Process do_mark (pid: 2168, threadinfo=b8383f48, task=7d7cf08b, tls=77e2bec8)
Stack : 806c0000 00000001 8e77b000 8fc79bf0 8fc79c14 80096104 8fc33898 00000000
        00000000 00000000 019a0000 8e77b000 77e11cf8 80378f08 00000000 8086b180
        8e77b000 00000001 8fc79c00 00000000 0000958e 80090000 00000000 00000001
        00000000 00000001 00000000 00000000 00000000 8fc79bfc 8fc33898 00000000
        019a0000 00000000 8086b180 8037ac0c 00008d8d 00000000 00000001 ffff00fe
        ...
Call Trace:
[<80382d4c>] mt7621_nfc_write_page_hwecc+0xc/0x1e4
Code: 8c83001c  1060000e  00000000 <90a60000> 240200ff  14c2001c  24a20001  00a31821  10000004

---[ end trace a9254e578443d1f4 ]---
Anton R commented on 01.11.2020 00:02

Proposed solution: https://github.com/openwrt/openwrt/pull/3552

I'm not sure about potential corner cases of that solution, but that worked for me, marked block successfully.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing