All of lore.kernel.org
 help / color / mirror / Atom feed
* libfdisk show stopper on i586?
@ 2016-10-25 22:00 Ruediger Meier
  2016-10-26  0:26 ` Yuriy M. Kaminskiy
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ruediger Meier @ 2016-10-25 22:00 UTC (permalink / raw)
  To: util-linux

Hi,

looks like some of the last commits between v2.29-rc2-1-ge5cc93b
and v2.29-rc2-22-g82e8dda introduced issues on some i586 systems.

For example on  Fedora 19 i586:


[  202.120451] systemd-coredump[8629]: Failed to send coredump: No such file or directory
/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/tests/ts/fdisk/gpt: line 37:  8615 Aborted                 (core dumped) $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} >> $TS_OUTPUT 2>&1

        fdisk: GPT                                           ... FAILED (fdisk/gpt)

## test diff
--- /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/tests/expected/fdisk/gpt   2016-03-29 19:30:31.588100795 +0000
+++ /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/tests/output/fdisk/gpt     2016-10-25 20:44:55.972000000 +0000
@@ -2,137 +2,462 @@
 Create new GPT partition table

 ---layout----------
+*** Error in `/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk': munmap_chunk(): invalid pointer: 0xf7733b73 ***
+======= Backtrace: =========
+/lib/libc.so.6(+0x74804)[0xf74a8804]
+/lib/libc.so.6(+0x17c7f)[0xf744bc7f]
+/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_reset_labelitem+0x83)[0xf76ec2d3]
+/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_get_disklabel_item+0x40)[0xf76f1700]
+/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_get_disklabel_id+0x5c)[0xf76f192c]
+/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk[0x80525a0]
+/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk[0x80535f8]
+/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk[0x804d330]
+/lib/libc.so.6(__libc_start_main+0xf3)[0xf744d963]
+/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk[0x804d615]
+======= Memory map: ========
+08048000-08062000 r-xp 00000000 08:00 754020                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk
+08062000-08063000 r--p 00019000 08:00 754020                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk
+08063000-08064000 rw-p 0001a000 08:00 754020                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk
+08064000-08065000 rw-p 00000000 00:00 0
+08d34000-08d55000 rw-p 00000000 00:00 0                                  [heap]
+f7414000-f742f000 r-xp 00000000 08:00 384797                             /usr/lib/libgcc_s-4.8.1-20130603.so.1
+f742f000-f7430000 r--p 0001a000 08:00 384797                             /usr/lib/libgcc_s-4.8.1-20130603.so.1
+f7430000-f7431000 rw-p 0001b000 08:00 384797                             /usr/lib/libgcc_s-4.8.1-20130603.so.1
+f7434000-f75ec000 r-xp 00000000 08:00 384806                             /usr/lib/libc-2.17.so
+f75ec000-f75ee000 r--p 001b7000 08:00 384806                             /usr/lib/libc-2.17.so
+f75ee000-f75ef000 rw-p 001b9000 08:00 384806                             /usr/lib/libc-2.17.so
+f75ef000-f75f2000 rw-p 00000000 00:00 0
+f75f4000-f762b000 r-xp 00000000 08:00 385173                             /usr/lib/libreadline.so.6.2
+f762b000-f762c000 r--p 00037000 08:00 385173                             /usr/lib/libreadline.so.6.2
+f762c000-f762f000 rw-p 00038000 08:00 385173                             /usr/lib/libreadline.so.6.2
+f762f000-f7631000 rw-p 00000000 00:00 0
+f7634000-f7653000 r-xp 00000000 08:00 384963                             /usr/lib/libtinfo.so.5.9
+f7653000-f7655000 r--p 0001e000 08:00 384963                             /usr/lib/libtinfo.so.5.9
+f7655000-f7656000 rw-p 00020000 08:00 384963                             /usr/lib/libtinfo.so.5.9
+f7664000-f768b000 r-xp 00000000 08:00 752363                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libsmartcols.so.1.1.0
+f768b000-f768c000 r--p 00026000 08:00 752363                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libsmartcols.so.1.1.0
+f768c000-f768d000 rw-p 00027000 08:00 752363                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libsmartcols.so.1.1.0
+f768d000-f768e000 rw-p 00000000 00:00 0
+f7693000-f7694000 rw-p 00000000 00:00 0
+f7694000-f7698000 r-xp 00000000 08:00 752357                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libuuid.so.1.3.0
+f7698000-f7699000 r--p 00003000 08:00 752357                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libuuid.so.1.3.0
+f7699000-f769a000 rw-p 00004000 08:00 752357                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libuuid.so.1.3.0
+f769a000-f769c000 rw-p 00000000 00:00 0
+f769c000-f76df000 r-xp 00000000 08:00 752378                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libblkid.so.1.1.0
+f76df000-f76e0000 ---p 00043000 08:00 752378                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libblkid.so.1.1.0
+f76e0000-f76e2000 r--p 00043000 08:00 752378                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libblkid.so.1.1.0
+f76e2000-f76e3000 rw-p 00045000 08:00 752378                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libblkid.so.1.1.0
+f76e3000-f76e4000 rw-p 00000000 00:00 0
+f76e4000-f7742000 r-xp 00000000 08:00 752383                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1.1.0
+f7742000-f7743000 r--p 0005d000 08:00 752383                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1.1.0
+f7743000-f7745000 rw-p 0005e000 08:00 752383                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1.1.0
+f7745000-f7747000 rw-p 00000000 00:00 0
+f7747000-f774a000 r--p 00000000 00:00 0                                  [vvar]
+f774a000-f774c000 r-xp 00000000 00:00 0                                  [vdso]
+f774c000-f776b000 r-xp 00000000 08:00 384799                             /usr/lib/ld-2.17.so
+f776b000-f776c000 r--p 0001e000 08:00 384799                             /usr/lib/ld-2.17.so
+f776c000-f776d000 rw-p 0001f000 08:00 384799                             /usr/lib/ld-2.17.so
+f776d000-f776f000 rw-p 00000000 00:00 0
+ffb6a000-ffb8b000 rw-p 00000000 00:00 0                                  [stack]


cu,
Rudi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-25 22:00 libfdisk show stopper on i586? Ruediger Meier
@ 2016-10-26  0:26 ` Yuriy M. Kaminskiy
  2016-10-26  8:17   ` Karel Zak
  2016-10-26  9:29 ` Ruediger Meier
  2016-10-26 10:13 ` Karel Zak
  2 siblings, 1 reply; 11+ messages in thread
From: Yuriy M. Kaminskiy @ 2016-10-26  0:26 UTC (permalink / raw)
  To: util-linux

Ruediger Meier writes:

> looks like some of the last commits between v2.29-rc2-1-ge5cc93b
> and v2.29-rc2-22-g82e8dda introduced issues on some i586 systems.
>
> For example on  Fedora 19 i586:

I doubt it is related, but while looking at this diff I noticed some
pretty broken (even if accedintally working) code:

=== cut libfdisk/src/gpt.c ===
	const char *p = str;
...
                } else if (isdigit((unsigned int) *p)
=== cut ===

(Assuming signed char), this does not work quite as authors of this code
must have expected: it *sign-extend* `*p` to `int`, then converts it to
`unsigned int`. E.g. if `*p` is '\201', then ((unsigned int)*p) is
4294967169.
(fortunately, isdigit() takes `int` argument, so it should be converted back
to -127, with no problem in the end; but buggy ctype.h or buggy
compiler can turn it into sigsegv)

There either should be no explict cast here, or it should've been
`(unsigned char)*p` instead.

> [  202.120451] systemd-coredump[8629]: Failed to send coredump: No such file or directory
> /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/tests/ts/fdisk/gpt: line 37:  8615 Aborted                 (core dumped) $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} >> $TS_OUTPUT 2>&1
>
>         fdisk: GPT                                           ... FAILED (fdisk/gpt)
>
> ## test diff
> --- /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/tests/expected/fdisk/gpt   2016-03-29 19:30:31.588100795 +0000
> +++ /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/tests/output/fdisk/gpt     2016-10-25 20:44:55.972000000 +0000
> @@ -2,137 +2,462 @@
>  Create new GPT partition table
>
>  ---layout----------
> +*** Error in `/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk': munmap_chunk(): invalid pointer: 0xf7733b73 ***
> +======= Backtrace: =========
> +/lib/libc.so.6(+0x74804)[0xf74a8804]
> +/lib/libc.so.6(+0x17c7f)[0xf744bc7f]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_reset_labelitem+0x83)[0xf76ec2d3]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_get_disklabel_item+0x40)[0xf76f1700]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_get_disklabel_id+0x5c)[0xf76f192c]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk[0x80525a0]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk[0x80535f8]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk[0x804d330]
> +/lib/libc.so.6(__libc_start_main+0xf3)[0xf744d963]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk[0x804d615]
> +======= Memory map: ========
> +08048000-08062000 r-xp 00000000 08:00 754020                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk
> +08062000-08063000 r--p 00019000 08:00 754020                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk
> +08063000-08064000 rw-p 0001a000 08:00 754020                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/lt-fdisk
> +08064000-08065000 rw-p 00000000 00:00 0
> +08d34000-08d55000 rw-p 00000000 00:00 0                                  [heap]
> +f7414000-f742f000 r-xp 00000000 08:00 384797                             /usr/lib/libgcc_s-4.8.1-20130603.so.1
> +f742f000-f7430000 r--p 0001a000 08:00 384797                             /usr/lib/libgcc_s-4.8.1-20130603.so.1
> +f7430000-f7431000 rw-p 0001b000 08:00 384797                             /usr/lib/libgcc_s-4.8.1-20130603.so.1
> +f7434000-f75ec000 r-xp 00000000 08:00 384806                             /usr/lib/libc-2.17.so
> +f75ec000-f75ee000 r--p 001b7000 08:00 384806                             /usr/lib/libc-2.17.so
> +f75ee000-f75ef000 rw-p 001b9000 08:00 384806                             /usr/lib/libc-2.17.so
> +f75ef000-f75f2000 rw-p 00000000 00:00 0
> +f75f4000-f762b000 r-xp 00000000 08:00 385173                             /usr/lib/libreadline.so.6.2
> +f762b000-f762c000 r--p 00037000 08:00 385173                             /usr/lib/libreadline.so.6.2
> +f762c000-f762f000 rw-p 00038000 08:00 385173                             /usr/lib/libreadline.so.6.2
> +f762f000-f7631000 rw-p 00000000 00:00 0
> +f7634000-f7653000 r-xp 00000000 08:00 384963                             /usr/lib/libtinfo.so.5.9
> +f7653000-f7655000 r--p 0001e000 08:00 384963                             /usr/lib/libtinfo.so.5.9
> +f7655000-f7656000 rw-p 00020000 08:00 384963                             /usr/lib/libtinfo.so.5.9
> +f7664000-f768b000 r-xp 00000000 08:00 752363                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libsmartcols.so.1.1.0
> +f768b000-f768c000 r--p 00026000 08:00 752363                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libsmartcols.so.1.1.0
> +f768c000-f768d000 rw-p 00027000 08:00 752363                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libsmartcols.so.1.1.0
> +f768d000-f768e000 rw-p 00000000 00:00 0
> +f7693000-f7694000 rw-p 00000000 00:00 0
> +f7694000-f7698000 r-xp 00000000 08:00 752357                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libuuid.so.1.3.0
> +f7698000-f7699000 r--p 00003000 08:00 752357                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libuuid.so.1.3.0
> +f7699000-f769a000 rw-p 00004000 08:00 752357                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libuuid.so.1.3.0
> +f769a000-f769c000 rw-p 00000000 00:00 0
> +f769c000-f76df000 r-xp 00000000 08:00 752378                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libblkid.so.1.1.0
> +f76df000-f76e0000 ---p 00043000 08:00 752378                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libblkid.so.1.1.0
> +f76e0000-f76e2000 r--p 00043000 08:00 752378                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libblkid.so.1.1.0
> +f76e2000-f76e3000 rw-p 00045000 08:00 752378                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libblkid.so.1.1.0
> +f76e3000-f76e4000 rw-p 00000000 00:00 0
> +f76e4000-f7742000 r-xp 00000000 08:00 752383                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1.1.0
> +f7742000-f7743000 r--p 0005d000 08:00 752383                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1.1.0
> +f7743000-f7745000 rw-p 0005e000 08:00 752383                             /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1.1.0
> +f7745000-f7747000 rw-p 00000000 00:00 0
> +f7747000-f774a000 r--p 00000000 00:00 0                                  [vvar]
> +f774a000-f774c000 r-xp 00000000 00:00 0                                  [vdso]
> +f774c000-f776b000 r-xp 00000000 08:00 384799                             /usr/lib/ld-2.17.so
> +f776b000-f776c000 r--p 0001e000 08:00 384799                             /usr/lib/ld-2.17.so
> +f776c000-f776d000 rw-p 0001f000 08:00 384799                             /usr/lib/ld-2.17.so
> +f776d000-f776f000 rw-p 00000000 00:00 0
> +ffb6a000-ffb8b000 rw-p 00000000 00:00 0                                  [stack]


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-26  0:26 ` Yuriy M. Kaminskiy
@ 2016-10-26  8:17   ` Karel Zak
  0 siblings, 0 replies; 11+ messages in thread
From: Karel Zak @ 2016-10-26  8:17 UTC (permalink / raw)
  To: Yuriy M. Kaminskiy; +Cc: util-linux

On Wed, Oct 26, 2016 at 03:26:20AM +0300, Yuriy M. Kaminskiy wrote:
> I doubt it is related, but while looking at this diff I noticed some
> pretty broken (even if accedintally working) code:
> 
> === cut libfdisk/src/gpt.c ===
> 	const char *p = str;
> ...
>                 } else if (isdigit((unsigned int) *p)
> === cut ===

Fixed, I found it on another places too (probably my mistakes, sorry).

> There either should be no explict cast here, or it should've been
> `(unsigned char)*p` instead.

We usually use (unsigned char), so to be consistent I have replaced
the "unsigned int" with "unsigned char".

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-25 22:00 libfdisk show stopper on i586? Ruediger Meier
  2016-10-26  0:26 ` Yuriy M. Kaminskiy
@ 2016-10-26  9:29 ` Ruediger Meier
  2016-10-26  9:53   ` Ruediger Meier
  2016-10-26 14:50   ` Ruediger Meier
  2016-10-26 10:13 ` Karel Zak
  2 siblings, 2 replies; 11+ messages in thread
From: Ruediger Meier @ 2016-10-26  9:29 UTC (permalink / raw)
  To: util-linux

On Wednesday 26 October 2016, Ruediger Meier wrote:
> Hi,
>
> looks like some of the last commits between v2.29-rc2-1-ge5cc93b
> and v2.29-rc2-22-g82e8dda introduced issues on some i586 systems.
>
> For example on  Fedora 19 i586:
>
>
> [  202.120451] systemd-coredump[8629]: Failed to send coredump: No
> such file or directory
> /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/tests/ts/fdi
>sk/gpt: line 37:  8615 Aborted                 (core dumped)
> $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} >> $TS_OUTPUT 2>&1
>
>         fdisk: GPT                                           ...
> FAILED (fdisk/gpt)

I've run it in gdb (last "unsigned int" fixes already applied):

 +Program received signal SIGABRT, Aborted.
 +0xf7d9502c in raise () from /lib/libc.so.6
 +#0  0xf7d9502c in raise () from /lib/libc.so.6
 +#1  0xf7d9670e in abort () from /lib/libc.so.6
 +#2  0xf7dd3ca8 in __libc_message () from /lib/libc.so.6
 +#3  0xf7dd9e43 in malloc_printerr () from /lib/libc.so.6
 +#4  0xf7dd9f20 in munmap_chunk () from /lib/libc.so.6
 +#5  0xf7f7cdd3 in fdisk_reset_labelitem (li=li@entry=0xffffd318) at libfdisk/src/item.c:75
 +#6  0xf7f820ef in fdisk_get_disklabel_item (cxt=cxt@entry=0x8065038, id=id@entry=0, item=item@entry=0xffffd318) at libfdisk/src/label.c:455
 +#7  0xf7f8233b in fdisk_get_disklabel_id (cxt=cxt@entry=0x8065038, id=id@entry=0xffffd38c) at libfdisk/src/label.c:427
 +#8  0x08052da8 in list_disk_geometry (cxt=cxt@entry=0x8065038) at disk-utils/fdisk-list.c:78
 +#9  0x08053dd0 in print_device_pt (cxt=0x8065038, device=0xffffd726 "<removed>", warnme=warnme@entry=1, verify=verify@entry=0) at disk-utils/fdisk-list.c:343
 +#10 0x0804dbdf in main (argc=3, argv=0xffffd4c4) at disk-utils/fdisk.c:951

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-26  9:29 ` Ruediger Meier
@ 2016-10-26  9:53   ` Ruediger Meier
  2016-10-26 10:19     ` Karel Zak
  2016-10-26 14:50   ` Ruediger Meier
  1 sibling, 1 reply; 11+ messages in thread
From: Ruediger Meier @ 2016-10-26  9:53 UTC (permalink / raw)
  To: util-linux

On Wednesday 26 October 2016, Ruediger Meier wrote:
> On Wednesday 26 October 2016, Ruediger Meier wrote:
> > Hi,
> >
> > looks like some of the last commits between v2.29-rc2-1-ge5cc93b
> > and v2.29-rc2-22-g82e8dda introduced issues on some i586 systems.
> >
> > For example on  Fedora 19 i586:
> >
> >
> > [  202.120451] systemd-coredump[8629]: Failed to send coredump: No
> > such file or directory
> > /home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/tests/ts/f
> >di sk/gpt: line 37:  8615 Aborted                 (core dumped)
> > $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} >> $TS_OUTPUT 2>&1
> >
> >         fdisk: GPT                                           ...
> > FAILED (fdisk/gpt)
>
> I've run it in gdb (last "unsigned int" fixes already applied):
>
>  +Program received signal SIGABRT, Aborted.
>  +0xf7d9502c in raise () from /lib/libc.so.6
>  +#0  0xf7d9502c in raise () from /lib/libc.so.6
>  +#1  0xf7d9670e in abort () from /lib/libc.so.6
>  +#2  0xf7dd3ca8 in __libc_message () from /lib/libc.so.6
>  +#3  0xf7dd9e43 in malloc_printerr () from /lib/libc.so.6
>  +#4  0xf7dd9f20 in munmap_chunk () from /lib/libc.so.6
>  +#5  0xf7f7cdd3 in fdisk_reset_labelitem (li=li@entry=0xffffd318) at
> libfdisk/src/item.c:75 +#6  0xf7f820ef in fdisk_get_disklabel_item
> (cxt=cxt@entry=0x8065038, id=id@entry=0, item=item@entry=0xffffd318)
> at libfdisk/src/label.c:455 +#7  0xf7f8233b in fdisk_get_disklabel_id
> (cxt=cxt@entry=0x8065038, id=id@entry=0xffffd38c) at
> libfdisk/src/label.c:427 +#8  0x08052da8 in list_disk_geometry
> (cxt=cxt@entry=0x8065038) at disk-utils/fdisk-list.c:78 +#9 
> 0x08053dd0 in print_device_pt (cxt=0x8065038, device=0xffffd726
> "<removed>", warnme=warnme@entry=1, verify=verify@entry=0) at
> disk-utils/fdisk-list.c:343 +#10 0x0804dbdf in main (argc=3,
> argv=0xffffd4c4) at disk-utils/fdisk.c:951 --
> To unsubscribe from this list: send the line "unsubscribe util-linux"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


And this is the guilty patch:

commit 8430b9b88426eb3c273b02a2d9505d839913317c
Author: Karel Zak <kzak@redhat.com>
Date:   Tue Oct 25 13:41:10 2016 +0200

    libfdisk: make script token parser more robust

cu,
Rudi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-25 22:00 libfdisk show stopper on i586? Ruediger Meier
  2016-10-26  0:26 ` Yuriy M. Kaminskiy
  2016-10-26  9:29 ` Ruediger Meier
@ 2016-10-26 10:13 ` Karel Zak
  2 siblings, 0 replies; 11+ messages in thread
From: Karel Zak @ 2016-10-26 10:13 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Wed, Oct 26, 2016 at 12:00:12AM +0200, Ruediger Meier wrote:
> looks like some of the last commits between v2.29-rc2-1-ge5cc93b
> and v2.29-rc2-22-g82e8dda introduced issues on some i586 systems.
> 
> For example on  Fedora 19 i586:

I'm not able to reproduce this on 32bit (i686) CentOS 6.
Do you really have old Pentium (i586)? ;-)

Maybe you can try to debug it on your machine; just add "exit" to the
fdisk/gpt test before the problematic command, and then try execute
the commend by gcc or so.

Or try manually:

 # modprobe scsi_debug dev_size_mb=100
 # echo -e 'g\nw' | ./fdisk  <scsi-debug-disk>
 # ./fdisk -l <scsi-debug-disk>



> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_reset_labelitem+0x83)[0xf76ec2d3]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_get_disklabel_item+0x40)[0xf76f1700]
> +/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/libfdisk.so.1(fdisk_get_disklabel_id+0x5c)[0xf76f192c]

This reads disk GUID from GPT header for fdisk -l.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-26  9:53   ` Ruediger Meier
@ 2016-10-26 10:19     ` Karel Zak
  2016-10-26 10:27       ` Ruediger Meier
  0 siblings, 1 reply; 11+ messages in thread
From: Karel Zak @ 2016-10-26 10:19 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Wed, Oct 26, 2016 at 11:53:51AM +0200, Ruediger Meier wrote:
> commit 8430b9b88426eb3c273b02a2d9505d839913317c
> Author: Karel Zak <kzak@redhat.com>
> Date:   Tue Oct 25 13:41:10 2016 +0200
> 
>     libfdisk: make script token parser more robust

Strange, don't see relation between the script parser and fdisk -l. Do
you have LIBFDISK_DEBUG output?

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-26 10:19     ` Karel Zak
@ 2016-10-26 10:27       ` Ruediger Meier
  2016-10-26 10:47         ` Karel Zak
  0 siblings, 1 reply; 11+ messages in thread
From: Ruediger Meier @ 2016-10-26 10:27 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Wednesday 26 October 2016, Karel Zak wrote:
> On Wed, Oct 26, 2016 at 11:53:51AM +0200, Ruediger Meier wrote:
> > commit 8430b9b88426eb3c273b02a2d9505d839913317c
> > Author: Karel Zak <kzak@redhat.com>
> > Date:   Tue Oct 25 13:41:10 2016 +0200
> >
> >     libfdisk: make script token parser more robust
>
> Strange, don't see relation between the script parser and fdisk -l.
> Do you have LIBFDISK_DEBUG output?
>
>     Karel


[   65s] +14318: libfdisk:     INIT: library debug mask: 0xffff
[   65s] +Available "LIBFDISK_DEBUG=<name>[,...]|<mask>" debug masks:
[   65s] +   all      [0xffff] : info about all subsystems
[   65s] +   ask      [0x0010] : fdisk dialogs
[   65s] +   help     [0x0001] : this help
[   65s] +   cxt      [0x0004] : library context (handler)
[   65s] +   label    [0x0008] : disk label utils
[   65s] +   part     [0x0040] : partition utils
[   65s] +   parttype [0x0080] : partition type utils
[   65s] +   script   [0x0200] : sfdisk-like scripts
[   65s] +   tab      [0x0100] : table utils
[   65s] +   wipe     [0x0400] : wipe area utils
[   65s] +   item     [0x0400] : disklabel items
[   65s] +14318: libfdisk:      CXT: [0x882d048]: alloc
[   65s] +14318: libfdisk:      CXT: [0x882d048]: assigning device <removed>
[   65s] +14318: libfdisk:      CXT: [0x882d048]: *** resetting context
[   65s] +14318: libfdisk:      CXT: [0x882d048]: <removed>: discovering topology...
[   65s] +14318: libfdisk:      CXT: [0x882d048]: initialize libblkid prober
[   65s] +14318: libfdisk:      CXT: [0x882d048]: result: log/phy sector size: 512/512
[   65s] +14318: libfdisk:      CXT: [0x882d048]: result: fdisk/optimal/minimal io: 512/0/512
[   65s] +14318: libfdisk:      CXT: [0x882d048]: <removed>: discovering geometry...
[   65s] +14318: libfdisk:      CXT: [0x882d048]: total sectors: 20480 (ioctl=20480)
[   65s] +14318: libfdisk:      CXT: [0x882d048]: result: C/H/S: 1/255/63
[   65s] +14318: libfdisk:      CXT: [0x882d048]: initialize in-memory first sector buffer [sector_size=512]
[   65s] +14318: libfdisk:      CXT: [0x882d048]: reading: offset=0, size=512
[   65s] +14318: libfdisk:      CXT: [0x882d048]: probing for gpt
[   65s] +14318: libfdisk:    LABEL: found a protective MBR
[   65s] +14318: libfdisk:    LABEL: GPT last LBA: 20479
[   65s] +14318: libfdisk:    LABEL: found valid GPT Header on LBA 1
[   65s] +14318: libfdisk:    LABEL: GPT last LBA: 20479
[   65s] +14318: libfdisk:    LABEL: found valid GPT Header on LBA 20479
[   65s] +14318: libfdisk:      CXT: [0x882d048]: --> switching context to gpt!
[   65s] +14318: libfdisk:      CXT: [0x882d048]: applying user device properties
[   65s] +14318: libfdisk:      CXT: [0x882d048]: resetting alignment...
[   65s] +14318: libfdisk:      CXT: [0x882d048]: alignment reset to: first LBA=2048, last LBA=20446, grain=1048576 [rc=0]
[   65s] +14318: libfdisk:      CXT: [0x882d048]: new C/H/S: 1/255/63
[   65s] +14318: libfdisk:      CXT: [0x882d048]: new log/phy sector size: 512/512
[   65s] +14318: libfdisk:      CXT: [0x882d048]: initialized for <removed> [READ-ONLY]
[   65s] +14318: libfdisk:      ASK: [0x8834068]: alloc
[   65s] +14318: libfdisk:      ASK: [0x8834068]: do_ask for 'info'
[   65s] +14318: libfdisk:      ASK: [0x8834068]: do_ask done [rc=0]
[   65s] +14318: libfdisk:      ASK: [0x8834068]: reset
[   65s] +14318: libfdisk:      ASK: [0x8834068]: free
[   65s] +14318: libfdisk:      ASK: [0x8834068]: alloc
[   65s] +14318: libfdisk:      ASK: [0x8834068]: do_ask for 'info'
[   65s] +14318: libfdisk:      ASK: [0x8834068]: do_ask done [rc=0]
[   65s] +14318: libfdisk:      ASK: [0x8834068]: reset
[   65s] +14318: libfdisk:      ASK: [0x8834068]: free
[   65s] +14318: libfdisk:      ASK: [0x8834100]: alloc
[   65s] +14318: libfdisk:      ASK: [0x8834100]: do_ask for 'info'
[   65s] +14318: libfdisk:      ASK: [0x8834100]: do_ask done [rc=0]
[   65s] +14318: libfdisk:      ASK: [0x8834100]: reset
[   65s] +14318: libfdisk:      ASK: [0x8834100]: free
[   65s] +14318: libfdisk:      ASK: [0x8834110]: alloc
[   65s] +14318: libfdisk:      ASK: [0x8834110]: do_ask for 'info'
[   65s] +14318: libfdisk:      ASK: [0x8834110]: do_ask done [rc=0]
[   65s] +14318: libfdisk:      ASK: [0x8834110]: reset
[   65s] +14318: libfdisk:      ASK: [0x8834110]: free
[   65s] +14318: libfdisk:      ASK: [0x8834080]: alloc
[   65s] +14318: libfdisk:      ASK: [0x8834080]: do_ask for 'info'
[   65s] +14318: libfdisk:      ASK: [0x8834080]: do_ask done [rc=0]
[   65s] +14318: libfdisk:      ASK: [0x8834080]: reset
[   65s] +14318: libfdisk:      ASK: [0x8834080]: free
[   65s] +14318: libfdisk:      CXT: [0x882d048]: asking for disk gpt ID
[   65s] +*** Error in `/home/abuild/rpmbuild/BUILD/util-linux-2.29.rc2-22-82e8d/.libs/fdisk': munmap_chunk(): invalid pointer: 0xf7790a73 ***

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-26 10:27       ` Ruediger Meier
@ 2016-10-26 10:47         ` Karel Zak
  2016-10-26 12:37           ` Ruediger Meier
  0 siblings, 1 reply; 11+ messages in thread
From: Karel Zak @ 2016-10-26 10:47 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Wed, Oct 26, 2016 at 12:27:55PM +0200, Ruediger Meier wrote:
> On Wednesday 26 October 2016, Karel Zak wrote:
> > On Wed, Oct 26, 2016 at 11:53:51AM +0200, Ruediger Meier wrote:
> > > commit 8430b9b88426eb3c273b02a2d9505d839913317c
> > > Author: Karel Zak <kzak@redhat.com>
> > > Date:   Tue Oct 25 13:41:10 2016 +0200
> > >
> > >     libfdisk: make script token parser more robust
> >
> > Strange, don't see relation between the script parser and fdisk -l.
> > Do you have LIBFDISK_DEBUG output?
> >
> >     Karel
> 
> 
> [   65s] +14318: libfdisk:     INIT: library debug mask: 0xffff
> [   65s] +Available "LIBFDISK_DEBUG=<name>[,...]|<mask>" debug masks:

Can you send me the disk image? dd(1) + gzip, it's full of zeros, so
it should be relatively small.

Do you see something strange when you use parted for the disk?

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-26 10:47         ` Karel Zak
@ 2016-10-26 12:37           ` Ruediger Meier
  0 siblings, 0 replies; 11+ messages in thread
From: Ruediger Meier @ 2016-10-26 12:37 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Wednesday 26 October 2016, Karel Zak wrote:
> On Wed, Oct 26, 2016 at 12:27:55PM +0200, Ruediger Meier wrote:
> > On Wednesday 26 October 2016, Karel Zak wrote:
> > > On Wed, Oct 26, 2016 at 11:53:51AM +0200, Ruediger Meier wrote:
> > > > commit 8430b9b88426eb3c273b02a2d9505d839913317c
> > > > Author: Karel Zak <kzak@redhat.com>
> > > > Date:   Tue Oct 25 13:41:10 2016 +0200
> > > >
> > > >     libfdisk: make script token parser more robust
> > >
> > > Strange, don't see relation between the script parser and fdisk
> > > -l. Do you have LIBFDISK_DEBUG output?
> > >
> > >     Karel
> >
> > [   65s] +14318: libfdisk:     INIT: library debug mask: 0xffff
> > [   65s] +Available "LIBFDISK_DEBUG=<name>[,...]|<mask>" debug
> > masks:
>
> Can you send me the disk image? dd(1) + gzip, it's full of zeros, so
> it should be relatively small.

Hehe, I've made a lot of debugging in a chrooted openSUSE 42.1/i586 and 
found out that the problem was

disk-utils/fdisk-menu.c:709:
-	unsigned long length;
+	uintmax_t length = 0;

which you have fixed in the meanwhile in e4015b34 ...


But this does not fix the bug in Fedora 19, WTF!?


For the record on openSUSE 42.1/i586 to reproduce the bug these compiler 
flags were needed:
   CFLAGS='-O2 -D_FORTIFY_SOURCE=2 -fstack-protector'

and this:

$ rm /tmp/gpt.img; truncate -s 1M /tmp/gpt.img
$ echo -e "g\nw\nq\n" | ./fdisk /tmp/gpt.img
$ ./fdisk -l /tmp/gpt.img
 <segfault>

Now I'm going to check that on Fedora 19 ...

cu,
Rudi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: libfdisk show stopper on i586?
  2016-10-26  9:29 ` Ruediger Meier
  2016-10-26  9:53   ` Ruediger Meier
@ 2016-10-26 14:50   ` Ruediger Meier
  1 sibling, 0 replies; 11+ messages in thread
From: Ruediger Meier @ 2016-10-26 14:50 UTC (permalink / raw)
  To: util-linux

On Wednesday 26 October 2016, Ruediger Meier wrote:

> I've run it in gdb (last "unsigned int" fixes already applied):
>
>  +Program received signal SIGABRT, Aborted.
>  +0xf7d9502c in raise () from /lib/libc.so.6
>  +#0  0xf7d9502c in raise () from /lib/libc.so.6
>  +#1  0xf7d9670e in abort () from /lib/libc.so.6
>  +#2  0xf7dd3ca8 in __libc_message () from /lib/libc.so.6
>  +#3  0xf7dd9e43 in malloc_printerr () from /lib/libc.so.6
>  +#4  0xf7dd9f20 in munmap_chunk () from /lib/libc.so.6
>  +#5  0xf7f7cdd3 in fdisk_reset_labelitem (li=li@entry=0xffffd318) at
> libfdisk/src/item.c:75 +#6  0xf7f820ef in fdisk_get_disklabel_item
> (cxt=cxt@entry=0x8065038, id=id@entry=0, item=item@entry=0xffffd318)
> at libfdisk/src/label.c:455 +#7  0xf7f8233b in fdisk_get_disklabel_id
> (cxt=cxt@entry=0x8065038, id=id@entry=0xffffd38c) at
> libfdisk/src/label.c:427 +#8  0x08052da8 in list_disk_geometry
> (cxt=cxt@entry=0x8065038) at disk-utils/fdisk-list.c:78 +#9 
> 0x08053dd0 in print_device_pt (cxt=0x8065038, device=0xffffd726
> "<removed>", warnme=warnme@entry=1, verify=verify@entry=0) at
> disk-utils/fdisk-list.c:343 +#10 0x0804dbdf in main (argc=3,
> argv=0xffffd4c4) at disk-utils/fdisk.c:951 --
> To unsubscribe from this list: send the line "unsubscribe util-linux"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Ok I got it. Actually my backtrace above was straight forward to debug.
I'll send a patch.

cu,
Rudi

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-10-26 14:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-25 22:00 libfdisk show stopper on i586? Ruediger Meier
2016-10-26  0:26 ` Yuriy M. Kaminskiy
2016-10-26  8:17   ` Karel Zak
2016-10-26  9:29 ` Ruediger Meier
2016-10-26  9:53   ` Ruediger Meier
2016-10-26 10:19     ` Karel Zak
2016-10-26 10:27       ` Ruediger Meier
2016-10-26 10:47         ` Karel Zak
2016-10-26 12:37           ` Ruediger Meier
2016-10-26 14:50   ` Ruediger Meier
2016-10-26 10:13 ` Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.