Hi Andreas, On 11/01/2016 08:55 PM, Andreas Färber wrote:
Am 24.10.2016 um 12:48 schrieb Andreas Färber:
Hello,
Kernel:HEAD aarch64 v4.9-rc1 kernel builds all crashed in depmod. A quick Google search didn't reveal any known bug.
Now there may be a genuine upstream dependency bug triggering this, but surely depmod shouldn't behave like this. [...]
With 4.9-rc3 kernel.git I locally get the following on aarch64:
depmod: ERROR: Found 8 modules in dependency cycles! depmod: ERROR: Cycle detected: remoteproc -> virtio depmod: ERROR: Cycle detected: remoteproc -> virtio_ring depmod: ERROR: Cycle detected: qcom_mdt_loader -> remoteproc *** Error in `/sbin/depmod': free(): invalid next size (fast): 0x000000000186d770 *** [...] (gdb) bt #0 0x0000007fb7e28c80 in raise () from /lib64/libc.so.6 #1 0x0000007fb7e2a04c in abort () from /lib64/libc.so.6 #2 0x0000007fb7e61888 in __libc_message () from /lib64/libc.so.6 #3 0x0000007fb7e67d9c in malloc_printerr () from /lib64/libc.so.6 #4 0x0000007fb7e68638 in _int_free () from /lib64/libc.so.6 #5 0x00000000004096ec in depmod_report_cycles (depmod=0x7fffffa970, edges=0xede, stack=0xf00, users=0x188b4f0, n_roots=43920, n_mods=127) at tools/depmod.c:1519 #6 depmod_calculate_dependencies (depmod=0x7fffffa970) at tools/depmod.c:1596 #7 depmod_load (depmod=0x7fffffa970) at tools/depmod.c:1623 #8 do_depmod (argc=<optimized out>, argv=<optimized out>) at tools/depmod.c:2598 #9 0x0000007fb7e16364 in __libc_start_main () from /lib64/libc.so.6 #10 0x0000000000402cd8 in _start () at ../sysdeps/aarch64/start.S:81 Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb)
If I comment out the offending free() in vanilla kmod-23's depmod_report_cycles() then I see the first "real" cycle:
depmod: ERROR: Found 8 modules in dependency cycles! depmod: ERROR: Cycle detected: remoteproc -> virtio depmod: ERROR: Cycle detected: remoteproc -> virtio_ring depmod: ERROR: Cycle detected: qcom_mdt_loader -> remoteproc depmod: ERROR: Cycle detected: qcom_wcnss_iris -> qcom_wcnss -> qcom_wcnss_iris *** Error in `/home/andreas/kmod-23/tools/depmod': realloc(): invalid next size: 0x000000002640ab30 ***
Changing the DBG() to an ERR() hints that the cycle detection is flawed:
depmod: ERROR: Found 8 modules in dependency cycles! depmod: ERROR: Cycle report: Trying smem visited=0 users=1 depmod: ERROR: Cycle report: Trying hwspinlock_core visited=0 users=0 depmod: ERROR: Cycle report: Trying virtio visited=0 users=1 depmod: ERROR: Cycle report: Trying virtio_ring visited=0 users=1 depmod: ERROR: Cycle report: Trying remoteproc visited=0 users=2 depmod: ERROR: Cycle report: Trying virtio visited=1 users=0 depmod: ERROR: Cycle detected: remoteproc -> virtio depmod: ERROR: Cycle report: Trying virtio_ring visited=1 users=0 depmod: ERROR: Cycle detected: remoteproc -> virtio_ring depmod: ERROR: Cycle report: Trying qcom_mdt_loader visited=0 users=1 depmod: ERROR: Cycle report: Trying remoteproc visited=1 users=1 depmod: ERROR: Cycle detected: qcom_mdt_loader -> remoteproc *** Error in `/home/andreas/kmod-23/tools/depmod': free(): invalid next size (fast): 0x000000002b61c370 ***
I.e., whenever a module has been visited as part of a (non-circular) dependency chain it gets marked as ->visited = true and the next time it is encountered it is falsely reported as a cycle. Whether that misdetection causes any corruption is not yet clear to me, but it explains the first three "Cycle detected" lines.
If I locally disable CONFIG_QCOM_WCNSS_PIL then no cycles get detected and it doesn't crash, finishing fine. But again, that's only a solution for getting some kernel built, not for getting sensible information on the next cycle...
Would you mind to try the patch attached? I suppose this fixes the building problem. I'm traveling and my internet connection isn't really reliable. Thanks, Matthias
armv6hl has in the meantime succeeded building; armv7hl still faces this depmod issue.
Regards, Andreas