Hello again
This has been narrowed down to a mmap issue when loading shared
libraries of the new root.  First mmap of the read-execute section of
the file functions properly.  Second mmap of the read-write section
reads bad data if it is not read before the file is closed.  That is
to say, if the read-write section is read before closing the file the
data is always good from then on--which explains why busybox only
crashes once (the first time).  Browsing CVS, v1.45 of f_op.c contains
the comment "copyup a file immidiately at being mmap()ed which was
opened with FMODE_WRITE flag"... I wonder could this be related at
all?
Thanks again
Derek


On Fri, Apr 17, 2009 at 9:57 AM, Derek Spadaro <[email protected]> wrote:
> Hello aufs-users
> I am using AUFS as my root filesystem, the latest AUFS1 from
> aufs.cvs.sourceforge.net with Linux 2.6.21.5 running on MIPS.  The
> issue I see is that immediately after switchroot busybox will seg
> fault the first time.  If I do not use AUFS this does not happen.  To
> work around the issue (found by trial and error) I can link /lib to
> the newroot and run busybox once like this so it crashes and then run
> switchroot--relevant init excerpt below.  So I guess some kind of
> aufs-related library caching issue?  Has anyone seen something like
> this before or might know a good place to find out more why this could
> be happening?
> Thanks much
> Derek
>
> ...
> echo "=== Using AUFS ==="
> mount -t jffs2 /dev/mtdblock1 /mnt
> mount -t tmpfs -o size=32M,nr_inodes=1k,mode=0700 tmpfs /rw
> mount -t squashfs -o loop,ro /mnt/squashfs /sfs
> mount -t aufs -o dirs=/rw:/sfs=ro none /newroot
>
> echo "=== making newroot ==="
> export ROOTFS=/newroot
> /sfs/etc/MAKEDEV
>
> mkdir /newroot/rw
> mkdir /newroot/mnt
> mkdir /newroot/sfs
>
> mount --move /rw /newroot/rw
> mount --move /mnt /newroot/mnt
> mount --move /sfs /newroot/sfs
> umount /cf
> umount /proc
>
> echo "=== Doing the crazy stuff to make it work ==="
> rmdir /lib
> ln -s /newroot/lib lib
> echo "/newroot/bin/busybox" | /bin/sh
>
> if [ $? -ne 0 ]; then
>        getout
> fi
>
> echo "=== Calling switch_root ==="
> exec switch_root -c /dev/console /newroot /sbin/init
>
> echo "switch_root failed $?"
>
> mount -t proc proc /proc
> exec /bin/sh
> ...
>

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p

Reply via email to