Re: selftests: gpio: crash on arm64

From: Naresh Kamboju
Date: Mon Apr 10 2023 - 05:17:00 EST


On Thu, 9 Mar 2023 at 23:20, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Thu, Mar 09, 2023 at 09:33:29PM +0530, Naresh Kamboju wrote:
> > Following kernel warnings and crash notices on arm64 Rpi4 device while
> > running selftests: gpio on Linux mainline 6.3.0-rc1 kernel and Linux next.
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> ...
>
> > [ 61.177432] *** DEADLOCK ***
> > [ 61.177432]
> > [ 61.177434] 3 locks held by modprobe/510:
> > [ 61.177436] #0: ffff000040000698 (&n->list_lock){-.-.}-{2:2}, at:
> > get_partial_node.part.0 (mm/slub.c:2271)
> > [ 61.177448] #1: ffff80000b227f18 (console_lock){+.+.}-{0:0}, at:
> > vprintk_emit (kernel/printk/printk.c:1936 kernel/printk/printk.c:2315)
> > [ 61.177460] #2: ffff80000b228388 (console_srcu){....}-{0:0}, at:
> > console_flush_all (include/linux/srcu.h:200 kernel/printk/printk.c:290
> > kernel/printk/printk.c:2934)
>
> How is it related to the GPIO?
> Can you bisect if it's a regression somewhere?

The following crash on Linux mainline and next was noticed while running
selftest gpio on arm64. And this is a kselftest-merge config build.
Which means it has a large set of test configs enabled.

Anders performed bisection on this problem.
The bisection have been poing to this commit log,
first bad commit: [24c94060fc9b4e0f19e6e018869db46db21d6bc7]
gpiolib: ensure that fwnode is properly set


Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
Reported-by: Anders Roxell <anders.roxell@xxxxxxxxxx>

Crash log:
# 2. Module load error tests
# 2.1 gpio overflow
[ 88.796755] =============================================================================
[ 88.806704] BUG kmalloc-512 (Not tainted): Poison overwritten
[ 88.812482] -----------------------------------------------------------------------------
[ 88.812482]
[ 88.822170] 0xe38-0xe47 @offset=28216. First byte 0x6a instead of 0x6b
[ 88.830994] Allocated in swnode_register+0x40/0x218 age=828 cpu=2 pid=565
[ 88.837830] __kmem_cache_alloc_node+0x11c/0x320
[ 88.842480] kmalloc_trace+0x54/0xa8
[ 88.846083] swnode_register+0x40/0x218
[ 88.849947] fwnode_create_software_node+0xcc/0x1a0
[ 88.854856] 0xffff8000018c71cc
[ 88.858029] 0xffff8000018c73b0
[ 88.861197] do_one_initcall+0x80/0x320
[ 88.865062] do_init_module+0x50/0x210
[ 88.868843] load_module+0x201c/0x2260
[ 88.872622] __do_sys_finit_module+0xb0/0x138
[ 88.877010] __arm64_sys_finit_module+0x2c/0x48
[ 88.881572] invoke_syscall+0x8c/0x120
[ 88.885352] el0_svc_common.constprop.0+0x104/0x130
[ 88.890263] do_el0_svc+0x44/0xb8
[ 88.893606] el0_svc+0x48/0xb8
[ 88.896686] el0t_64_sync_handler+0xbc/0x138
[ 88.900984] Freed in software_node_release+0xdc/0x108 age=34 cpu=1 pid=683
[ 88.907899] __kmem_cache_free+0x2a4/0x2e0
[ 88.912024] kfree+0xc0/0x1a0
[ 88.915015] software_node_release+0xdc/0x108
[ 88.919402] kobject_put+0xb0/0x220
[ 88.922919] software_node_notify_remove+0x98/0xe8
[ 88.927741] device_del+0x184/0x380
[ 88.931259] platform_device_del.part.0+0x24/0xa8
[ 88.935995] platform_device_unregister+0x30/0x50
[ 88.940730] 0xffff8000018a1dd4
[ 88.943898] __arm64_sys_delete_module+0x184/0x328
[ 88.948722] invoke_syscall+0x8c/0x120
[ 88.952502] el0_svc_common.constprop.0+0x104/0x130
[ 88.957413] do_el0_svc+0x44/0xb8
[ 88.960757] el0_svc+0x48/0xb8
[ 88.963834] el0t_64_sync_handler+0xbc/0x138
[ 88.968132] el0t_64_sync+0x190/0x198
[ 88.971820] Slab 0xfffffc00209d0800 objects=21 used=7
fp=0xffff000827423200
flags=0xbfffc0000010200(slab|head|node=0|zone=2|lastcpupid=0xffff)
[ 88.984653] Object 0xe00 @offset=28160 fp=0xffff000827423200
[ 88.984653]
[ 88.992953] Redzone <Trim>
[ 89.002470] Redzone <Trim>
[ 89.011986] Redzone <Trim>
...
[ 89.278435] Redzone <Trim>
[ 89.287951] Redzone <Trim>
[ 89.297468] Object <Trim>
[ 89.306984] Object <Trim>
[ 89.316500] Object <Trim>
...
[ 89.592465] Object
[ 89.601981] Redzone
[ 89.610801] Padding
[ 89.620317] Padding


Details test and crash log:
- https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v6.3-rc6/testrun/16155019/suite/log-parser-test/test/check-kernel-exception/log
- https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v6.3-rc6/testrun/16155019/suite/log-parser-test/tests/
- https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v6.3-rc6/testrun/16155157/suite/log-parser-test/tests/

metadata:
git_ref: master
git_repo: https://gitlab.com/Linaro/lkft/mirrors/torvalds/linux-mainline
git_sha: 09a9639e56c01c7a00d6c0ca63f4c7c41abe075d
git_describe: v6.3-rc6
kernel_version: 6.3.0-rc6
kernel-config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2OCXLSEmqxrg13KKFGzypngoE3K/config
build-url: https://gitlab.com/Linaro/lkft/mirrors/torvalds/linux-mainline/-/pipelines/832195018
artifact-location:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2OCXLSEmqxrg13KKFGzypngoE3K/
toolchain: gcc-11
email-notification: ''
build_name: gcc-11-lkftconfig-kselftest



--
Linaro LKFT
https://lkft.linaro.org

>
> --
> With Best Regards,
> Andy Shevchenko
>
>