[linux-lvm] LVM2 segfault w/devfs on amd64

Randall Nortman linux-lvm-list at wonderclown.com
Fri Jul 30 20:39:58 UTC 2004

The LVM2 tools (e.g., vgscan) segfault on an x86_64/amd64 system if
devfs is used, unless /dev/md* are filtered out.  Also, after the
first attempt has segfaulted, subsequent attempts will hang, consuming
100% of CPU until killed; this continues until the system is
rebooted.  I can reproduce this reliably on a Gentoo system.

I have tracked the segfault down to line 71 of lib/filters/filter.c,
which in my version of the source is:

  if (!(((int *) f->private)[MAJOR(dev->dev)])) {

It appears that the code assumes that all device major numbers will be
< 256, and does not check that this is true before indexing that
array, and so when the device major number is >=256, as it can be with
devfs and also, I believe, udev, there is a segmentation fault.  I'm
not sure what's causing subsequent invocations to hang; I didn't
bother to dig into that.

Even though devfs is officially deprecated, I believe this issue
should definitely be fixed, since it could happen also with udev.
Shall I file a bug, or is this a known issue?

I initially filed this as a bug against Gentoo, which can be viewed
at: http://bugs.gentoo.org/show_bug.cgi?id=58798


Randall Nortman

More information about the linux-lvm mailing list