* [U-Boot] [PATCH] ubifsmount fails due to not initialized list
@ 2010-04-21 7:47 Stefano Babic
2010-04-28 8:02 ` Stefan Roese
2010-05-05 11:21 ` Quotient Remainder
0 siblings, 2 replies; 6+ messages in thread
From: Stefano Babic @ 2010-04-21 7:47 UTC (permalink / raw)
To: u-boot
ubifsmount is not working and causes an access with
a pointer set to zero because the ubifs_fs_type
is not initialized correctly.
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
fs/ubifs/super.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 391dea4..39e3efe 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1178,6 +1178,7 @@ int ubifs_mount(char *vol_name)
ubifs_umount(ubifs_sb->s_fs_info);
INIT_LIST_HEAD(&ubifs_infos);
+ INIT_LIST_HEAD(&ubifs_fs_type.fs_supers);
/*
* Mount in read-only mode
--
1.6.3.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] ubifsmount fails due to not initialized list
2010-04-21 7:47 [U-Boot] [PATCH] ubifsmount fails due to not initialized list Stefano Babic
@ 2010-04-28 8:02 ` Stefan Roese
2010-05-05 11:21 ` Quotient Remainder
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Roese @ 2010-04-28 8:02 UTC (permalink / raw)
To: u-boot
On Wednesday 21 April 2010 09:47:19 Stefano Babic wrote:
> ubifsmount is not working and causes an access with
> a pointer set to zero because the ubifs_fs_type
> is not initialized correctly.
Applied to u-boot-ubi/master. Thanks.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] ubifsmount fails due to not initialized list
2010-04-21 7:47 [U-Boot] [PATCH] ubifsmount fails due to not initialized list Stefano Babic
2010-04-28 8:02 ` Stefan Roese
@ 2010-05-05 11:21 ` Quotient Remainder
2010-05-05 12:59 ` Stefano Babic
1 sibling, 1 reply; 6+ messages in thread
From: Quotient Remainder @ 2010-05-05 11:21 UTC (permalink / raw)
To: u-boot
On Wed, Apr 21, 2010 at 8:47 AM, Stefano Babic <sbabic@denx.de> wrote:
> ubifsmount is not working and causes an access with
> a pointer set to zero because the ubifs_fs_type
> is not initialized correctly.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> ---
> fs/ubifs/super.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 391dea4..39e3efe 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -1178,6 +1178,7 @@ int ubifs_mount(char *vol_name)
> ubifs_umount(ubifs_sb->s_fs_info);
>
> INIT_LIST_HEAD(&ubifs_infos);
> + INIT_LIST_HEAD(&ubifs_fs_type.fs_supers);
>
> /*
> * Mount in read-only mode
> --
> 1.6.3.3
>
> Out of interest, how did something like this get away with only causing an
occasional failure?
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] ubifsmount fails due to not initialized list
2010-05-05 11:21 ` Quotient Remainder
@ 2010-05-05 12:59 ` Stefano Babic
2010-05-05 14:10 ` Quotient Remainder
0 siblings, 1 reply; 6+ messages in thread
From: Stefano Babic @ 2010-05-05 12:59 UTC (permalink / raw)
To: u-boot
Quotient Remainder wrote:
> Out of interest, how did something like this get away with only causing
> an occasional failure?
Well, there are some explanations. MMU is normally off and a Null
Pointer does not cause an exception in u-boot. If we get a failure, it
depends on the architecture we are using. On PowerPC, address 0 is
accessible and then we get no failure. In this particular case
(ubifsmount), the list is set but not used by the calling function.
Because writing to address 0 is allowed, the bug is not noticeable.
Different is on arm, where I have found the problem. Because in this
case address 0 is not accessible at all, u-boot hangs and it is not
possible to avoid to see that we have a problem....
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] ubifsmount fails due to not initialized list
2010-05-05 12:59 ` Stefano Babic
@ 2010-05-05 14:10 ` Quotient Remainder
2010-05-26 13:20 ` Christian Hohnstaedt
0 siblings, 1 reply; 6+ messages in thread
From: Quotient Remainder @ 2010-05-05 14:10 UTC (permalink / raw)
To: u-boot
On Wed, May 5, 2010 at 1:59 PM, Stefano Babic <sbabic@denx.de> wrote:
> Quotient Remainder wrote:
>
> > Out of interest, how did something like this get away with only causing
> > an occasional failure?
>
> Well, there are some explanations. MMU is normally off and a Null
> Pointer does not cause an exception in u-boot. If we get a failure, it
> depends on the architecture we are using. On PowerPC, address 0 is
> accessible and then we get no failure. In this particular case
> (ubifsmount), the list is set but not used by the calling function.
> Because writing to address 0 is allowed, the bug is not noticeable.
>
> Different is on arm, where I have found the problem. Because in this
> case address 0 is not accessible at all, u-boot hangs and it is not
> possible to avoid to see that we have a problem....
>
>
I've been using UBIFS on arm (1136) with the v2009.11 release and it
works almost all the time. Sometimes U-Boot fails to mount the
UBIFS (1 in 100 boots, maybe), and in these cases I was putting it
down to forgetting to do a sync in Linux before rebooting. I wonder
if this was the problem all along...
> Best regards,
> Stefano Babic
>
> --
> =====================================================================
> DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
> =====================================================================
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] ubifsmount fails due to not initialized list
2010-05-05 14:10 ` Quotient Remainder
@ 2010-05-26 13:20 ` Christian Hohnstaedt
0 siblings, 0 replies; 6+ messages in thread
From: Christian Hohnstaedt @ 2010-05-26 13:20 UTC (permalink / raw)
To: u-boot
Hi,
On Wed, May 05, 2010 at 03:10:20PM +0100, Quotient Remainder wrote:
> On Wed, May 5, 2010 at 1:59 PM, Stefano Babic <sbabic@denx.de> wrote:
>
> > Quotient Remainder wrote:
> >
> > > Out of interest, how did something like this get away with only causing
> > > an occasional failure?
> >
> > Well, there are some explanations. MMU is normally off and a Null
> > Pointer does not cause an exception in u-boot. If we get a failure, it
> > depends on the architecture we are using. On PowerPC, address 0 is
> > accessible and then we get no failure. In this particular case
> > (ubifsmount), the list is set but not used by the calling function.
> > Because writing to address 0 is allowed, the bug is not noticeable.
> >
> > Different is on arm, where I have found the problem. Because in this
> > case address 0 is not accessible at all, u-boot hangs and it is not
> > possible to avoid to see that we have a problem....
> >
> >
> I've been using UBIFS on arm (1136) with the v2009.11 release and it
> works almost all the time. Sometimes U-Boot fails to mount the
> UBIFS (1 in 100 boots, maybe), and in these cases I was putting it
> down to forgetting to do a sync in Linux before rebooting. I wonder
> if this was the problem all along...
Probably not.
IMHO rebooting without a sync is pretty common and should work.
With v2009.11 and the "INIT_LIST_HEAD(&ubifs_fs_type.fs_supers);" fix
I was able to force a mount-failure of UBIFS in u-boot by
executing some tar under linux in parallel
and pulling the plug in the meantime:
"tar zxf some_tar.tgz & mkdir -p P; tar zxf some_tar.tgz -C P"
I fixed it ("fixed" as in http://thereifixedit.com) by disabling
journal-replaying.
In fs/ubifs/super.c:686 I skipped "ubifs_replay_journal(c)".
Without that "fix" I needed the linux kernel to once mount the volume
and replay the journal. Afterwards everything was fine on next
volume mount in u-boot.
I failed to find the cause in ubifs_replay_journal().
How harmful is the skipping of ubifs_replay_journal() ?
Does someone have a real fix ?
Christian Hohnstaedt
--
Christian Hohnstaedt / Project Manager Hardware and Manufacturing
Innominate Security Technologies AG / protecting industrial networks
tel: +49.30.921028.208 / fax: +49.30.921028.020
Rudower Chaussee 13, D-12489 Berlin / http://www.innominate.com
Register Court: AG Charlottenburg, HR B 81603
Management Board: Dirk Seewald
Chairman of the Supervisory Board: Volker Bibelhausen
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-05-26 13:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21 7:47 [U-Boot] [PATCH] ubifsmount fails due to not initialized list Stefano Babic
2010-04-28 8:02 ` Stefan Roese
2010-05-05 11:21 ` Quotient Remainder
2010-05-05 12:59 ` Stefano Babic
2010-05-05 14:10 ` Quotient Remainder
2010-05-26 13:20 ` Christian Hohnstaedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox