On Sam, 2005-09-03 at 08:24 +0200, Jürg Billeter wrote:
> On Sam, 2005-09-03 at 10:35 +1000, Greg Schafer wrote:
> > Better still, we should just find the bug and fix it. Why pessimize the
> > whole of Util-linux just because of an intermittent bug in cfdisk? It's a
> > bad workaround IMHO. Surely someone who is able to reproduce the crash can
> > obtain a backtrace so we at least know where to start looking?
> 
> It's not as easy as it sounds. As it's very likely that it's a GCC
> optimization bug you can't really debug the compiled cfdisk as the
> generated code is wrong. The stack after the SEGV is completely
> destroyed, gdb doesn't help at all.

Ok, it's not a gcc bug at all... The SEGV seems to have destroyed some
debug info on the stack and that's the reason gdb didn't help. The
problem occured on all systems with linux partitions that don't have a
ext2/ext3, xfs, or jfs filesystem as the crash happens during the
reiserfs check which is the last one by hazard. The patch speaks for
itself, I have no idea why this doesn't crash with other gcc versions /
optimization settings, must be luck...

Regards,

Jürg
-- 
Jürg Billeter <[EMAIL PROTECTED]>
diff -pur util-linux-2.12q.orig/fdisk/cfdisk.c util-linux-2.12q/fdisk/cfdisk.c
--- util-linux-2.12q.orig/fdisk/cfdisk.c	2004-12-22 19:06:01.000000000 +0100
+++ util-linux-2.12q/fdisk/cfdisk.c	2005-09-03 10:24:19.000000000 +0200
@@ -717,7 +717,7 @@ get_linux_label(int i) {
 	offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
 		+ REISERFS_DISK_OFFSET_IN_BYTES;
 	if (ext2_llseek(fd, offset, SEEK_SET) == offset
-	    && read(fd, &reiserfsb, 1024) == 1024
+	    && read(fd, &reiserfsb, sizeof (struct reiserfs_super_block)) == sizeof (struct reiserfs_super_block)
 	    && has_reiserfs_magic_string(&reiserfsb, &reiserfs_is_3_6)) {
 		if (reiserfs_is_3_6) {
 			/* label only on version 3.6 onward */
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to