[uClinux-dev] XIP broken in 2.4.31-uc0 ? (fwd)

David McCullough davidm at snapgear.com
Fri Oct 7 06:14:08 EDT 2005


Erwin/Michael,

Try the attached patch,  I am fairly sure this will fix the problems,
just so happens that on my two test systems "sh" was a special case,
but I could reproduce by running another long lived program,

Cheers,
Davidm

Jivin David McCullough lays it down ...
> 
> Jivin Erwin Authried lays it down ...
> > Am Don, den 06.10.2005 schrieb David McCullough um 12:43:
> > > Jivin Erwin Authried lays it down ...
> > > > Hi David,
> > > > it doesn't crash, I'm only getting those messages when an app is
> > > > started:
> > > > 
> > > > kernel BUG at mmap.c:1343!
> > > 
> > > I don't understand that,  something must still be wrong.
> > > There were a lot of things I fixed that should mean this bug can no
> > > longer happen.  Obviously still more to go.
> > > 
> > > Are you getting this for every app or just a particular app ?
> > > Can you run multiple copies of "sh" now without errors ?
> > > 
> > I'm using busybox with msh compiled in. Just for clarifying, there are
> > no crashes, just this "kernel BUG ..." message. That's what happens when
> > I invoke sh two times:
> > -------------------------------------------------------------
> > # sh
> > BINFMT_FLAT: Loading file: /bin/sh
> > kernel BUG at mmap.c:1343!
> > Mapping is 7f0d6e20, Entry point is 50, data_start is 304a0
> > Load /bin/sh: TEXT=7f0d6e60-7f1072c0 DATA=340004-347874
> > BSS=347874-35b214
> > 
> > 
> > BusyBox v1.00 (2005.10.05-08:34+0000) Built-in shell (msh)
> > Enter 'help' for a list of built-in commands.
> > 
> > # sh
> > BINFMT_FLAT: Loading file: /bin/sh
> > kernel BUG at mmap.c:1343!
> > kernel BUG at mmap.c:1343!
> > Mapping is 7f0d6e20, Entry point is 50, data_start is 304a0
> > Load /bin/sh: TEXT=7f0d6e60-7f1072c0 DATA=2c0004-2c7874
> > BSS=2c7874-2db214
> > 
> > 
> > BusyBox v1.00 (2005.10.05-08:34+0000) Built-in shell (msh)
> > Enter 'help' for a list of built-in commands.
> > 
> > #
> > -------------------------------------------------------------
> > 
> > It seems to happen with every application that is executed from romfs
> > after two or more invocations. I have verified that the message doesn't
> > show up when applications are executed via NFS, although the text
> > segment is shared with NFS too.
> > 
> > I tried a very small testapplication from romfs:
> > 
> > main(){ while(1) ; }
> > 
> > I get the following output when I start this app 4x in the background:
....

-- 
David McCullough, davidm at cyberguard.com.au, Custom Embedded Solutions + Security
Ph:+61 734352815 Fx:+61 738913630 http://www.uCdot.org http://www.cyberguard.com
-------------- next part --------------
Index: linux-2.4.x/fs/romfs/inode.c
===================================================================
RCS file: /cvs/sw/linux-2.4.x/fs/romfs/inode.c,v
retrieving revision 1.6
diff -u -r1.6 inode.c
--- linux-2.4.x/fs/romfs/inode.c	25 Jul 2005 01:56:24 -0000	1.6
+++ linux-2.4.x/fs/romfs/inode.c	7 Oct 2005 06:10:16 -0000
@@ -438,10 +438,14 @@
 romfs_romptr(struct file * filp, struct vm_area_struct * vma)
 {
 	struct inode * inode = filp->f_dentry->d_inode;
+	unsigned int pgoff = vma->vm_pgoff;
 	vma->vm_pgoff += (inode->u.romfs_i.i_dataoffset >> PAGE_SHIFT);
 
-	if ((vma->vm_flags & VM_WRITE) || bromptr(inode->i_dev, vma))
+	if ((vma->vm_flags & VM_WRITE) || bromptr(inode->i_dev, vma)) {
+		vma->vm_pgoff = pgoff;
 		return -ENOSYS;
+	}
+	vma->vm_pgoff = pgoff;
 
 	vma->vm_start += (inode->u.romfs_i.i_dataoffset & ~PAGE_MASK);
 	vma->vm_end   += (inode->u.romfs_i.i_dataoffset & ~PAGE_MASK);


More information about the uClinux-dev mailing list