Bug#436964: Bug in 2.4 kernels with latest lvm2
Package: Kernel
Version: 2.4.27-3-sparc64-smp
I had a server go down during a power outage and upon rebooting, lvm
failed to work (2.4 kernel). I could access the PVs, VGs, and LVs ok,
but I could not activate the VG. Attempting to activate the VG
resulted in this error:
vgchange -a y vg00
Huge memory allocation (size 67108864) rejected - metadata corruption?
Couldn't create ioctl argument.
Huge memory allocation (size 67108864) rejected - metadata corruption?
Couldn't create ioctl argument.
Huge memory allocation (size 67108864) rejected - metadata corruption?
Couldn't create ioctl argument.
Huge memory allocation (size 67108864) rejected - metadata corruption?
Couldn't create ioctl argument.
Huge memory allocation (size 67108864) rejected - metadata corruption?
Couldn't create ioctl argument.
Huge memory allocation (size 67108864) rejected - metadata corruption?
Couldn't create ioctl argument.
0 logical volume(s) in volume group "vg00" now active
Kernel 2.6 worked fine. After several hours of debugging on #lvm, we
tracked to problem down to an int to size_t change in
drivers/md/dm-ioctl.c.
(12:41:31) agd5f: agk__: FWIW, I just rebooted into a 2.6 kernel and
dmsetup targets works
(12:43:25) agd5f: the printf is right before if (dmi->flags &
DM_BUFFER_FULL_FLAG) {
(12:44:55) agk__: ah. I'm remembering something
(12:45:55) agd5f: 2.6 works fine. I got my volume back
(12:46:01) agk__: - int *needed = param;
(12:46:01) agk__: + size_t *needed = needed_param;
(12:46:18) agd5f: but I'm happy to help track down the issue
(12:46:29) agk__: I think it's a bug in the 2.4 patches that we fixed
in 2.6 but hasn't been backported
(12:46:44) agk__: there's an int->size_t change
(12:46:49) agd5f: ah
(12:47:19) agk__: dmsetup targets has probably always been broken for
you on sparc,
(12:47:36) agk__: but lvm2 package update started to use it -
previously it wasn't used
(12:47:39) agd5f: yeah. I'd never used it until today
(12:48:19) agk__: so updating userspace lvm2 started to call 'dmsetup
targets' which doesn't work
(12:48:46) agk__: if debian is still supporting 2.4, then someone
needs to patch the kernel I think to include the patch
(12:49:08) agk__: and we should update our upstream patches to include it too
(12:50:28) agk__: what's happening is a size_t is being passed to a
function, which thinks it is an int
(12:50:43) agk__: it changes the value, based on int, and the caller
uses it as size_t again
(12:50:50) agd5f: ah, that makes sense
(12:51:04) agk__: this causes it to think the buffer is too small and
set that flag
(12:51:41) agd5f: right
(12:51:45) agk__: (it passes a pointer to the variable)
(12:55:08) agk__: drivers/md/dm-ioctl.c:
(12:55:31) agk__: list_versions 'needed' variable vs. list_version_get_needed
(12:55:48) agk__: compare with the same code in 2.6
Alex
Reply to: