Red Hat Bugzilla – Bug 220817
signed overflow in compare_modules
Last modified: 2007-11-30 17:07:39 EST
In elfutils 0.124, libdwfl's compare_modules routine screws up for
x86_64. The problem is that the kernel pseudo-module's address gets
compared incorrectly to module addresses, and is consequently not
correctly sorted in the dwfl->modules array.
The following simpler implementation works and explains:
compare_modules (const void *a, const void *b)
Dwfl_Module *const *p1 = a, *const *p2 = b;
const Dwfl_Module *m1 = *p1, *m2 = *p2;
if (m1 == NULL)
if (m2 == NULL)
// NB: Computing a signed difference between m1-> and m2-> is not
// good enough, since the possible range of the difference exceeds
// the representational limits of signed numbers of the same
// e.g: take 8-bit values.
// m1=255 m2=0 => m1 larger, should return 1, but (signed char) (255-0) = -1 !
if (m1->low_addr < m2->low_addr)
else if (m1->low_addr > m2->low_addr)
Applied upstream. Will be in 0.125.
Can you give a larger blurb to justify treating this as an exception to PM?
Should this be tied to bug #215053?
Two fixes in elfutils-0.125, including this one, are necessary to resolve bug
215053. This one's urgency and impact should be considered the same as bug
215053, whatever that determination is. This elfutils issue does not have any
significant impact outside its impact on systemtap.
0.125 went into RHEL5.