"blkid" command in udev rule causes kernel panic on boot
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- c, linux, raspberry-pi
- Domain
- embedded-iot, operating-systems
Research direction
Start with the reproduced /etc/udev/rules.d/50.rules entry using /sbin/blkid, then inspect the kernel trace around read_port, vfs_read, and ksys_read. Compare boot behavior with and without the rule on the listed Raspberry Pi and kernel versions. Done means identifying the cause and preventing the rule from triggering the kernel panic while preserving a clean boot.
Written by the indexing model from the issue text.
Description
Describe the bug
Working on a pi project, I'm encountering an issue where if I install rule file into /etc/udev/rules.d/ the system will crash with a kernel panic a few seconds into the boot process. When I remove the rule, the system boots cleanly. Having the media (or usb device) that the rule is supposed to process connected does not matter. The existence of the rule is enough to produce a panic.
When I install the rule the rule performs as expected (in this case it's to make a persistent device name for an SD card) after reloading udev's rules. It is only on a reboot that the panics start.
To reproduce
Install a fresh copy of raspberry pi os (in my case, using the rpi imager tool)
Create /etc/udev/rules.d/50.rules with contents:
IMPORT{program}="/sbin/blkid -o udev -p %N"
ACTION=="add", KERNEL=="sd[a-z][0-9]", ENV{ID_FS_LABEL}=="EOS_DIGITAL", SYMLINK+="MediaSource"
Reboot system. If you're fast with an ssh command running dmesg you can get the kernel panic message for the few seconds the pi is pingable.
Expected behaviour
A clean boot.
Actual behaviour
System gets stuck in a crash/reboot loop until power is cut or the rules file is deleted.
System
Pi model: Raspberry Pi 4 Model B Rev 1.4
OS and version: Raspbian GNU/Linux 10 (buster)
Firmware version: d7f29d96450abfc77cd6cf011af1faf1e03e5e56 (clean) (release) (start)
kernel: Linux raspberrypi 5.10.17-v7l+ #1414 SMP Fri Apr 30 13:20:47 BST 2021 armv7l GNU/Linux
Logs
The kernel panic I fetch from demsg:
[ 7.873404] 8<--- cut here ---
[ 7.873442] Unable to handle kernel paging request at virtual address fee00000
[ 7.873472] pgd = (ptrval)
[ 7.873493] [fee00000] *pgd=80000000007003, *pmd=00000000
[ 7.873538] Internal error: Oops: 206 [#1] SMP ARM
[ 7.873561] Modules linked in: brcmfmac brcmutil sha256_generic cfg80211 rfkill v3d gpu_sched raspberrypi_hwmon bcm2835_codec(C) bcm2835_isp(C) bcm2835_v4l2(C) v4l2_mem2mem snd_bcm2835(C) bcm2835_mmal_vchiq(C) videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common vc_sm_cma(C) videodev mc vc4 cec drm_kms_helper drm drm_panel_orientation_quirks snd_soc_core snd_compress snd_pcm_dmaengine rpivid_mem snd_pcm snd_timer snd syscopyarea sysfillrect sysimgblt fb_sys_fops backlight nvmem_rmem uio_pdrv_genirq uio ip_tables x_tables ipv6
[ 7.874054] CPU: 3 PID: 691 Comm: blkid Tainted: G C 5.10.17-v7l+ #1414
[ 7.874082] Hardware name: BCM2711
[ 7.874117] PC is at read_port+0x70/0xd4
[ 7.874142] LR is at vfs_read+0xc4/0x344
[ 7.874164] pc : [] lr : [] psr: 20000013
[ 7.874187] sp : c3467e98 ip : c3467ec0 fp : c3467ebc
[ 7.874210] r10: c3467f58 r9 : 0000ffff r8 : ffffe000
[ 7.874232] r7 : 01eaf278 r6 : 00000100 r5 : 01eaf278 r4 : 00000000
[ 7.874255] r3 : c3467f58 r2 : fee00000 r1 : 00000000 r0 : 00000001
[ 7.874280] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 7.874306] Control: 30c5383d Table: 034b15c0 DAC: 55555555
[ 7.874330] Process blkid (pid: 691, stack limit = 0x(ptrval))
[ 7.874354] Stack: (0xc3467e98 to 0xc3468000)
[ 7.874377] 7e80: ffffe000 c2a9a3c0
[ 7.874409] 7ea0: 00000100 c1205048 00000000 01eaf278 c3467f54 c3467ec0 c043b1b4 c0830af4
[ 7.874441] 7ec0: c1205048 ffff0000 b6eb9000 00000000 c34b15d0 00000001 00000100 00000000
[ 7.874472] 7ee0: 01eaf1dc 00000000 00000000 debfb998 00000003 40000028 b6e1b880 00000000
[ 7.874503] 7f00: 00000003 00000000 01eaf278 00000000 00000100 00000000 00000000 00000000
[ 7.874534] 7f20: 01eaf1dc 3d6f6113 00000000 c1205048 c2a9a3c0 00000000 00000000 c2a9a3c0
[ 7.874566] 7f40: 01eaf278 00000100 c3467f94 c3467f58 c043b900 c043b0fc 00000000 00000000
[ 7.874597] 7f60: c0308ff0 3d6f6113 c3467fa4 01eaf1dc 00000000 01eaf190 00000003 c0200204
[ 7.874628] 7f80: c3466000 00000003 c3467fa4 c3467f98 c043b990 c043b8a4 00000000 c3467fa8
[ 7.874659] 7fa0: c02001e4 c043b984 01eaf1dc 00000000 00000003 01eaf278 00000100 00000000
[ 7.874690] 7fc0: 01eaf1dc 00000000 01eaf190 00000003 01eaf258 01eaf270 b6efb1e0 00000000
[ 7.874721] 7fe0: 0000006c bedb66f0 b6eb02c0 b6e1b880 60000010 00000003 00000000 00000000
[ 7.874748] Backtrace:
[ 7.874798] [] (read_port) from [] (vfs_read+0xc4/0x344)
[ 7.874830] r9:01eaf278 r8:00000000 r7:c1205048 r6:00000100 r5:c2a9a3c0 r4:ffffe000
[ 7.874867] [] (vfs_read) from [] (ksys_read+0x68/0xe0)
[ 7.874904] r10:00000100 r9:01eaf278 r8:c2a9a3c0 r7:00000000 r6:00000000 r5:c2a9a3c0
[ 7.874931] r4:c1205048
[ 7.874955] [] (ksys_read) from [] (sys_read+0x18/0x1c)
[ 7.874982] r10:00000003 r9:c3466000 r8:c0200204 r7:00000003 r6:01eaf190 r5:00000000
[ 7.875009] r4:01eaf1dc
[ 7.875034] [] (sys_read) from [] (__sys_trace_return+0x0/0x1c)
[ 7.875062] Exception stack(0xc3467fa8 to 0xc3467ff0)
[ 7.875086] 7fa0: 01eaf1dc 00000000 00000003 01eaf278 00000100 00000000
[ 7.875117] 7fc0: 01eaf1dc 00000000 01eaf190 00000003 01eaf258 01eaf270 b6efb1e0 00000000
[ 7.875146] 7fe0: 0000006c bedb66f0 b6eb02c0 b6e1b880
[ 7.875172] Code: 0a000015 e0846002 e1a05007 e2442612 (e5d22000)
[ 7.875202] ---[ end trace 87fb50061b348704 ]---
Additional context
This happens with a stock install of raspbian (the image that the imager tool is providing, dated 2021-05-07) as well as a fully updated/upgraded system (kernel 5.10.52-v7l+ #1441).
This happens on different SD cards as well, I tried with three different ones.
- Dominant language
- C
- Stars
- 13.2k
- Forks
- 5.5k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 21
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/linux
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7415 · 2 comments · 1 reaction ·
-
rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace app Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
raspberrypi/linux#7399 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
raspberrypi/linux#7357 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7054 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
raspberrypi/linux#7634 · 8 comments · 1 reaction ·
All issues in raspberrypi/linux
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·