All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] multipath-tools: 0 cyl reported on large disks due to overflow
@ 2026-05-22 21:10 Xose Vazquez Perez
  2026-05-26 19:28 ` Benjamin Marzinski
  0 siblings, 1 reply; 3+ messages in thread
From: Xose Vazquez Perez @ 2026-05-22 21:10 UTC (permalink / raw)
  To: Martin Wilck, Benjamin Marzinski, Christophe Varoqui; +Cc: DM_DEVEL-ML

Hi,

An integer overflow occurs in libmultipath/discovery.c:get_geometry() when
querying geometry on large disks resulting in "0 cyl" being reported:

# multipath -ll -d -v3
... | sdgm: 0 cyl, 64 heads, 32 sectors/track, start at 0

# fdisk -l /dev/sdgm
Disk /dev/sdgm: 12 TiB, 13194139533312 bytes, 25769803776 sectors
Units: sectors of 1 * 512 = 512 bytes

# dmesg | grep sdgm
sd 5:0:3:100: [sdgm] 25769803776 512-byte logical blocks: (13.2 TB/12.0TiB)


The root cause is that struct hd_geometry, from libmultipath/structs.h,
defines cylinders as an unsigned short.

Since it is a legacy interface, it should either sanitize the log output
or avoid relying on CHS geometry for large devices.

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

* Re: [BUG] multipath-tools: 0 cyl reported on large disks due to overflow
  2026-05-22 21:10 [BUG] multipath-tools: 0 cyl reported on large disks due to overflow Xose Vazquez Perez
@ 2026-05-26 19:28 ` Benjamin Marzinski
  2026-06-05 14:17   ` Martin Wilck
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Marzinski @ 2026-05-26 19:28 UTC (permalink / raw)
  To: Xose Vazquez Perez; +Cc: Martin Wilck, Christophe Varoqui, DM_DEVEL-ML

On Fri, May 22, 2026 at 11:10:36PM +0200, Xose Vazquez Perez wrote:
> Hi,
> 
> An integer overflow occurs in libmultipath/discovery.c:get_geometry() when
> querying geometry on large disks resulting in "0 cyl" being reported:
> 
> # multipath -ll -d -v3
> ... | sdgm: 0 cyl, 64 heads, 32 sectors/track, start at 0
> 
> # fdisk -l /dev/sdgm
> Disk /dev/sdgm: 12 TiB, 13194139533312 bytes, 25769803776 sectors
> Units: sectors of 1 * 512 = 512 bytes
> 
> # dmesg | grep sdgm
> sd 5:0:3:100: [sdgm] 25769803776 512-byte logical blocks: (13.2 TB/12.0TiB)
> 
> 
> The root cause is that struct hd_geometry, from libmultipath/structs.h,
> defines cylinders as an unsigned short.
> 
> Since it is a legacy interface, it should either sanitize the log output
> or avoid relying on CHS geometry for large devices.

I'm totally fine with never reporting the geometry info or moving it to
log level 4 (since there can be value to even pointless debugging
messages. They can show you where you made it to if you happned to hang
in a function)

But I don't personally have a problem with multipath simply passing
along the geometry data it gets from the disk. Sure, it may be garbage,
but then DM's garbage matches the disk's garbage. I highly doubt that
anything actually cares what geometry a DM device reports. But I don't
see any benefit to changing what it currently does.

Thoughts?
-Ben 


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

* Re: [BUG] multipath-tools: 0 cyl reported on large disks due to overflow
  2026-05-26 19:28 ` Benjamin Marzinski
@ 2026-06-05 14:17   ` Martin Wilck
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Wilck @ 2026-06-05 14:17 UTC (permalink / raw)
  To: Benjamin Marzinski, Xose Vazquez Perez; +Cc: Christophe Varoqui, DM_DEVEL-ML

On Tue, 2026-05-26 at 15:28 -0400, Benjamin Marzinski wrote:
> On Fri, May 22, 2026 at 11:10:36PM +0200, Xose Vazquez Perez wrote:
> > Hi,
> > 
> > An integer overflow occurs in
> > libmultipath/discovery.c:get_geometry() when
> > querying geometry on large disks resulting in "0 cyl" being
> > reported:
> > 
> > # multipath -ll -d -v3
> > ... | sdgm: 0 cyl, 64 heads, 32 sectors/track, start at 0
> > 
> > # fdisk -l /dev/sdgm
> > Disk /dev/sdgm: 12 TiB, 13194139533312 bytes, 25769803776 sectors
> > Units: sectors of 1 * 512 = 512 bytes
> > 
> > # dmesg | grep sdgm
> > sd 5:0:3:100: [sdgm] 25769803776 512-byte logical blocks: (13.2
> > TB/12.0TiB)
> > 
> > 
> > The root cause is that struct hd_geometry, from
> > libmultipath/structs.h,
> > defines cylinders as an unsigned short.
> > 
> > Since it is a legacy interface, it should either sanitize the log
> > output
> > or avoid relying on CHS geometry for large devices.
> 
> I'm totally fine with never reporting the geometry info or moving it
> to
> log level 4 (since there can be value to even pointless debugging
> messages. They can show you where you made it to if you happned to
> hang
> in a function)
> 
> But I don't personally have a problem with multipath simply passing
> along the geometry data it gets from the disk. Sure, it may be
> garbage,
> but then DM's garbage matches the disk's garbage. I highly doubt that
> anything actually cares what geometry a DM device reports. But I
> don't
> see any benefit to changing what it currently does.
> 
> Thoughts?

I agree. And as -v3 is already a moderate debugging level for us, I
don't see the log message as problematic, either.

Martin

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

end of thread, other threads:[~2026-06-05 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22 21:10 [BUG] multipath-tools: 0 cyl reported on large disks due to overflow Xose Vazquez Perez
2026-05-26 19:28 ` Benjamin Marzinski
2026-06-05 14:17   ` Martin Wilck

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.