Util-Linux package development
 help / color / mirror / Atom feed
* libblkid: blkid_bufinfo() fails on 32bit
@ 2015-12-03  1:57 Ruediger Meier
  2015-12-03 11:27 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Ruediger Meier @ 2015-12-03  1:57 UTC (permalink / raw)
  To: util-linux

Hi,

Looks like this commit breaks 32bit/i386 systems:

----
commit a674a0ab03660b1df777e69436b2dc832b6f8681
Author: Karel Zak <kzak@redhat.com>
Date:   Tue Sep 22 15:37:26 2015 +0200

    libblkid: use mmap() rather than read()
----

 libblkid/src/probe.c:638: mmap_buffer: Assertion `map_off + map_len >= real_off + len' failed.


I can avoid that assert if I change the type of map_len in blkid_bufinfo().

-   size_t map_len;
+   blkid_loff_t map_len;

but it still looks broken, see this debug output


libblkid: LOWPROBE: --> starting probing loop [SUBLKS idx=-1]
libblkid: LOWPROBE: [0] linux_raid_member:
libblkid: LOWPROBE:     call probefunc()
libblkid:   BUFFER:     mapping end of the device
libblkid:   BUFFER:     mmap  0xf7321000: off=4112515072, len=25771900928 (6291968 pages)
                                                      ^^^^^^^
   shouldn't we only mmap about 2M?

libblkid:   BUFFER:     reuse 0xf7321000: off=4112515072 len=25771900928 (for off=29884407808 len=256)
libblkid:   BUFFER:     mapping begin of the device
libblkid:   BUFFER:     mmap  0xf7121000: off=0, len=2097152 (512 pages)
libblkid:   BUFFER:     reuse 0xf7121000: off=0 len=2097152 (for off=4096 len=256)

cu,
Rudi

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

* Re: libblkid: blkid_bufinfo() fails on 32bit
  2015-12-03  1:57 libblkid: blkid_bufinfo() fails on 32bit Ruediger Meier
@ 2015-12-03 11:27 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2015-12-03 11:27 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Thu, Dec 03, 2015 at 02:57:06AM +0100, Ruediger Meier wrote:
> but it still looks broken, see this debug output
> 
> 
> libblkid: LOWPROBE: --> starting probing loop [SUBLKS idx=-1]
> libblkid: LOWPROBE: [0] linux_raid_member:
> libblkid: LOWPROBE:     call probefunc()
> libblkid:   BUFFER:     mapping end of the device
> libblkid:   BUFFER:     mmap  0xf7321000: off=4112515072, len=25771900928 (6291968 pages)
>                                                       ^^^^^^^

Yep, fixed.

-#define PROBE_ALIGN_OFF(p, o)  ((o) & ~((p)->mmap_granularity - 1))
+#define PROBE_ALIGN_OFF(p, o)  ((o) & ~((p)->mmap_granularity - 1ULL))

.. it's necessary to be more explicit with constants ;-)

Thanks!

    Karel


>    shouldn't we only mmap about 2M?
> 
> libblkid:   BUFFER:     reuse 0xf7321000: off=4112515072 len=25771900928 (for off=29884407808 len=256)
> libblkid:   BUFFER:     mapping begin of the device
> libblkid:   BUFFER:     mmap  0xf7121000: off=0, len=2097152 (512 pages)
> libblkid:   BUFFER:     reuse 0xf7121000: off=0 len=2097152 (for off=4096 len=256)
> 
> cu,
> Rudi
> --
> 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
> 

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

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

end of thread, other threads:[~2015-12-03 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03  1:57 libblkid: blkid_bufinfo() fails on 32bit Ruediger Meier
2015-12-03 11:27 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox