Clobbered file after jffs2 mount
Jon Ringle
JRingle at vertical.com
Fri Sep 21 21:35:04 EDT 2007
On Friday, September 21, 2007 19:39, David Woodhouse wrote:
> On Fri, 2007-09-21 at 13:23 -0400, Jon Ringle wrote:
> > I have a jffs2 filesystem on my target (IXP455 processor) running
Linux
> > 2.6.16.29. Sometimes the first time that Linux mounts the jffs2
> > filesystem after reflashing the jffs2 image, sshd would strangely
> > misbehave and not allow incoming connections. After much
> > troubleshooting, it was discovered that the md5sum of the sshd file
was
> > different than the expected md5sum. However, if the system is
rebooted,
> > then sshd works correctly and the md5sum of sshd on the target
magically
> > corrected itself to the expected value.
>
> My first inclination is to suspect that somehow the pages of sshd got
> scribbled on in RAM. Is the corruption repeatable?
This is also what I suspect. The corruption is repeatable on the first
boot after a reflash of the jffs2 filesystem about 90% of the time. One
thing that is different on the first boot is that ssh keys get generated
on that first boot.
>
> Can you instrument jffs2_read_inode_range() to print a hex dump of the
> "offending" bytes as soon as they've been read?
Thanks David. This information will help further my investigation now
that you've pointed me towards how I can find the sshd image in RAM
pages. I will attach my JTAG debugger when I'm next in the office and
use GDB to extract a dump of the RAM sshd image using a conditional
breakpoint with sshd's inode number in jffs2_read_inode_range(). I will
also try to locate the clobbered bytes so I can put a data breakpoint on
it to see if I can get a backtrace pointing to what is causing the
corruption.
>
> Can you boot directly into a shell (init=/bin/sh) and then md5sum the
> offending file?
I tried init=/bin/sh on a first boot after reflash and the md5sum of
sshd was correct. I then rebooted again normally and the ssh keys were
generated. When I logged in, the md5sum of sshd was wrong. The
corruption that I observe is always the same incorrect md5sum.
Jon
More information about the linux-mtd
mailing list