Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detected buffer overflow in __fortify_strlen #101

Open
andreas-schwab opened this issue May 15, 2023 · 4 comments
Open

detected buffer overflow in __fortify_strlen #101

andreas-schwab opened this issue May 15, 2023 · 4 comments

Comments

@andreas-schwab
Copy link
Contributor

Trying to boot the visionfive2 patches rebased on top of 6.4.0-rc2:

https://download.opensuse.org/repositories/devel:/RISCV:/Factory:/Contrib:/StarFive:/VisionFive2/standard/

Loading Linux 6.4.0-rc2-33-default ...
Loading initial ramdisk ...
EFI stub: Booting Linux Kernel...
EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
[ 0.000000][ T0] Linux version 6.4.0-rc2-33-default (geeko@buildhost) (gcc (SUSE Linux) 13.0.1 20230421 (prerelease) [revision f980561c60b0446cc427595198d7f3f4f90e0924], GNU ld (GNU Binutils; openSUSE Tumbleweed) 2.40.0.20230412-4) #1 SMP Sun May 14 21:09:47 UTC 2023 (679133f)
[ 0.000000][ T0] Machine model: StarFive VisionFive 2 v1.2A
[ 0.000000][ T0] printk: debug: ignoring loglevel setting.
[ 0.000000][ T0] efi: EFI v2.8 by Das U-Boot
[ 0.000000][ T0] efi: RTPROP=0xfe71f040 SMBIOS=0xfe71b000 INITRD=0xf76c7040 MEMRESERVE=0xf76c6040
[ 0.000000][ T0] cma: Reserved 16 MiB at 0x00000000fee00000
[ 0.000000][ T0] NUMA: No NUMA configuration found
[ 0.000000][ T0] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[ 0.000000][ T0] NUMA: NODE_DATA [mem 0x13ffd21c0-0x13ffd3fff]
[ 0.000000][ T0] Zone ranges:
[ 0.000000][ T0] DMA32 [mem 0x0000000040000000-0x00000000ffffffff]
[ 0.000000][ T0] Normal [mem 0x0000000100000000-0x000000013fffffff]
[ 0.000000][ T0] Movable zone start for each node
[ 0.000000][ T0] Early memory node ranges
[ 0.000000][ T0] node 0: [mem 0x0000000040000000-0x000000004007ffff]
[ 0.000000][ T0] node 0: [mem 0x0000000040080000-0x00000000fe71afff]
[ 0.000000][ T0] node 0: [mem 0x00000000fe71b000-0x00000000fe71bfff]
[ 0.000000][ T0] node 0: [mem 0x00000000fe71c000-0x00000000fe71efff]
[ 0.000000][ T0] node 0: [mem 0x00000000fe71f000-0x00000000fe721fff]
[ 0.000000][ T0] node 0: [mem 0x00000000fe722000-0x00000000fe722fff]
[ 0.000000][ T0] node 0: [mem 0x00000000fe723000-0x00000000fe726fff]
[ 0.000000][ T0] node 0: [mem 0x00000000fe727000-0x00000000fff45fff]
[ 0.000000][ T0] node 0: [mem 0x00000000fff46000-0x00000000fff46fff]
[ 0.000000][ T0] node 0: [mem 0x00000000fff47000-0x000000013fffffff]
[ 0.000000][ T0] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[ 0.000000][ T0] SBI specification v1.0 detected
[ 0.000000][ T0] SBI implementation ID=0x1 Version=0x10002
[ 0.000000][ T0] SBI TIME extension detected
[ 0.000000][ T0] SBI IPI extension detected
[ 0.000000][ T0] SBI RFENCE extension detected
[ 0.000000][ T0] SBI SRST extension detected
[ 0.000000][ T0] SBI HSM extension detected
[ 0.000000][ T0] CPU with hartid=0 is not available
[ 0.000000][ T0] CPU with hartid=0 is not available
[ 0.000000][ T0] CPU with hartid=0 is not available
[ 0.000000][ T0] CPU with hartid=0 is not available
[ 0.000000][ T0] riscv: base ISA extensions acdfim
[ 0.000000][ T0] riscv: ELF capabilities acdfim
[ 0.000000][ T0] percpu: cpu 0 has no node -1 or node-local memory
[ 0.000000][ T0] percpu: Embedded 30 pages/cpu s82792 r8192 d31896 u122880
[ 0.000000][ T0] pcpu-alloc: s82792 r8192 d31896 u122880 alloc=30*4096
[ 0.000000][ T0] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000][ T0] Kernel command line: BOOT_IMAGE=/boot/Image-6.4.0-rc2-33-default root=UUID=6e7ecee4-dd8d-4a6b-b47e-9cdc6656e699 ignore_loglevel splash=silent systemd.show_status=1 console=ttyS0,115200n8
[ 0.000000][ T0] Unknown kernel command line parameters "BOOT_IMAGE=/boot/Image-6.4.0-rc2-33-default splash=silent", will be passed to user space.
[ 0.000000][ T0] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[ 0.000000][ T0] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[ 0.000000][ T0] Fallback order for Node 0: 0
[ 0.000000][ T0] Built 1 zonelists, mobility grouping on. Total pages: 1032192
[ 0.000000][ T0] Policy zone: Normal
[ 0.000000][ T0] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000][ T0] software IO TLB: area num 4.
[ 0.000000][ T0] software IO TLB: mapped [mem 0x00000000fa71b000-0x00000000fe71b000] (64MB)
[ 0.000000][ T0] Memory: 3140400K/4194304K available (10171K kernel code, 5871K rwdata, 10240K rodata, 2602K init, 1033K bss, 226040K reserved, 16384K cma-reserved)
[ 0.000000][ T0] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000][ T0] ftrace: allocating 37617 entries in 147 pages
[ 0.000000][ T0] ftrace: allocated 147 pages with 4 groups
[ 0.000000][ T0] trace event string verifier disabled
[ 0.000000][ T0] rcu: Hierarchical RCU implementation.
[ 0.000000][ T0] rcu: RCU restricting CPUs from NR_CPUS=32 to nr_cpu_ids=4.
[ 0.000000][ T0] Rude variant of Tasks RCU enabled.
[ 0.000000][ T0] Tracing variant of Tasks RCU enabled.
[ 0.000000][ T0] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000][ T0] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[ 0.000000][ T0] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000][ T0] CPU with hartid=0 is not available
[ 0.000000][ T0] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller
[ 0.000000][ T0] riscv-intc: 64 local interrupts mapped
[ 0.000000][ T0] plic: interrupt-controller@c000000: mapped 136 interrupts with 4 handlers for 9 contexts.
[ 0.000000][ T0] riscv: providing IPIs using SBI IPI extension
[ 0.000000][ T0] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[ 0.000000][ T0] riscv-timer: riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[ 0.000000][ T0] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 881590404240 ns
[ 0.000001][ T0] sched_clock: 64 bits at 4MHz, resolution 250ns, wraps every 2199023255500ns
[ 0.000430][ T0] Console: colour dummy device 80x25
[ 0.000666][ T0] Calibrating delay loop (skipped), value calculated using timer frequency.. 8.00 BogoMIPS (lpj=40000)
[ 0.000681][ T0] pid_max: default: 32768 minimum: 301
[ 0.001186][ T0] LSM: initializing lsm=lockdown,capability,landlock,yama,apparmor,tomoyo,bpf,integrity
[ 0.001236][ T0] landlock: Up and running.
[ 0.001240][ T0] Yama: becoming mindful.
[ 0.001413][ T0] AppArmor: AppArmor initialized
[ 0.001423][ T0] TOMOYO Linux initialized
[ 0.001456][ T0] LSM support for eBPF active
[ 0.001893][ T0] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.001974][ T0] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.004103][ T1] CPU node for /cpus/cpu@0 exist but the possible cpu range is :0-3
[ 0.005471][ T1] cblist_init_generic: Setting adjustable number of callback queues.
[ 0.005484][ T1] cblist_init_generic: Setting shift to 2 and lim to 1.
[ 0.005616][ T1] cblist_init_generic: Setting shift to 2 and lim to 1.
[ 0.005795][ T1] riscv: ELF compat mode unsupported
[ 0.005806][ T1] ASID allocator disabled (0 bits)
[ 0.005945][ T1] rcu: Hierarchical SRCU implementation.
[ 0.005951][ T1] rcu: Max phase no-delay instances is 1000.
[ 0.006814][ T1] Remapping and enabling EFI services.
[ 0.007533][ T1] smp: Bringing up secondary CPUs ...
[ 0.010755][ T1] smp: Brought up 1 node, 4 CPUs
[ 0.040257][ T37] node 0 deferred pages initialised in 30ms
[ 0.042482][ T1] devtmpfs: initialized
[ 0.051363][ T1] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.051385][ T1] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.052337][ T1] pinctrl core: initialized pinctrl subsystem
[ 0.054453][ T1] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.055344][ T1] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[ 0.055430][ T1] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[ 0.055540][ T1] audit: initializing netlink subsys (disabled)
[ 0.055804][ T41] audit: type=2000 audit(0.050:1): state=initialized audit_enabled=0 res=1
[ 0.056402][ T1] thermal_sys: Registered thermal governor 'fair_share'
[ 0.056410][ T1] thermal_sys: Registered thermal governor 'bang_bang'
[ 0.056415][ T1] thermal_sys: Registered thermal governor 'step_wise'
[ 0.056420][ T1] thermal_sys: Registered thermal governor 'user_space'
[ 0.056466][ T1] cpuidle: using governor ladder
[ 0.056486][ T1] cpuidle: using governor menu
[ 0.056950][ T1] Serial: AMBA PL011 UART driver
[ 0.060708][ T1] platform soc: Fixed dependency cycle(s) with /soc/interrupt-controller@c000000
[ 0.072574][ T1] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[ 0.072583][ T1] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[ 0.072590][ T1] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[ 0.072595][ T1] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[ 0.095189][ T1] iommu: Default domain type: Passthrough
[ 0.095877][ T1] SCSI subsystem initialized
[ 0.096122][ T1] libata version 3.00 loaded.
[ 0.096418][ T1] EDAC MC: Ver: 3.0.0
[ 0.096779][ T1] efivars: Registered efivars operations
[ 0.098326][ T1] NetLabel: Initializing
[ 0.098331][ T1] NetLabel: domain hash size = 128
[ 0.098336][ T1] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
[ 0.098425][ T1] NetLabel: unlabeled traffic allowed by default
[ 0.098450][ T1] mctp: management component transport protocol core
[ 0.098455][ T1] NET: Registered PF_MCTP protocol family
[ 0.098689][ T1] vgaarb: loaded
[ 0.099044][ T1] clocksource: Switched to clocksource riscv_clocksource
[ 0.165851][ T1] VFS: Disk quotas dquot_6.6.0
[ 0.165966][ T1] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.167127][ T1] AppArmor: AppArmor Filesystem Enabled
[ 0.180153][ T1] NET: Registered PF_INET protocol family
[ 0.180798][ T1] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[ 0.187436][ T1] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[ 0.187510][ T1] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.187532][ T1] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.187981][ T1] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[ 0.189727][ T1] TCP: Hash tables configured (established 32768 bind 32768)
[ 0.190373][ T1] MPTCP token hash table entries: 4096 (order: 4, 98304 bytes, linear)
[ 0.190532][ T1] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[ 0.190653][ T1] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[ 0.191081][ T1] NET: Registered PF_UNIX/PF_LOCAL protocol family
[ 0.191176][ T1] NET: Registered PF_XDP protocol family
[ 0.191194][ T1] PCI: CLS 0 bytes, default 64
[ 0.191512][ T10] Trying to unpack rootfs image as initramfs...
[ 0.193330][ T1] Initialise system trusted keyrings
[ 0.193435][ T1] Key type blacklist registered
[ 0.193724][ T1] workingset: timestamp_bits=44 max_order=20 bucket_order=0
[ 0.193828][ T1] zbud: loaded
[ 0.195000][ T1] integrity: Platform Keyring initialized
[ 0.195059][ T1] integrity: Machine keyring initialized
[ 0.233990][ T1] Key type asymmetric registered
[ 0.234004][ T1] Asymmetric key parser 'x509' registered
[ 1.419562][ T10] Freeing initrd memory: 23072K
[ 1.450312][ T1] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 1.450525][ T1] io scheduler mq-deadline registered
[ 1.450534][ T1] io scheduler kyber registered
[ 1.450634][ T1] io scheduler bfq registered
[ 1.463234][ T1] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[ 1.468007][ C0] CCACHE: DataError @ 0x00000000.08040140
[ 1.468071][ C0] CCACHE: DataFail @ 0x00000000.0804005B
[ 1.468182][ T1] CCACHE: 8 banks, 16 ways, sets/bank=256, bytes/block=64
[ 1.468190][ T1] CCACHE: Index of the largest way enabled: 15
[ 1.469478][ T1] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[ 1.477445][ T1] Serial: AMBA driver
[ 1.480108][ T1] mousedev: PS/2 mouse device common for all mice
[ 1.480992][ T1] EDAC DEVICE0: Giving out device to module Sifive ECC Manager controller sifive_edac.0: DEV sifive_edac.0 (INTERRUPT)
[ 1.481405][ T1] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.481783][ T1] clocksource: 13050000.timer.ch0: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 1.481918][ T1] clocksource: 13050000.timer.ch1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 1.482073][ T1] clocksource: 13050000.timer.ch2: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 1.482213][ T1] clocksource: 13050000.timer.ch3: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 1.482346][ T1] hid: raw HID events driver (C) Jiri Kosina
[ 1.482550][ T1] riscv-pmu-sbi: SBI PMU extension is available
[ 1.482572][ T1] riscv-pmu-sbi: 16 firmware and 4 hardware counters
[ 1.482579][ T1] riscv-pmu-sbi: Perf sampling/filtering is not supported as sscof extension is not available
[ 1.531345][ T1] NET: Registered PF_INET6 protocol family
[ 1.555157][ T1] Segment Routing with IPv6
[ 1.555167][ T1] RPL Segment Routing with IPv6
[ 1.555269][ T1] In-situ OAM (IOAM) with IPv6
[ 1.563521][ T1] registered taskstats version 1
[ 1.564197][ T1] Loading compiled-in X.509 certificates
[ 1.663651][ T1] Loaded X.509 cert 'devel:RISCV OBS Project: ff4518087de2ecc08d771ea82bedd751db86f8fc'
[ 1.675336][ T1] Key type .fscrypt registered
[ 1.675344][ T1] Key type fscrypt-provisioning registered
[ 1.697015][ T1] Key type encrypted registered
[ 1.697039][ T1] AppArmor: AppArmor sha1 policy hashing enabled
[ 1.697169][ T1] ima: No TPM chip found, activating TPM-bypass!
[ 1.697229][ T1] Loading compiled-in module X.509 certificates
[ 1.698343][ T1] Loaded X.509 cert 'devel:RISCV OBS Project: ff4518087de2ecc08d771ea82bedd751db86f8fc'
[ 1.698355][ T1] ima: Allocated hash algorithm: sha256
[ 1.698421][ T1] ima: No architecture policies found
[ 1.698528][ T1] evm: Initialising EVM extended attributes:
[ 1.698533][ T1] evm: security.selinux
[ 1.698538][ T1] evm: security.SMACK64 (disabled)
[ 1.698542][ T1] evm: security.SMACK64EXEC (disabled)
[ 1.698547][ T1] evm: security.SMACK64TRANSMUTE (disabled)
[ 1.698551][ T1] evm: security.SMACK64MMAP (disabled)
[ 1.698555][ T1] evm: security.apparmor
[ 1.698559][ T1] evm: security.ima
[ 1.698563][ T1] evm: security.capability
[ 1.698567][ T1] evm: HMAC attrs: 0x1
[ 2.458760][ T1] clk: Disabling unused clocks
[ 2.459014][ T1] Warning: unable to open an initial console.
[ 2.466501][ T1] Freeing unused kernel image (initmem) memory: 2600K
[ 2.489109][ T1] Run /init as init process
[ 2.489117][ T1] with arguments:
[ 2.489122][ T1] /init
[ 2.489127][ T1] with environment:
[ 2.489132][ T1] HOME=/
[ 2.489137][ T1] TERM=linux
[ 2.489142][ T1] BOOT_IMAGE=/boot/Image-6.4.0-rc2-33-default
[ 2.489147][ T1] splash=silent
[ 2.524469][ T1] systemd[1]: System time before build time, advancing clock.
[ 2.572535][ T1] systemd[1]: systemd 253.4+suse.28.g25aec15788 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA -SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
[ 2.572565][ T1] systemd[1]: Detected architecture riscv64.
[ 2.572578][ T1] systemd[1]: Running in initrd.
[ 2.573369][ T1] systemd[1]: Hostname set to .
[ 2.949149][ T1] systemd[1]: /usr/lib/systemd/system/plymouth-start.service:15: Unit uses KillMode=none. This is unsafe, as it disables systemd's process lifecycle management for the service. Please update the service to use a safer KillMode=, such as 'mixed' or 'control-group'. Support for KillMode=none is deprecated and will eventually be removed.
[ 3.024986][ T1] systemd[1]: Queued start job for default target Initrd Default Target.
[ 3.081115][ T1] systemd[1]: Reached target Initrd /usr File System.
[ 3.081520][ T1] systemd[1]: Reached target Local File Systems.
[ 3.081717][ T1] systemd[1]: Reached target Slice Units.
[ 3.081904][ T1] systemd[1]: Reached target Swaps.
[ 3.082072][ T1] systemd[1]: Reached target Timer Units.
[ 3.082817][ T1] systemd[1]: Listening on Journal Socket (/dev/log).
[ 3.083588][ T1] systemd[1]: Listening on Journal Socket.
[ 3.084358][ T1] systemd[1]: Listening on udev Control Socket.
[ 3.084947][ T1] systemd[1]: Listening on udev Kernel Socket.
[ 3.085088][ T1] systemd[1]: Reached target Socket Units.
[ 3.091137][ T1] systemd[1]: Starting Create List of Static Device Nodes...
[ 3.099858][ T1] systemd[1]: Starting Journal Service...
[ 3.105426][ T1] systemd[1]: Starting Load Kernel Modules...
[ 3.110203][ T1] systemd[1]: Starting Setup Virtual Console...
[ 3.114225][ T1] systemd[1]: Finished Create List of Static Device Nodes.
[ 3.124363][ T1] systemd[1]: Starting Create Static Device Nodes in /dev...
[ 3.154410][ T182] alua: device handler registered
[ 3.161572][ T182] emc: device handler registered
[ 3.163166][ T1] systemd[1]: Finished Create Static Device Nodes in /dev.
[ 3.170527][ T181] systemd-journald[181]: Collecting audit messages is disabled.
[ 3.172912][ T182] rdac: device handler registered
[ 3.205725][ T1] systemd[1]: Started Journal Service.
[ 3.379144][ T182] device-mapper: core: CONFIG_IMA_DISABLE_HTABLE is disabled. Duplicate IMA measurements will not be recorded in the IMA log.
[ 3.379365][ T182] device-mapper: uevent: version 1.0.3
[ 3.379770][ T182] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: [email protected]
[ 4.537705][ T300] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 4.570533][ T300] starfive-jh7110-sys-pinctrl 13040000.pinctrl: StarFive GPIO chip registered 64 GPIOs
[ 4.574203][ T10] printk: console [ttyS0] disabled
[ 4.574291][ T10] 10000000.serial: ttyS0 at MMIO 0x10000000 (irq = 26, base_baud = 1500000) is a 16550A
[ 4.574338][ T10] printk: console [ttyS0] enabled
[ 4.625866][ T292] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 4.712357][ T307] detected buffer overflow in __fortify_strlen
[ 4.720071][ T10] jh7110-usb-phy 10200000.phy: error -ENOENT: Failed to get app 125m clock
[ 4.724368][ C1] ------------[ cut here ]------------
[ 4.724372][ C1] kernel BUG at lib/string_helpers.c:1027!
[ 4.724380][ C1] Kernel BUG [#1]
[ 4.724384][ C1] Modules linked in: pcie_starfive(+) pinctrl_starfive_jh7110_aon(+) clk_starfive_jh7110_isp(+) clk_starfive_jh7110_vout(+) spi_cadence_quadspi(+) clk_starfive_jh7110_aon starfive_wdt crypto_engine sfctemp phy_jh7110_usb pwm_starfive_ptc pinctrl_starfive_jh7110_sys clk_starfive_jh7110_stg phy_jh7110_pcie ledtrig_heartbeat sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua efivarfs
[ 4.724466][ C1] CPU: 1 PID: 307 Comm: (udev-worker) Not tainted 6.4.0-rc2-33-default #1 openSUSE Tumbleweed (unreleased) df30a95821602932b20170b723cb92a07fcb3621
[ 4.724478][ C1] Hardware name: StarFive VisionFive 2 v1.2A (DT)
[ 4.724483][ C1] epc : fortify_panic+0x1a/0x1c
[ 4.724499][ C1] ra : fortify_panic+0x1a/0x1c
[ 4.724507][ C1] epc : ffffffff809e0a1c ra : ffffffff809e0a1c sp : ffffffc804393660
[ 4.724513][ C1] gp : ffffffff81c44ad0 tp : ffffffd8c0aed640 t0 : 2000000000000000
[ 4.724519][ C1] t1 : 0000000000000020 t2 : 20202065646f6e20 s0 : ffffffc804393670
[ 4.724524][ C1] s1 : 0000000000000020 a0 : 000000000000002c a1 : ffffffd8fdf54700
[ 4.724530][ C1] a2 : ffffffd8fdf60ee8 a3 : 0000000000000000 a4 : 0000000000000000
[ 4.724535][ C1] a5 : 0000000000000000 a6 : ffffffff81cb6b60 a7 : 0000000000000001
[ 4.724540][ C1] s2 : ffffffff80f2d750 s3 : ffffffd8c613fc08 s4 : 000000000000001f
[ 4.724545][ C1] s5 : 0000000000000000 s6 : ffffffff81c45cf8 s7 : 0000000000ffffff
[ 4.724551][ C1] s8 : ffffffd8c613eab0 s9 : 0000000000000011 s10: ffffffff020b02a0
[ 4.724556][ C1] s11: ffffffff020b0450 t3 : ffffffff81c59fa7 t4 : ffffffff81c59fa7
[ 4.724562][ C1] t5 : ffffffff81c59fa8 t6 : ffffffff81c59fa7
[ 4.724566][ C1] status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[ 4.724573][ C1] [] fortify_panic+0x1a/0x1c
[ 4.724583][ C1] [] auxiliary_match_id+0x70/0xcc
[ 4.724598][ C1] [] auxiliary_match+0x1e/0x2a
[ 4.724610][ C1] [] __device_attach_driver+0x2c/0xe4
[ 4.724624][ C1] [] bus_for_each_drv+0x68/0xbe
[ 4.724633][ C1] [] __device_attach+0x94/0x18a
[ 4.724643][ C1] [] device_initial_probe+0x1a/0x22
[ 4.724653][ C1] [] bus_probe_device+0x96/0x98
[ 4.724662][ C1] [] device_add+0x5b2/0x782
[ 4.724671][ C1] [] __auxiliary_device_add+0x40/0x96
[ 4.724683][ C1] [] jh7110_reset_controller_register+0x92/0xe4
[ 4.724699][ C1] [] jh7110_voutcrg_probe+0x238/0x326 [clk_starfive_jh7110_vout]
[ 4.724740][ C1] [] platform_probe+0x5e/0xba
[ 4.724752][ C1] [] really_probe+0xa0/0x35a
[ 4.724761][ C1] [] __driver_probe_device+0x7a/0x138
[ 4.724772][ C1] [] driver_probe_device+0x38/0xc6
[ 4.724782][ C1] [] __driver_attach+0xd0/0x1b8
[ 4.724791][ C1] [] bus_for_each_dev+0x64/0xb2
[ 4.724801][ C1] [] driver_attach+0x26/0x2e
[ 4.724810][ C1] [] bus_add_driver+0x108/0x20a
[ 4.724819][ C1] [] driver_register+0x52/0xf4
[ 4.724829][ C1] [] __platform_driver_register+0x28/0x30
[ 4.724841][ C1] [] jh7110_voutcrg_driver_init+0x28/0x1000 [clk_starfive_jh7110_vout]
[ 4.724872][ C1] [] do_one_initcall+0x3c/0x1b4
[ 4.724882][ C1] [] do_init_module+0x5e/0x21a
[ 4.724893][ C1] [] load_module+0x1896/0x1df6
[ 4.724902][ C1] [] __do_sys_init_module+0x150/0x176
[ 4.724912][ C1] [] sys_init_module+0x18/0x20
[ 4.724922][ C1] [] do_trap_ecall_u+0xee/0x102
[ 4.724934][ C1] [] ret_from_exception+0x0/0x64
[ 4.724954][ C1] Code: 0800 85aa 3517 0083 0513 93c5 a097 ffff 80e7 db60 (9002) 7179
[ 4.724961][ C1] ---[ end trace 0000000000000000 ]---
[ 4.724967][ C1] Kernel panic - not syncing: Fatal exception in interrupt
[ 4.724971][ C1] SMP: stopping secondary CPUs

@leifhelm
Copy link

I have the same problem when trying to boot NixOS with the 6.4-rc2 starfive kernel.

[   21.887188] detected buffer overflow in __fortify_strlen
[   21.892630] ------------[ cut here ]------------
[   21.892634] kernel BUG at lib/string_helpers.c:1027!
[   21.892641] Kernel BUG [#1]
[   21.892645] Modules linked in: starfive_wdt(+) phy_starfive_dphy_rx(+) cdns3_starfive(+) pcie_starfive(+) clk_starfive_jh7110_vout(+) usb_common dw_axi_dmac_platform(+) watchdog clk_starfive_jh7110_isp(+) pps_core spi_cadence_quadspi(+) pinctrl_starfive_jh7110_aon led_class jh7110_crypto jh7110_trng rng_core i2c_designware_platform sfctemp crypto_engine i2c_designware_core xt_conntrack clk_starfive_jh7110_stg soundcore phy_jh7110_usb phy_jh7110_pcie nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xt_tcpudp ip6t_rpfilter ipt_rpfilter xt_pkttype nft_compat uio_pdrv_genirq uio nf_tables libcrc32c nfnetlink sch_fq_codel atkbd libps2 serio vivaldi_fmap loop tun tap macvlan drm bridge stp llc fuse backlight i2c_core efi_pstore firmware_class pstore configfs ip_tables x_tables autofs4 ext4 crc32c_generic crc16 mbcache jbd2 mmc_block dw_mmc_starfive dw_mmc_pltfm dw_mmc mmc_core dm_mod dax
[   21.892884] CPU: 1 PID: 491 Comm: (udev-worker) Not tainted 6.4.0-rc2 #1-NixOS
[   21.892892] Hardware name: StarFive VisionFive 2 v1.3B (DT)
[   21.892896] epc : fortify_panic+0x1a/0x1c
[   21.892912]  ra : fortify_panic+0x1a/0x1c
[   21.892920] epc : ffffffff80811b74 ra : ffffffff80811b74 sp : ffffffc80447b650
[   21.892926]  gp : ffffffff81781280 tp : ffffffd8c8673fc0 t0 : ffffffff8080a0d0
[   21.892932]  t1 : 0720072007200720 t2 : 2064657463657465 s0 : ffffffc80447b660
[   21.892938]  s1 : 0000000000000020 a0 : 000000000000002c a1 : ffffffd8fef5a708
[   21.892943]  a2 : ffffffd8fef66ae8 a3 : 0000000000000000 a4 : 0000000000000000
[   21.892948]  a5 : 0000000000000000 a6 : ffffffff8162d168 a7 : 000000000000006e
[   21.892954]  s2 : ffffffff80e8c2d0 s3 : ffffffd8c5859c08 s4 : 000000000000001f
[   21.892959]  s5 : 0000000000000000 s6 : ffffffff817822a8 s7 : 0000000000ffffff
[   21.892964]  s8 : ffffffd8c83952c0 s9 : 0000000000000011 s10: ffffffff03707230
[   21.892969]  s11: ffffffff037073e0 t3 : ffffffd8c0099f00 t4 : ffffffd8c0099f00
[   21.892975]  t5 : ffffffd8c0099000 t6 : ffffffc80447b478
[   21.892979] status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[   21.892986] [<ffffffff80811b74>] fortify_panic+0x1a/0x1c
[   21.892996] [<ffffffff8059d982>] auxiliary_match_id+0x70/0xcc
[   21.893011] [<ffffffff8059da84>] auxiliary_match+0x1e/0x2a
[   21.893021] [<ffffffff80592cb0>] __device_attach_driver+0x2c/0xe4
[   21.893033] [<ffffffff80590530>] bus_for_each_drv+0x70/0xc4
[   21.893042] [<ffffffff8059310a>] __device_attach+0x94/0x198
[   21.893052] [<ffffffff80593468>] device_initial_probe+0x1a/0x22
[   21.893062] [<ffffffff80591686>] bus_probe_device+0x96/0x98
[   21.893072] [<ffffffff8058ed28>] device_add+0x584/0x738
[   21.893080] [<ffffffff8059db26>] __auxiliary_device_add+0x40/0x92
[   21.893092] [<ffffffff805379ae>] jh7110_reset_controller_register+0x92/0xd4
[   21.893109] [<ffffffff03705362>] jh7110_voutcrg_probe+0x24c/0x310 [clk_starfive_jh7110_vout]
[   21.893148] [<ffffffff80595240>] platform_probe+0x5e/0xa6
[   21.893160] [<ffffffff805927e6>] really_probe+0xa0/0x342
[   21.893170] [<ffffffff80592b08>] __driver_probe_device+0x80/0x138
[   21.893180] [<ffffffff80592bf8>] driver_probe_device+0x38/0xc4
[   21.893190] [<ffffffff80592e3a>] __driver_attach+0xd2/0x1a8
[   21.893200] [<ffffffff80590474>] bus_for_each_dev+0x6c/0xb8
[   21.893209] [<ffffffff805920ae>] driver_attach+0x26/0x2e
[   21.893218] [<ffffffff805918c4>] bus_add_driver+0x10c/0x1ee
[   21.893228] [<ffffffff80593b6a>] driver_register+0x52/0xf4
[   21.893238] [<ffffffff80594e8e>] __platform_driver_register+0x28/0x30
[   21.893249] [<ffffffff03709028>] jh7110_voutcrg_driver_init+0x28/0x1000 [clk_starfive_jh7110_vout]
[   21.893281] [<ffffffff8000281a>] do_one_initcall+0x5c/0x210
[   21.893291] [<ffffffff8009fce8>] do_init_module+0x5e/0x218
[   21.893302] [<ffffffff800a19ca>] load_module+0x185a/0x1d0e
[   21.893311] [<ffffffff800a1fea>] __do_sys_init_module+0x16c/0x182
[   21.893320] [<ffffffff800a2112>] sys_init_module+0x18/0x20
[   21.893329] [<ffffffff8081579e>] do_trap_ecall_u+0xf0/0x104
[   21.893340] [<ffffffff80003eec>] ret_from_exception+0x0/0x64
[   21.893358] Code: 0800 85aa b517 007a 0513 c045 a097 ffff 80e7 eba0 (9002) 0013
[   21.904237] pcie-starfive 2b000000.pcie: host bridge /soc/pcie@2B000000 ranges:
[   21.905751] ---[ end trace 0000000000000000 ]---
[   21.905756] Kernel panic - not syncing: Fatal exception in interrupt
[   21.905761] SMP: stopping secondary CPUs
[   22.296109] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

The config used in the build.

@leifhelm
Copy link

I got this error as well on 6.3-rc4 but the board was still able to boot.

@misuzu
Copy link

misuzu commented May 17, 2023

The workaround is to blacklist the clk-starfive-jh7110-vout module, e.g. on NixOS:

  boot.blacklistedKernelModules = [ "clk-starfive-jh7110-vout" ];

NickCao added a commit to NickCao/nixos-hardware that referenced this issue May 17, 2023
@andreas-schwab
Copy link
Contributor Author

The problem is that "clk_starfive_jh7110_sys.rst-vout" is exactly
AUXILIARY_NAME_SIZE long, thus lacks a null termination in
jh7110_reset_ids.

MichaIng pushed a commit to MichaIng/linux that referenced this issue Nov 29, 2023
[ Upstream commit 13cf24e ]

For leaf dir, In most cases, there should be as many bestfree slots
as the dir data blocks that can fit under i_size (except for [1]).

Root cause is we don't examin the number bestfree slots, when the slots
number less than dir data blocks, if we need to allocate new dir data
block and update the bestfree array, we will use the dir block number as
index to assign bestfree array, while we did not check the leaf buf
boundary which may cause UAF or other memory access problem. This issue
can also triggered with test cases xfs/473 from fstests.

According to Dave Chinner & Darrick's suggestion, adding buffer verifier
to detect this abnormal situation in time.
Simplify the testcase for fstest xfs/554 [1]

The error log is shown as follows:
==================================================================
BUG: KASAN: use-after-free in xfs_dir2_leaf_addname+0x1995/0x1ac0
Write of size 2 at addr ffff88810168b000 by task touch/1552
CPU: 5 PID: 1552 Comm: touch Not tainted 6.0.0-rc3+ starfive-tech#101
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x4d/0x66
 print_report.cold+0xf6/0x691
 kasan_report+0xa8/0x120
 xfs_dir2_leaf_addname+0x1995/0x1ac0
 xfs_dir_createname+0x58c/0x7f0
 xfs_create+0x7af/0x1010
 xfs_generic_create+0x270/0x5e0
 path_openat+0x270b/0x3450
 do_filp_open+0x1cf/0x2b0
 do_sys_openat2+0x46b/0x7a0
 do_sys_open+0xb7/0x130
 do_syscall_64+0x35/0x80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fe4d9e9312b
Code: 25 00 00 41 00 3d 00 00 41 00 74 4b 64 8b 04 25 18 00 00 00 85 c0
75 67 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00
f0 ff ff 0f 87 91 00 00 00 48 8b 4c 24 28 64 48 33 0c 25
RSP: 002b:00007ffda4c16c20 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fe4d9e9312b
RDX: 0000000000000941 RSI: 00007ffda4c17f33 RDI: 00000000ffffff9c
RBP: 00007ffda4c17f33 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001b6 R11: 0000000000000246 R12: 0000000000000941
R13: 00007fe4d9f631a4 R14: 00007ffda4c17f33 R15: 0000000000000000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea000405a2c0 refcount:0 mapcount:0 mapping:0000000000000000
index:0x0 pfn:0x10168b
flags: 0x2fffff80000000(node=0|zone=2|lastcpupid=0x1fffff)
raw: 002fffff80000000 ffffea0004057788 ffffea000402dbc8 0000000000000000
raw: 0000000000000000 0000000000170000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88810168af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88810168af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88810168b000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88810168b080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88810168b100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
Disabling lock debugging due to kernel taint
00000000: 58 44 44 33 5b 53 35 c2 00 00 00 00 00 00 00 78
XDD3[S5........x
XFS (sdb): Internal error xfs_dir2_data_use_free at line 1200 of file
fs/xfs/libxfs/xfs_dir2_data.c.  Caller
xfs_dir2_data_use_free+0x28a/0xeb0
CPU: 5 PID: 1552 Comm: touch Tainted: G    B              6.0.0-rc3+
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x4d/0x66
 xfs_corruption_error+0x132/0x150
 xfs_dir2_data_use_free+0x198/0xeb0
 xfs_dir2_leaf_addname+0xa59/0x1ac0
 xfs_dir_createname+0x58c/0x7f0
 xfs_create+0x7af/0x1010
 xfs_generic_create+0x270/0x5e0
 path_openat+0x270b/0x3450
 do_filp_open+0x1cf/0x2b0
 do_sys_openat2+0x46b/0x7a0
 do_sys_open+0xb7/0x130
 do_syscall_64+0x35/0x80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fe4d9e9312b
Code: 25 00 00 41 00 3d 00 00 41 00 74 4b 64 8b 04 25 18 00 00 00 85 c0
75 67 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00
f0 ff ff 0f 87 91 00 00 00 48 8b 4c 24 28 64 48 33 0c 25
RSP: 002b:00007ffda4c16c20 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fe4d9e9312b
RDX: 0000000000000941 RSI: 00007ffda4c17f46 RDI: 00000000ffffff9c
RBP: 00007ffda4c17f46 R08: 0000000000000000 R09: 0000000000000001
R10: 00000000000001b6 R11: 0000000000000246 R12: 0000000000000941
R13: 00007fe4d9f631a4 R14: 00007ffda4c17f46 R15: 0000000000000000
 </TASK>
XFS (sdb): Corruption detected. Unmount and run xfs_repair

[1] https://lore.kernel.org/all/[email protected]/
Reviewed-by: Hou Tao <[email protected]>
Signed-off-by: Guo Xuenan <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Leah Rumancik <[email protected]>
Acked-by: Chandan Babu R <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
MichaIng pushed a commit to MichaIng/linux that referenced this issue Jan 12, 2024
commit 1036f69 upstream.

On RZ/Five SMARC EVK, where probing of SDHI is deferred due to probe
deferral of the vqmmc-supply regulator:

    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 0 at kernel/time/timer.c:1738 __run_timers.part.0+0x1d0/0x1e8
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper Not tainted 6.7.0-rc4 starfive-tech#101
    Hardware name: Renesas SMARC EVK based on r9a07g043f01 (DT)
    epc : __run_timers.part.0+0x1d0/0x1e8
     ra : __run_timers.part.0+0x134/0x1e8
    epc : ffffffff800771a4 ra : ffffffff80077108 sp : ffffffc800003e60
     gp : ffffffff814f5028 tp : ffffffff8140c5c0 t0 : ffffffc800000000
     t1 : 0000000000000001 t2 : ffffffff81201300 s0 : ffffffc800003f20
     s1 : ffffffd8023bc4a0 a0 : 00000000fffee6b0 a1 : 0004010000400000
     a2 : ffffffffc0000016 a3 : ffffffff81488640 a4 : ffffffc800003e60
     a5 : 0000000000000000 a6 : 0000000004000000 a7 : ffffffc800003e68
     s2 : 0000000000000122 s3 : 0000000000200000 s4 : 0000000000000000
     s5 : ffffffffffffffff s6 : ffffffff81488678 s7 : ffffffff814886c0
     s8 : ffffffff814f49c0 s9 : ffffffff81488640 s10: 0000000000000000
     s11: ffffffc800003e60 t3 : 0000000000000240 t4 : 0000000000000a52
     t5 : ffffffd8024ae018 t6 : ffffffd8024ae038
    status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003
    [<ffffffff800771a4>] __run_timers.part.0+0x1d0/0x1e8
    [<ffffffff800771e0>] run_timer_softirq+0x24/0x4a
    [<ffffffff80809092>] __do_softirq+0xc6/0x1fa
    [<ffffffff80028e4c>] irq_exit_rcu+0x66/0x84
    [<ffffffff80800f7a>] handle_riscv_irq+0x40/0x4e
    [<ffffffff80808f48>] call_on_irq_stack+0x1c/0x28
    ---[ end trace 0000000000000000 ]---

What happens?

    renesas_sdhi_probe()
    {
    	tmio_mmc_host_alloc()
	    mmc_alloc_host()
		INIT_DELAYED_WORK(&host->detect, mmc_rescan);

	devm_request_irq(tmio_mmc_irq);

	/*
	 * After this, the interrupt handler may be invoked at any time
	 *
	 *  tmio_mmc_irq()
	 *  {
	 *	__tmio_mmc_card_detect_irq()
	 *	    mmc_detect_change()
	 *		_mmc_detect_change()
	 *		    mmc_schedule_delayed_work(&host->detect, delay);
	 *  }
	 */

	tmio_mmc_host_probe()
	    tmio_mmc_init_ocr()
		-EPROBE_DEFER

	tmio_mmc_host_free()
	    mmc_free_host()
    }

When expire_timers() runs later, it warns because the MMC host structure
containing the delayed work was freed, and now contains an invalid work
function pointer.

Fix this by cancelling any pending delayed work before releasing the
MMC host structure.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Tested-by: Lad Prabhakar <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/205dc4c91b47e31b64392fe2498c7a449e717b4b.1701689330.git.geert+renesas@glider.be
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
MichaIng pushed a commit to MichaIng/linux that referenced this issue Jan 19, 2024
commit 1036f69 upstream.

On RZ/Five SMARC EVK, where probing of SDHI is deferred due to probe
deferral of the vqmmc-supply regulator:

    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 0 at kernel/time/timer.c:1738 __run_timers.part.0+0x1d0/0x1e8
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper Not tainted 6.7.0-rc4 starfive-tech#101
    Hardware name: Renesas SMARC EVK based on r9a07g043f01 (DT)
    epc : __run_timers.part.0+0x1d0/0x1e8
     ra : __run_timers.part.0+0x134/0x1e8
    epc : ffffffff800771a4 ra : ffffffff80077108 sp : ffffffc800003e60
     gp : ffffffff814f5028 tp : ffffffff8140c5c0 t0 : ffffffc800000000
     t1 : 0000000000000001 t2 : ffffffff81201300 s0 : ffffffc800003f20
     s1 : ffffffd8023bc4a0 a0 : 00000000fffee6b0 a1 : 0004010000400000
     a2 : ffffffffc0000016 a3 : ffffffff81488640 a4 : ffffffc800003e60
     a5 : 0000000000000000 a6 : 0000000004000000 a7 : ffffffc800003e68
     s2 : 0000000000000122 s3 : 0000000000200000 s4 : 0000000000000000
     s5 : ffffffffffffffff s6 : ffffffff81488678 s7 : ffffffff814886c0
     s8 : ffffffff814f49c0 s9 : ffffffff81488640 s10: 0000000000000000
     s11: ffffffc800003e60 t3 : 0000000000000240 t4 : 0000000000000a52
     t5 : ffffffd8024ae018 t6 : ffffffd8024ae038
    status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003
    [<ffffffff800771a4>] __run_timers.part.0+0x1d0/0x1e8
    [<ffffffff800771e0>] run_timer_softirq+0x24/0x4a
    [<ffffffff80809092>] __do_softirq+0xc6/0x1fa
    [<ffffffff80028e4c>] irq_exit_rcu+0x66/0x84
    [<ffffffff80800f7a>] handle_riscv_irq+0x40/0x4e
    [<ffffffff80808f48>] call_on_irq_stack+0x1c/0x28
    ---[ end trace 0000000000000000 ]---

What happens?

    renesas_sdhi_probe()
    {
    	tmio_mmc_host_alloc()
	    mmc_alloc_host()
		INIT_DELAYED_WORK(&host->detect, mmc_rescan);

	devm_request_irq(tmio_mmc_irq);

	/*
	 * After this, the interrupt handler may be invoked at any time
	 *
	 *  tmio_mmc_irq()
	 *  {
	 *	__tmio_mmc_card_detect_irq()
	 *	    mmc_detect_change()
	 *		_mmc_detect_change()
	 *		    mmc_schedule_delayed_work(&host->detect, delay);
	 *  }
	 */

	tmio_mmc_host_probe()
	    tmio_mmc_init_ocr()
		-EPROBE_DEFER

	tmio_mmc_host_free()
	    mmc_free_host()
    }

When expire_timers() runs later, it warns because the MMC host structure
containing the delayed work was freed, and now contains an invalid work
function pointer.

Fix this by cancelling any pending delayed work before releasing the
MMC host structure.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Tested-by: Lad Prabhakar <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/205dc4c91b47e31b64392fe2498c7a449e717b4b.1701689330.git.geert+renesas@glider.be
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants