Bug 4910

Summary: [p1022ds]urandom: segmentation fault
Product: [Build System, Metadata & Runtime] BSPs Reporter: Yi Zhao <yi.zhao>
Component: bsps-meta-fsl-ppcAssignee: Zhenhua Luo <zhenhua.luo>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: b40290, corneliux.stoicescu, ke.zou, ning.zhang, sgw, yi.zhao
Version: 1.5   
Target Milestone: 1.5   
Hardware: Other   
OS: ppc   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)
Attachments:
Description Flags
p1022 system boot information none

Description Yi Zhao 2013-07-25 09:20:36 UTC
Image location: http://autobuilder.yoctoproject.org/pub/nightly/20130724-2/machines/p1022ds/

Git rev: 
poky: master/67864ca79da08df752487a3a4e1a975546da123d
meta-fsl-ppc: master/5d98580e7b366ef25e917b3c446308de28c8cbd4 	
	
When the system boot up, there is a segfault error for urandom:
################
/etc/rcS.d/S30urandom: line 17:  1807 Segmentation fault      dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 > /dev/null 2>&1
urandom start: failed.
###############
Comment 1 Chunrong Guo 2013-07-26 07:07:24 UTC
I can not reproduce the issue .

Git rev: 
poky: master  commit 67864ca79da08df752487a3a4e1a975546da123d
meta-fsl-ppc: master commit 5d98580e7b366ef25e917b3c446308de28c8cbd4 	

the below boot uo log: 

udevd[1415]: starting version 182
Starting Bootlog daemon: bootlogd.
Populating dev cache
Configuring network interfaces... fsl-gianfar ethernet.1 eth0: Could not allocate BDs to SRAM, fallback to DDR
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc (v1.21.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, failing
hwclock: can't open '/dev/misc/rtc': No such file or directory
Fri Jul 26 02:14:00 UTC 2013
hwclock: can't open '/dev/misc/rtc': No such file or directory
Running postinst /etc/rpm-postinsts/sysvinit-inittab...
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
 Removing any system startup links for run-postinsts ...
  /etc/rcS.d/S98run-postinsts
INIT: Entering runlevel: 5
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting syslogd/klogd: done
Stopping Bootlog daemon: bootlogd.

Poky Next (Yocto Project Reference Distro) 1.4+snapshot-20130726 p1022ds /dev/ttyS0
p1022ds login:
Comment 2 Yi Zhao 2013-07-26 07:23:51 UTC
(In reply to comment #1)
> I can not reproduce the issue .
> 
> Git rev: 
> poky: master  commit 67864ca79da08df752487a3a4e1a975546da123d
> meta-fsl-ppc: master commit 5d98580e7b366ef25e917b3c446308de28c8cbd4 	
> 
> the below boot uo log: 
> 
> udevd[1415]: starting version 182
> Starting Bootlog daemon: bootlogd.
> Populating dev cache
> Configuring network interfaces... fsl-gianfar ethernet.1 eth0: Could not
> allocate BDs to SRAM, fallback to DDR
> IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> udhcpc (v1.21.1) started
> Sending discover...
> Sending discover...
> Sending discover...
> No lease, failing
> hwclock: can't open '/dev/misc/rtc': No such file or directory
> Fri Jul 26 02:14:00 UTC 2013
> hwclock: can't open '/dev/misc/rtc': No such file or directory
> Running postinst /etc/rpm-postinsts/sysvinit-inittab...
> update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
>  Removing any system startup links for run-postinsts ...
>   /etc/rcS.d/S98run-postinsts
> INIT: Entering runlevel: 5
> hwclock: can't open '/dev/misc/rtc': No such file or directory
> Starting syslogd/klogd: done
> Stopping Bootlog daemon: bootlogd.
> 
> Poky Next (Yocto Project Reference Distro) 1.4+snapshot-20130726 p1022ds
> /dev/ttyS0
> p1022ds login:

Can you try to run it manually ? 
# /etc/init.d/urandom start
Comment 3 Chunrong Guo 2013-07-26 09:07:48 UTC
I  tried  to run " /etc/init.d/urandom start" manually and it worked well.
Comment 4 Yi Zhao 2013-07-26 10:13:09 UTC
(In reply to comment #3)
> I  tried  to run " /etc/init.d/urandom start" manually and it worked well.

Hi,
I download the rootfs from: http://autobuilder.yoctoproject.org/pub/nightly/20130724-2/machines/p1022ds/

This issue happens on nfs and sata disk.

My u-boot args:
#########
=> printenv 
baudrate=115200
bdev=sda3
bootargs=root=/dev/nfs rw nfsroot=128.224.162.200:/export/pxeboot/rootfs ip=128.224.162.252:128.224.162.200:128.224.162.1:255.255.254.0:p1022ds:eth0:off console=ttyS0,115200 diufb=15M v
ideo=fslfb:1024x768-32@60,monitor=1 tty0 debug
bootcmd=setenv bootargs root=/dev/sda3 rw console=ttyS0,115200; bootm ec000000 - eff00000
bootdelay=10
bootfile=uImage
consoledev=ttyS0
diuerr=md e002c014 1
dium=mw e002c01c
diuregs=md e002c000 1d
eth1addr=00:04:9F:01:BE:70
ethact=eTSEC1
ethaddr=00:04:9F:01:BE:6F
fdtaddr=c00000
fdtfile=p1022ds.dtb
flashboot=setenv bootargs root=/dev/ram rw console=ttyS0,115200;bootm ec000000 e8000000 eff00000
gatewayip=128.224.162.1
hostname=p1022ds
hwconfig=audclk:12
ipaddr=128.224.162.252
loadaddr=1000000
loads_echo=1
memctl_intlv_ctl=2
monitor=1-LVDS
mynfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=dhcp console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr
 - $fdtaddr
netdev=eth0
netmask=255.255.254.0
nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate $othbootargs;tftp $load
addr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr
othbootargs=diufb=15M video=fslfb:800x600-24@60,monitor=1 tty0 debug cache-sram=0xfff00000,0x8000
partition=0:3
perf_mode=stable
ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdi
skaddr $fdtaddr
ramdiskaddr=2000000
ramdiskfile=uramdisk
rootpath=/export/pxeboot/rootfs
serverip=128.224.162.215
stderr=serial
stdin=serial
stdout=serial
tftpflash=tftpboot $loadaddr $uboot; protect off 0xeff80000 +$filesize; erase 0xeff80000 +$filesize; cp.b $loadaddr 0xeff80000 $filesize; protect on 0xeff80000 +$filesize; cmp.b $loadad
dr 0xeff80000 $filesize
uboot=u-boot.bin

Environment size: 2060/8188 bytes
##############

Boot up via nfs:
run mynfsboot 

Boot up via disk:
setenv bootcmd 'setenv bootargs root=/dev/sda3 rw console=$consoledev,$baudrate $othbootargs; sata init; ext2load sata 0:3 $loadaddr /boot/uImage; ext2load sata 0:3 $fdtaddr /boot/p1022ds.dtb; bootm $loadaddr - $fdtaddr'
boot
Comment 5 Chunrong Guo 2013-07-29 09:27:19 UTC
Hello,
################################
my uboot information:
U-Boot 2011.12-00064-gbfb0c9a (Jun 15 2012 - 18:00:53)

CPU0:  P1022E, Version: 1.1, (0x80ee0011)
Core:  E500, Version: 5.1, (0x80211151)
Clock Configuration:
       CPU0:999.990 MHz, CPU1:999.990 MHz, 
       CCB:499.995 MHz,
       DDR:333.330 MHz (666.660 MT/s data rate) (Asynchronous), LBC:31.250 MHz
L1:    D-cache 32 kB enabled
       I-cache 32 kB enabled
Board: P1022DS Sys ID: 0x19, Sys Ver: 0x03, FPGA Ver: 0x0a, vBank: 0
I2C:   ready
SPI:   ready
DRAM:  Detected UDIMM i-DIMM
2 GiB (DDR3, 64-bit, CL=6, ECC off)
Flash: 128 MiB
L2:    256 KB enabled
NAND:  1024 MiB
MMC:  FSL_SDHC: 0
EEPROM: NXID v1

My u-boot args:
=> printenv
baudrate=115200
bdev=sda3
bootcmd=setenv bootargs root=/dev/sda3 rw console=ttyS0,115200; bootm ec000000 - eff00000
bootdelay=10
bootfile=uImage
consoledev=ttyS0
diuerr=md e002c014 1
dium=mw e002c01c
diuregs=md e002c000 1d
eth1addr=00:04:9F:02:BB:3C
ethact=eTSEC1
ethaddr=00:04:9F:01:6F:71
fdtaddr=c00000
fdtfile=p1022ds.dtb
gateway=10.192.208.254
gatewayip=10.192.208.254
hostname=p1022ds
hwconfig=esdhc;audclk:12
ipaddr=10.192.208.111
jffs2boot=setenv bootargs root=/dev/mtdblock4 rw rootfstype=jffs2 console=$consoledev,$baudrate $othbootargs;bootm 0xec000000 - 0xeff00000
loadaddr=1000000
memctl_intlv_ctl=2
monitor=0
netdev=eth0
nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr
norboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs;bootm 0xec000000 0xe8000000 0xeff00000
perf_mode=stable
ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddr
ramdiskaddr=2000000
ramdiskfile=uramdisk
resolution=800x600
rootpath=/opt/nfsroot
sataboot=setenv bootargs root=/dev/$bdev rw console=$consoledev,$baudrate $othbootargs;bootm 0xec000000 - 0xeff00000
serverip=10.192.208.136
stderr=serial
stdin=serial
stdout=serial
tftpflash=tftpboot $loadaddr $uboot; protect off 0xeff80000 +$filesize; erase 0xeff80000 +$filesize; cp.b $loadaddr 0xeff80000 $filesize; protect on 0xeff80000 +$filesize; cmp.b $loadaddr 0xeff80000 $filesize
uboot=u-boot.bin

Environment size: 1794/8188 bytes

######################################################

I download the rootfs from: http://autobuilder.yoctoproject.org/pub/nightly/20130724-2/machines/p1022ds/
Boot up via disk:
$setenv bootcmd 'setenv bootargs root=/dev/sda3 rw console=$consoledev,$baudrate $othbootargs; sata init; ext2load sata 0:3 $loadaddr /boot/uImage; ext2load sata 0:3 $fdtaddr /boot/p1022ds.dtb; bootm $loadaddr - $fdtaddr'
$boot
boot information:
INIT: version 2.88 booting
Starting udev
udevd[1424]: starting version 182
Starting Bootlog daemon: bootlogd.
Populating dev cache
EXT3-fs error (device sda3): ext3_lookup: deleted inode referenced: 13
EXT3-fs error (device sda3): ext3_lookup: deleted inode referenced: 13
EXT3-fs error (device sda3): ext3_lookup: deleted inode referenced: 13
EXT3-fs error (device sda3): ext3_lookup: deleted inode referenced: 13
EXT3-fs error (device sda3): ext3_lookup: deleted inode referenced: 13
EXT3-fs error (device sda3): ext3_lookup: deleted inode referenced: 13
EXT3-fs error (device sda3): ext3_lookup: deleted inode referenced: 13
ln: /tmp: Input/output error
Configuring network interfaces... fsl-gianfar ethernet.1 eth0: Could not allocate BDs to SRAM, fallback to DDR
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc (v1.21.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, failing
hwclock: can't open '/dev/misc/rtc': No such file or directory
Wed Jul 24 17:46:00 UTC 2013
hwclock: can't open '/dev/misc/rtc': No such file or directory
Running postinst /etc/rpm-postinsts/sysvinit-inittab...
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
INIT: Entering runlevel: 5
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting syslogd/klogd: done
Stopping Bootlog daemon: bootlogd.

Poky Next (Yocto Project Reference Distro) 1.4+snapshot-20130724 p1022ds /dev/ttyS0


System can boot via sata disk.


can you check uboot version out? or can you try to boot system with sda1 ?
Comment 6 Chunrong Guo 2013-07-29 10:05:05 UTC
Created attachment 1377 [details]
p1022 system boot information

p1022 system boot information
Comment 7 Yi Zhao 2013-07-30 07:10:13 UTC
(In reply to comment #6)
> Created attachment 1377 [details]
> p1022 system boot information
> 
> p1022 system boot information

Hi Chunrong,

Which image do you use ? This issue only happens on sato-sdk image since it is a "dd" command issue.

In sato-sdk image, the dd command is from coreutils package:
#########
root@p1022ds:~# which dd
/bin/dd
root@p1022ds:~# 
root@p1022ds:~# ls -l /bin/dd*
-rwxr-xr-x 1 root root 88300 Jul 19 11:39 /bin/dd.coreutils
lrwxrwxrwx 1 root root    17 Jul 24 19:32 /bin/dd -> /bin/dd.coreutils
root@p1022ds:~# 
##########

Run a test for dd, still segfault:
#########
root@p1022ds:~# dd if=/dev/zero of=testfile count=1
1+0 records in
1+0 records out
512 bytes (512 B) copiedSegmentation fault
##########

In sato image, the dd command is from busybox package:
##########
root@p1022ds:~# ls -l /bin/dd*
lrwxrwxrwx 1 root root    19 Jul 30 06:19 /bin/dd -> /bin/busybox.nosuid
#########

This dd command works well:
###########
root@p1022ds:~# dd if=/dev/zero of=testfile count=1
1+0 records in
1+0 records out
root@p1022ds:~# 
###########

I also test it on other machines (qemuppc, mpc8315e-rdb), there is no this issue.

Would you please confirm it again ? 

Thanks,
Yi
Comment 8 Chunrong Guo 2013-07-30 09:00:10 UTC
p1022ds system boot can work well with core-image-minimal image.
I Can reproduce this issue with core-image-sato-sdk image .

the below error information:
Starting Bootlog daemon: bootlogd.
/etc/rcS.d/S30urandom: line 17:  1895 Segmentation fault      dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 > /dev/null 2>&1
urandom start: failed.
Comment 9 Chunrong Guo 2013-08-09 09:30:15 UTC
 I tried to run dd  through gdb and catch some call stack.

$gdb
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc-fsl_networking-linux-gnuspe".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
$(gdb) file dd
Reading symbols from /bin/dd.coreutils...Reading symbols from /bin/.debug/dd.coreutils...done.
done. 
$(gdb) run  if=/dev/zero of=testfile count=1
Starting program: /bin/dd.coreutils if=/dev/zero of=testfile count=1
warning: Could not load shared library symbols for linux-vdso32.so.1.
Do you need "set solib-search-path" or "set sysroot"?
1+0 records in
1+0 records out
512 bytes (512 B) copied
Program received signal SIGSEGV, Segmentation fault.
0x0fe86f10 in _IO_vfprintf_internal (s=s@entry=0xbffff4b8, format=format@entry=0x1001413c "%.1Lf", ap=ap@entry=0xbffff598) at vfprintf.c:1648
1648              process_arg (((struct printf_spec *) NULL));

"
(gdb) where
#0  0x0fe86f10 in _IO_vfprintf_internal (s=s@entry=0xbffff4b8, format=format@entry=0x1001413c "%.1Lf", ap=ap@entry=0xbffff598) at vfprintf.c:1648
#1  0x0ff32b20 in ___vsprintf_chk (s=0xbffff6c8 "", flags=1, slen=4294967295, format=0x1001413c "%.1Lf", args=args@entry=0xbffff598) at vsprintf_chk.c:85
#2  0x0ff32a48 in ___sprintf_chk (s=<optimized out>, flags=<optimized out>, slen=<optimized out>, format=<optimized out>) at sprintf_chk.c:31
#3  0x10005960 in sprintf (__fmt=0x1001413c "%.1Lf", __s=0xbffff6c8 "") at /local/home/b19537/gcr/freescalepoky/test/poky/build_p1022ds_release/tmp/sysroots/p1022ds/usr/include/bits/stdio2.h:33
#4  human_readable (n=<optimized out>, buf=buf@entry=0xbffff6c8 "", opts=opts@entry=465, from_block_size=<optimized out>, to_block_size=<optimized out>) at /usr/src/debug/coreutils/8.21-r0/coreutils-8.21/lib/human.c:249
#5  0x100036e4 in print_stats () at /usr/src/debug/coreutils/8.21-r0/coreutils-8.21/src/dd.c:714
#6  0x100046a0 in quit (code=code@entry=0) at /usr/src/debug/coreutils/8.21-r0/coreutils-8.21/src/dd.c:859
#7  0x1000204c in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/coreutils/8.21-r0/coreutils-8.21/src/dd.c:2304
##################################################################### 

"segmentation fault"  happend on "sprintf ".


I test other core powerpc boards and there is no issue .

there is the issue only  in e500v2 core boards .
Comment 10 Zhenhua Luo 2013-08-13 02:33:48 UTC
*** Bug 4962 has been marked as a duplicate of this bug. ***
Comment 11 Zhenhua Luo 2013-08-19 09:06:29 UTC
The fix patch is submitted. http://patches.openembedded.org/patch/55967/
Comment 13 Yi Zhao 2013-09-03 06:08:08 UTC
Verified with 1.5 M4 RC2

poky: master/5745e45b18e5099e94b4d5a73bc97dc6d4cdc91f
meta-fsl-ppc: master/58a57096e4b7e2ceca3c33d3e7100c5434966cd9
Comment 14 Stoicescu Cornel 2013-10-09 11:18:37 UTC
Yi, can you please look at DUPLICATE bug https://bugzilla.yoctoproject.org/show_bug.cgi?id=4962 and set its status as apropriate? Thank you :)