Skip to contentSkip to conversation

SPT& &bugreport about ext2

DISCUSSION Vincent Pelletier 2 participants 2 messages Dec 12, 2004

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.
I'm the main developer of the SPT project, aimed at replacing the current DOS partition system, and maybe to offer a unified and open-sourced partitioning system. (more details on http://spt.sysif.net/ )

I've integrated my system to the grub 2 current cvs version (see CVSweb at cvs.sysif.net, "spt_base" module, "grub2" folder), and I have met some problems in its integration that I would like to mention here.

1) My test computer wasn't able to boot grub 2 when booting from disk, but it was ok when booting from a floppy. It was because that piece of code was removed in boot/i386/pc/boot.S compared to legacy's stage 1 :
(line 111)

	/*
	 * This is a workaround for buggy BIOSes which don't pass boot
	 * drive correctly. If GRUB is installed into a HDD, do
	 * "orb $0x80, %dl", otherwise "orb $0x00, %dl" (i.e. nop).
	 */
	.byte	0x80, 0xca
boot_drive_mask:
	.byte	0x00

(the last byte has to be set to 0x80 to make it work)

Why was it removed ?

2) I am now stuck at a memory allocation problem. When I set the dos partition number to make grub2 read the grub.cfg file, it results in "alloc magic is broken at 0x1f640".
More details:
- -disk partitioned in SPT format
- -4 partitions (1 swap, 3 ext2 all fsck'ed)
- -/boot/grub exists in 2nd partition (1st ext2), but not the config file (when the config file is present, the menu is partialy drawn and the computer freezes)
- -dos partition number : 01 00 00 00 (big endian)
- -bsd partition number : FF FF FF FF (big endian)
- -makes qemu segfaults, bochs works fine
- -works fine with partitions 2 & 3 (prefix variable is correctly set and I get the prompt)

I found that it cames from a grub_free call in the last lines of grub_ext2_dir function, and caused by "grub_ext2_iterate_dir (fdiro, iterate);".
By the way, I noticed that a freed memory area is accessed :
fail:
~ grub_free (data);
~ if (fdiro != &(data->diropen))
~ grub_free (fdiro);
Moreover, the "fail" label is reached when data malloc fails, so it tries to free an unallocated area in case of problem.

Vincent Pelletier
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBvKAeFEQoKRQyjtURAlSTAJ9zGiVR/K5LCP1dy1pCqAVD5pMrewCcDFBc U+TcX3cxQLyvJmlZzqN6yNQ=
=wlrY
-----END PGP SIGNATURE-----

#1 lore raw

Vincent Pelletier <[email protected]> writes:

Hi Vincent,

Thanks a lot for your bug report.

Quoted 3 lines

I found that it cames from a grub_free call in the last lines of grub_ext2_dir function, and caused by "grub_ext2_iterate_dir (fdiro, iterate);".

Ok, I will have a look at this and fix this ASAP.

Quoted 2 lines

Moreover, the "fail" label is reached when data malloc fails, so it tries to free an unallocated area in case of problem.

It is no problem to call grub_free when the pointer is a null pointer.

Thanks,
Marco