Bug#952404: scanbd: crash on startup: kernel internal error: Oops 206 with current raspbian buster on rpi4 4g

2020-03-27 Thread Ingo Breßler

Of course, the dmesg is attached.
Let me know if I can provide more info.

Am 25.03.20 um 22:50 schrieb Sudip Mukherjee:

Thanks for testing and debugging it.

Can you please send me your dmesg which shows the trace.

--
Regards
Sudip

[0.00] Booting Linux on physical CPU 0x0
[0.00] Linux version 4.19.97-v7l+ (dom@buildbot) (gcc version 4.9.3 
(crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1294 SMP Thu Jan 30 13:21:14 
GMT 2020
[0.00] CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d
[0.00] CPU: div instructions available: patching division code
[0.00] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[0.00] OF: fdt: Machine model: Raspberry Pi 4 Model B Rev 1.1
[0.00] Memory policy: Data cache writealloc
[0.00] cma: Reserved 256 MiB at 0x1ec0
[0.00] On node 0 totalpages: 1012736
[0.00]   DMA zone: 1728 pages used for memmap
[0.00]   DMA zone: 0 pages reserved
[0.00]   DMA zone: 196608 pages, LIFO batch:63
[0.00]   HighMem zone: 816128 pages, LIFO batch:63
[0.00] random: get_random_bytes called from start_kernel+0xc0/0x4e8 
with crng_init=0
[0.00] percpu: Embedded 17 pages/cpu s36928 r8192 d24512 u69632
[0.00] pcpu-alloc: s36928 r8192 d24512 u69632 alloc=17*4096
[0.00] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 1011008
[0.00] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 cma=64M 
cma=256M  smsc95xx.macaddr=DC:A6:32:03:DE:E6 vc_mem.mem_base=0x3ec0 
vc_mem.mem_size=0x4000  dwc_otg.lpm_enable=0 console=ttyS0,115200 
console=tty1 root=PARTUUID=ccaf7f28-01 rootfstype=ext4 elevator=deadline 
fsck.repair=yes rootwait
[0.00] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[0.00] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Memory: 3735564K/4050944K available (8192K kernel code, 687K 
rwdata, 2408K rodata, 2048K init, 850K bss, 53236K reserved, 262144K 
cma-reserved, 3264512K highmem)
[0.00] Virtual kernel memory layout:
   vector  : 0x - 0x1000   (   4 kB)
   fixmap  : 0xffc0 - 0xfff0   (3072 kB)
   vmalloc : 0xf080 - 0xff80   ( 240 MB)
   lowmem  : 0xc000 - 0xf000   ( 768 MB)
   pkmap   : 0xbfe0 - 0xc000   (   2 MB)
   modules : 0xbf00 - 0xbfe0   (  14 MB)
 .text : 0x(ptrval) - 0x(ptrval)   (10208 kB)
 .init : 0x(ptrval) - 0x(ptrval)   (2048 kB)
 .data : 0x(ptrval) - 0x(ptrval)   ( 688 kB)
  .bss : 0x(ptrval) - 0x(ptrval)   ( 851 kB)
[0.00] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[0.00] ftrace: allocating 28692 entries in 85 pages
[0.00] rcu: Hierarchical RCU implementation.
[0.00] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[0.00] GIC: Using split EOI/Deactivate mode
[0.00] arch_timer: cp15 timer(s) running at 54.00MHz (phys).
[0.00] clocksource: arch_sys_counter: mask: 0xff 
max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
[0.06] sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 
4398046511102ns
[0.22] Switching to timer-based delay loop, resolution 18ns
[0.000250] Console: colour dummy device 80x30
[0.000703] console [tty1] enabled
[0.000758] Calibrating delay loop (skipped), value calculated using timer 
frequency.. 108.00 BogoMIPS (lpj=54)
[0.000795] pid_max: default: 32768 minimum: 301
[0.001082] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[0.001114] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[0.001884] CPU: Testing write buffer coherency: ok
[0.002309] CPU0: thread -1, cpu 0, socket 0, mpidr 8000
[0.002969] Setting up static identity map for 0x20 - 0x20003c
[0.003143] rcu: Hierarchical SRCU implementation.
[0.004020] smp: Bringing up secondary CPUs ...
[0.004846] CPU1: thread -1, cpu 1, socket 0, mpidr 8001
[0.005787] CPU2: thread -1, cpu 2, socket 0, mpidr 8002
[0.006687] CPU3: thread -1, cpu 3, socket 0, mpidr 8003
[0.006824] smp: Brought up 1 node, 4 CPUs
[0.006892] SMP: Total of 4 processors activated (432.00 BogoMIPS).
[0.006915] CPU: All CPU(s) started in HYP mode.
[0.006935] CPU: Virtualization extensions available.
[0.007743] devtmpfs: initialized
[0.017953] VFP support v0.3: implementor 41 architecture 3 part 40 variant 
8 rev 0
[0.018185] clocksource: jiffies: mask: 0x max_cycles: 0x, 
max_idle_ns: 1911260446275 ns
[0.018228] futex hash table entries: 1024 (order: 4, 65536 bytes)
[0.025736] pinctrl core: initialized pinctrl subsystem
[

Bug#952404: scanbd: crash on startup: kernel internal error: Oops 206 with current raspbian buster on rpi4 4g

2020-03-25 Thread Ingo Breßler
Investigating the error by building the packages of scanbd and libsane 
from source and adding some debugging output turned out that it is not 
an issue of scanbd. Thus, this bug can be closed.


This kernel Oops is triggered by the canon_pp backend of libsane. 
Disabling it in /etc/scanbd/dll.conf resolves the issue and scanbd works 
fine.


This Oops can be triggered directly by calling 'sane-find-scanner -p' 
which explicitly probes for parallel port scanners. Because the 
raspberrypi platform does not have a parallel port, it leads to the 
kernel Oops, I assume.


More specifically, the functions from ieee1284.h such as 
ieee1284_read_status() trigger this Oops. Therefore, it is also not an 
issue of libsane.


At this point, my research stopped and I can't tell if it is a bug of 
package libieee1284 or the kernel itself. Presumably, ieee1284 function 
should be no-op if there is no parallel port(?).


I hope this helps anyone running into this too.



Bug#952404: scanbd: crash on startup: kernel internal error: Oops 206 with current raspbian buster on rpi4 4g

2020-03-10 Thread Ingo Breßler
Thanks for testing, I appreciate it very much!

I am interested which exact commands you were using for qemu?
I haven't used it for emulating the raspi yet and had some trouble finding 
useful/working settings.
The qemu model versatiblepb ('-M versatilepb') works for emulating the initial 
raspi1
and it provides networking. While the latest model I found working is '-M 
raspi3' 
with '-dtb bcm2710-rpi-3-b.dtb' from the raspbian image.
However, I did not get it running with raspi4 related settings
('-cpu cortex-a72' and '-dtb bcm2711-rpi-4-b.dtb' and 4G RAM).

I used the following script for raspi1 emulation and setting up the raspbian 
image
with networking for upgrading the system ('apt-get update && apt-get 
dist-upgrade')
and installing scanbd ('apt-get install scanbd'):

imgfn=2020-02-13-raspbian-buster-lite.img
offset="$(fdisk -l "$imgfn" | awk '/img2/ {print $2}')"
offset=$((offset*512))
mountp=/mnt/raspbian
sudo mkdir -p "$mountp"
sudo mount -v -o offset=$offset -t ext4 "$imgfn" "$mountp"
sudo sh -c "echo > $mountp/etc/ld.so.preload"
sudo umount "$mountp"
qemu-system-arm -M versatilepb -cpu arm1176 -m 256 -serial stdio -audiodev 
none,id=none -drive format=raw,file="$imgfn" -kernel kernel-qemu-4.19.50-buster 
-dtb versatile-pb.dtb -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' 
-no-reboot -nic user,model=virtio-net-pci,hostfwd=tcp::5022-:22

After these preparations, to emulate the raspi3 on aarch64, I used:

qemu-system-aarch64 -M raspi3 -cpu cortex-a53 -m 1024 -kernel kernel8.img 
-serial mon:stdio -nographic -audiodev none,id=none -drive 
format=raw,file="$imgfn" -dtb bcm2710-rpi-3-b.dtb -append 'console=ttyAMA0 
root=PARTUUID=738a4d67-02 rootwait rootfstype=ext4 rw' -no-reboot

Right after successful boot, I showed my that scanbd is defunct:

# ps ax | grep scanbd
  245 ?Zsl0:09 [scanbd] 
  422 ttyAMA0  S+ 0:00 grep scanbd

Killing that defunct process and restarting scanbd in foreground produced
an Oops as well (reproducible in this raspi3 qemu setting):

# kill -9 245
root@raspberrypi:~# ps ax | grep scanbd
  424 ttyAMA0  S+ 0:00 grep scanbd
root@raspberrypi:~# export SANE_CONFIG_DIR=/etc/scanbd
root@raspberrypi:~# scanbd -f -c /etc/scanbd/scanbd.conf
scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'
[  248.273492] Unable to handle kernel paging request at virtual address 
ffbefee003bd
[  248.276850] Mem abort info:
[  248.277181]   ESR = 0x9606
[  248.277520]   Exception class = DABT (current EL), IL = 32 bits
[  248.277979]   SET = 0, FnV = 0
[  248.278249]   EA = 0, S1PTW = 0
[  248.278618] Data abort info:
[  248.281919]   ISV = 0, ISS = 0x0006
[  248.282685]   CM = 0, WnR = 0
[  248.283296] swapper pgtable: 4k pages, 39-bit VAs, pgdp = 
17e1e18d
[  248.284288] [ffbefee003bd] pgd=00d66003, 
pud=00d66003, pmd=
[  248.287752] Internal error: Oops: 9606 [#2] PREEMPT SMP
[  248.288350] Modules linked in: sha256_generic cfg80211 rfkill 8021q garp 
stp llc raspberrypi_hwmon hwmon uio_pdrv_genirq uio ip_tables x_tables ipv6
[  248.290447] Process scanbd (pid: 432, stack limit = 0x5b20de07)
[  248.291505] CPU: 1 PID: 432 Comm: scanbd Tainted: G  D W 
4.19.97-v8+ #1294
[  248.291791] Hardware name: Raspberry Pi 3 Model B (DT)
[  248.292221] pstate: 4005 (nZcv daif -PAN -UAO)
[  248.293119] pc : read_port+0xa8/0x138
[  248.293338] lr : __vfs_read+0x60/0x178
[  248.293529] sp : ff800a513cc0
[  248.293709] x29: ff800a513cc0 x28: ffc034f71d00 
[  248.294015] x27:  x26:  
[  248.294281] x25: 4600 x24: 0011 
[  248.294650] x23: ffea3b23 x22: ff800a513e20 
[  248.294950] x21: ffea3b23 x20: ff800a513e20 
[  248.295227] x19: 0001 x18:  
[  248.295493] x17:  x16: 0001 
[  248.295740] x15:  x14:  
[  248.296279] x13:  x12:  
[  248.296943] x11: ffbefee0 x10:  
[  248.297399] x9 : ffea3b23 x8 :  
[  248.297889] x7 : ffc034f71d00 x6 : 03bd 
[  248.298162] x5 :  x4 : ffea3b23 
[  248.298652] x3 : 007f x2 : ffbefee003bd 
[  248.299031] x1 : ffea3b23 x0 : 007f 
[  248.299815] Call trace:
[  248.300313]  read_port+0xa8/0x138
[  248.300845]  __vfs_read+0x60/0x178
[  248.301218]  vfs_read+0x94/0x150
[  248.301902]  ksys_read+0x74/0xf0
[  248.302460]  __arm64_sys_read+0x24/0x30
[  248.304005]  el0_svc_common+0xf4/0x1c0
[  248.304744]  el0_svc_compat_handler+0x30/0x40
[  248.305163]  el0_svc_compat+0x8/0x18

Bug#952404: scanbd: crash on startup: kernel internal error: Oops 206 with current raspbian buster on rpi4 4g

2020-02-23 Thread Ingo Breßler
Package: scanbd
Version: 1.5.1-5
Severity: important

Dear Maintainer,

I installed the package *scanbd* on the current Raspbian buster on a
Raspberry Pi 4 (4GB).
The behaviour is identical regardless of version '1.5.1-5' or '1.5.1-4'.
The latter version works fine with a Raspberry Pi 2B and Raspbian stretch.

Running the program *scanbd* with default configuration causes a kernel Oops
even without any scanner attached (and with one attached which used
to work fine):

# export SANE_CONFIG_DIR=/etc/scanbd
# /usr/sbin/scanbd -f -c /etc/scanbd/scanbd.conf

Result:

root@rpi4:~# scanbd -f -c /etc/scanbd/scanbd.conf
scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.054930] Internal error: Oops: 206 [#4] SMP ARM

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.147131] Process scanbd (pid: 2082, stack limit = 0x35d03bc2)

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.150005] Stack: (0xd2581e88 to 0xd2582000)

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.152873] 1e80:   c1004d88 d262f300 fe52a6aa 
d2581f60 d2581f60 0001

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.155781] 1ea0: d2581f2c d2581eb0 c03d4f48 c06f1038 ef9c0a50 
0101 0002 07b8

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.158703] 1ec0:    d2581ed0 c0292810 
c03d235c  c09c996c

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.161640] 1ee0:  ef9c0ad0 d2581f04 d2581ef8 c09c996c 
c0292c68 d2581f1c fe52a6aa

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.164581] 1f00: c09cc028 0001 d262f300 beabdb8b d2581f60 
beabdb8b d258 0003

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.167521] 1f20: d2581f5c d2581f30 c03d5108 c03d4f0c c03f5be4 
c03f52b8 d262f300 c1004d88

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.170469] 1f40: d262f301 0001 beabdb8b d258 d2581f94 
d2581f60 c03d5750 c03d5078

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.173430] 1f60: 03bd  03bd fe52a6aa b6f17968 
0001 beabdb8b 000b

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.176395] 1f80: 0003 c02011c4 d2581fa4 d2581f98 c03d57dc 
c03d56e8  d2581fa8

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.179356] 1fa0: c0201000 c03d57d0 0001 beabdb8b 000b 
beabdb8b 0001 

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.182313] 1fc0: 0001 beabdb8b 000b 0003 b6f17968 
b4c32d08  

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.182313] 1fc0: 0001 beabdb8b 000b 0003 b6f17968 
b4c32d08  

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.185275] 1fe0: 0002 beabdb70  b6de3274 8010 
000b  

Message from syslogd@rpi4 at Feb 23 17:51:52 ...
 kernel:[ 3081.214669] Code: 03a02000 e352 0a0c e2442612 (e5d22000)

It is expected to *not* lead to a kernel Oops and should detect when the 
scanner button was pressed instead.

It is a pity that it does not work as expected when moving to the recent rpi4.
I am investigating this further with the source code which will take some time.

-- System Information:
Distributor ID: Raspbian
Description:Raspbian GNU/Linux 10 (buster)
Release:10
Codename:   buster
Architecture: armv7l

Kernel: Linux 4.19.97-v7l+ (SMP w/4 CPU cores)
Kernel taint flags: TAINT_DIE, TAINT_CRAP
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages scanbd depends on:
ii  init-system-helpers   1.56+nmu1
ii  libc6 2.28-10+rpi1
ii  libconfuse2   3.2.2+dfsg-1
ii  libdbus-1-3   1.12.16-1
ii  libsane   1.0.27-3.2
ii  libudev1  241-7~deb10u3+rpi1
ii  lsb-base  10.2019051400+rpi1
ii  openbsd-inetd [inet-superserver]  0.20160825-4
ii  sane-utils1.0.27-3.2
ii  update-inetd  4.49

scanbd recommends no packages.

scanbd suggests no packages.

-- no debconf information