mirror / busybox

BusyBox mirror

Home Page:https://www.busybox.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Busybox Segmentation Fault after login.

venkatakrishs opened this issue · comments

Hi,

I am currently working on RISC-V based processor for which we are now moving from BBL (loaded through GDB) to standalone boot-up using OpenSBI and U-Boot. We have written the UART Driver and SPI Driver in U-Boot and can now load/boot linux (vmlinux - BIN) but I can see that the busybox throws a "Segmentation Fault" after I login into the system. The "sh" in busybox is the one throwing segmentation fault here. I have attached the bootup log.

OpenSBI v0.9

<OpenSBI Logo>

Platform Name             : shakti,spike-bare
Platform Features         : timer,mfdeleg
Platform HART Count       : 1
Firmware Base             : 0x80000000
Firmware Size             : 108 KB
Runtime SBI Version       : 0.3

Domain0 Name              : root
Domain0 Boot HART         : 0
Domain0 HARTs             : 0*
Domain0 Region00          : 0x0000000080000000-0x000000008001ffff ()
Domain0 Region01          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x0000000080200000
Domain0 Next Arg1         : 0x0000000082200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 0
Boot HART Domain          : root
Boot HART ISA             : rv64imacnsu
Boot HART Features        : scounteren,mcounteren,time
Boot HART PMP Count       : 0
Boot HART PMP Granularity : 7919418773337001387
Boot HART PMP Address Bits: 213201012
Boot HART MHPM Count      : 0
Boot HART MHPM Count      : 0
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109
MMC:   [SHAKTI-INFO] Shakti SPI Driver Initialized...
spi@20100:mmc-slot@0: 0
In:    uart
Out:   uart
Err:   uart
Net:   No ethernet found.
Hit any key to stop autoboot:  0 
Shakti U-Boot> run bootcmd
2852 bytes read in 518 ms (4.9 KiB/s)
15226112 bytes read in 1335400 ms (10.7 KiB/s)
 Booting kernel from Legacy Image at 84000000 ...
   Image Name:   Shakti-Vajra
   Image Type:   RISC-V Linux Kernel Image (uncompressed)
   Data Size:    15226048 Bytes = 14.5 MiB
   Load Address: 84000000
   Entry Point:  84000040
   Verifying Checksum ... OK
 Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Kernel Image
   Using Device Tree in place at 0000000088000000, end 0000000088003b23
 Transferring control to kernel (at address 84000040) ...

Starting kernel ...

0 and 88000000
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x84000000

[    0.000000] Linux version 5.5.0-rc1-00032-g264b43306b8c-dirty (venkatakrishnan@venkatakrishnan-ubuntu) (gcc version 10.2.0 (GCC)) #1 Wed Jul 14 12:55:55 IST 2021

[    0.000000] initrd not found or empty - disabling initrd

[    0.000000] Zone ranges:

[    0.000000]   DMA32    [mem 0x0000000084000000-0x000000008fffffff]

[    0.000000]   Normal   empty

[    0.000000] Movable zone start for each node

[    0.000000] Early memory node ranges

[    0.000000]   node   0: [mem 0x0000000084000000-0x000000008fffffff]

[    0.000000] Initmem setup node 0 [mem 0x0000000084000000-0x000000008fffffff]

[    0.000000] software IO TLB: mapped [mem 0x8bd5b000-0x8fd5b000] (64MB)

[    0.000000] elf_hwcap is 0x1105

[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 48480

[    0.000000] Kernel command line: earlyprintk root=/dev/mmcblk1p2 rw rootwait rootfs=ext4 noinitrd selinux=0

[    0.000000] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes, linear)

[    0.000000] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)

[    0.000000] Sorting __ex_table...

[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off

[    0.000000] Memory: 112684K/196608K available (3867K kernel code, 201K rwdata, 702K rodata, 9856K init, 232K bss, 83924K reserved, 0K cma-reserved)

[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0

[    0.000000] plic: mapped 29 interrupts with 1 handlers for 2 contexts.

[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]

[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1ef4687b1, max_idle_ns: 112843571739654 ns

[    0.001403] sched_clock: 64 bits at 32kHz, resolution 30517ns, wraps every 70368744171142ns

[    6.036712] printk: console [hvc0] enabled

[    6.188354] Calibrating delay loop (skipped), value calculated using timer frequency.. 0.06 BogoMIPS (lpj=131)

[    6.546874] pid_max: default: 32768 minimum: 301

[    6.774353] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)

[    6.988464] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)

[    7.661102] devtmpfs: initialized

[    8.313964] random: get_random_bytes called from setup_net+0x54/0x1dc with crng_init=0

[    8.598937] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns

[    8.905670] futex hash table entries: 256 (order: 0, 6144 bytes, linear)

[    9.231109] NET: Registered protocol family 16

[   10.946990] clocksource: Switched to clocksource riscv_clocksource

[   11.648681] NET: Registered protocol family 2

[   11.954620] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)

[   12.275756] TCP established hash table entries: 2048 (order: 2, 16384 bytes, linear)

[   12.574859] TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)

[   12.843292] TCP: Hash tables configured (established 2048 bind 2048)

[   13.101928] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)

[   13.341583] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)

[   13.651397] NET: Registered protocol family 1

[   43.764770] workingset: timestamp_bits=62 max_order=15 bucket_order=0

[   57.322448] ntfs: driver 2.1.32 [Flags: R/W DEBUG].

[   57.828308] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)

[   58.104797] io scheduler mq-deadline registered

[   58.249664] io scheduler kyber registered

[   58.562072] io scheduler bfq registered

[   80.824493] shakti_spi 20100.spi: Shakti SPI Driver initialized

[   81.467407] libphy: Fixed MDIO Bus: probed

[   81.641357] xilinx_emaclite 44000.ethernet: Device Tree Probing

[   81.904205] libphy: Xilinx Emaclite MDIO: probed

[   82.159179] xilinx_emaclite 44000.ethernet: MAC address is now 00:0a:35:00:00:00

[   82.676452] xilinx_emaclite 44000.ethernet: Xilinx EmacLite at 0x00044000 mapped to 0x04008000, irq=29

[   83.295562] mmc_spi spi0.0: SD/MMC host mmc0, no DMA, no WP, no poweroff, cd polling

[   83.743865] NET: Registered protocol family 17

[   87.106170] Freeing unused kernel memory: 9856K

[   87.250457] This architecture does not have kernel memory protection.

[   87.505645] Run /init as init process

[   87.939697] mmc0: host does not support reading read-only switch, assuming write-enable

[   88.247863] mmc0: new SDHC card on SPI

[   88.586975] mmcblk0: mmc0:0000 NCard 14.8 GiB 

[   89.673187]  mmcblk0: p1 p2

Starting syslogd: OK

Starting klogd: OK

Running sysctl: OK

Starting mdev... OK

modprobe: can't change directory to '/lib/modules': No such file or directory

Saving random seed: [  668.203765] random: dd: uninitialized urandom read (512 bytes read)

OK

Starting network plug daemon: /etc/netplug.d/netplug eth0 probe -> pid 68

[  678.362823] xilinx_emaclite 44000.ethernet eth0: Link is Down

/etc/netplug.d/netplug eth1 probe -> pid 70

/etc/netplug.d/netplug eth2 probe -> pid 71

/etc/netplug.d/netplug eth3 probe -> pid 72

/etc/netplug.d/netplug eth4 probe -> pid 73

/etc/netplug.d/netplug eth5 probe -> pid 74

/etc/netplug.d/netplug eth6 probe -> pid 75

/etc/netplug.d/netplug eth7 probe -> pid 76

/etc/netplug.d/netplug eth8 probe -> pid 77

/etc/netplug.d/netplug eth9 probe -> pid 78

/etc/netplug.d/netplug eth10 probe -> pid 79

/etc/netplug.d/netplug eth11 probe -> pid 80

/etc/netplug.d/netplug eth12 probe -> pid 81

/etc/netplug.d/netplug eth13 probe -> pid 82

/etc/netplug.d/netplug eth14 probe -> pid 83

/etc/netplug.d/netplug eth15 probe -> pid 84



Starting network: OK

Starting dropbear sshd: [  750.193481] random: dropbear: uninitialized urandom read (32 bytes read)

OK




Welcome to Buildroot


buildroot login: root

Password: 



# 

[ 1785.265594] sh[101]: unhandled signal 11 code 0x1 at 0x00000000656c6976 in busybox[10000+aa000]

[ 1785.600006] CPU: 0 PID: 101 Comm: sh Not tainted 5.5.0-rc1-00032-g264b43306b8c-dirty #1

[ 1785.904663] epc: 000000000004e3f2 ra : 000000000004e3b8 sp : 0000003fffdf6920

[ 1786.169036]  gp : 00000000000bbc90 tp : 0000003fc282b820 t0 : 0000000000000000

[ 1786.434844]  t1 : 0000000000017e3c t2 : 0000003fc28158d8 s0 : 00000000000bd2a0

[ 1786.701660]  s1 : 0000000000000000 a0 : 00000000000c1f10 a1 : 0000000000000000

[ 1786.967529]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 00000000000bbe18

[ 1787.234069]  a5 : 00000000656c6966 a6 : 0000000000000000 a7 : 0000000000000000

[ 1787.499847]  s2 : 00000000000bbea0 s3 : 00000000000bd5e0 s4 : 0000000000000000

[ 1787.766418]  s5 : 0000000000000000 s6 : ffffffffffffffff s7 : 000000000009a000

[ 1788.033386]  s8 : 00000000000bd5e0 s9 : 0000000000090000 s10: 0000003fffdf6980

[ 1788.299255]  s11: 0000000000000015 t3 : 0000003fc2778a54 t4 : 0000003fc27e45c0

[ 1788.565673]  t5 : 0000000000000005 t6 : ffffffffffffffff

[ 1788.746154] status: 0000000200000020 badaddr: 00000000656c6976 cause: 000000000000000d

Welcome to Buildroot
buildroot login: