Skip to contentSkip to conversation

Infinite loop regression due to recent change in hostfs.c

DISCUSSION Christian Franke 3 participants 4 messages Apr 5, 2008 – Apr 13, 2008

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines · Pavel Roskin

...
Log message:
2008-03-30 Pavel Roskin <...>

Quoted 8 lines

* disk/host.c: Include grub/misc.h to fix a warning.
* util/hostfs.c: Use GRUB_MOD_INIT and GRUB_MOD_FINI to fix warnings about implicit declarations.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/grub2/ChangeLog?cvsroot=grub&r1=1.618&r2=1.619
http://cvs.savannah.gnu.org/viewcvs/grub2/disk/host.c?cvsroot=grub&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/grub2/util/hostfs.c?cvsroot=grub&r1=1.4&r2=1.5

The change in hostfs.c introduces an interesting regression: hostfs now appears in *_init.lst and grub_hostfs_init() is called twice in grub-emu and grub-fstest. This results in a infinite loop because the hostfs entry of grub_fs_list points to itself.

Demo version :-)

$ grub-fstest -d all /dev/sdX ls -l | grep Detecting | head -10000 | uniq -c

You should either undo this change or remove extra calls to grub_hostfs_init/fini from grub-emu.c and grub-fstest.c. The latter might not work if it is necessary to init hostfs first for some reason.

Christian

#1 lore raw

Quoting Christian Franke <[email protected]>:

Quoted 4 lines

The change in hostfs.c introduces an interesting regression: hostfs now appears in *_init.lst and grub_hostfs_init() is called twice in grub-emu and grub-fstest. This results in a infinite loop because the hostfs entry of grub_fs_list points to itself.

Thanks for noticing the problem and for the analysis!

Quoted 3 lines

You should either undo this change or remove extra calls to grub_hostfs_init/fini from grub-emu.c and grub-fstest.c. The latter might not work if it is necessary to init hostfs first for some reason.

I've removed the extra calls. I don't see any reasons why hostfs should be registered first.

Signature · 2 lines
Regards,
Pavel Roskin
#2 lore raw
Quoted 8 lines · Pavel Roskin

Quoting Christian Franke <...>:

Quoted 3 lines

You should either undo this change or remove extra calls to grub_hostfs_init/fini from grub-emu.c and grub-fstest.c. The latter might not work if it is necessary to init hostfs first for some reason.

I've removed the extra calls. I don't see any reasons why hostfs should be registered first.

It now works as expected.

Christian

#3 lore raw
In reply to Pavel Roskin
Quoted 7 lines · Pavel Roskin

Quoting Christian Franke <[email protected]>:

Quoted 4 lines

The change in hostfs.c introduces an interesting regression: hostfs now appears in *_init.lst and grub_hostfs_init() is called twice in grub-emu and grub-fstest. This results in a infinite loop because the hostfs entry of grub_fs_list points to itself.

Quoted 8 lines

Thanks for noticing the problem and for the analysis!

Quoted 3 lines

You should either undo this change or remove extra calls to grub_hostfs_init/fini from grub-emu.c and grub-fstest.c. The latter might not work if it is necessary to init hostfs first for some reason.

I've removed the extra calls. I don't see any reasons why hostfs should be registered first.

I suspect it was a remnant from before we had grub_init_all().

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)