diff --git a/numactl-64bit-bigendian.diff b/numactl-64bit-bigendian.diff new file mode 100644 index 0000000..8840ffd --- /dev/null +++ b/numactl-64bit-bigendian.diff @@ -0,0 +1,51 @@ +From: Arnd Bergmann +Subject: Fix libnuma on big-endian 64-bit systems +References: bnc #455977 + +The read-mask function assumes that it is running in 32-bit mode, +by addressing the bitmask as a series of int values, instead of +longs. This is broken as can easily be reproduced by running numademo +on a bit-endian 64-bit system. + +Changing the addressing to use 'long' values fixes the problem. + +Reported-by: Mijo Safradin +Signed-off-by: Arnd Bergmann +Acked-by: Bernhard Walle + +--- + libnuma.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/libnuma.c ++++ b/libnuma.c +@@ -372,9 +372,9 @@ read_mask(char *s, struct bitmask *bmp) + { + char *end = s; + char *prevend; +- unsigned int *start = (unsigned int *)bmp->maskp; +- unsigned int *p = start; +- unsigned int *q; ++ unsigned long *start = bmp->maskp; ++ unsigned long *p = start; ++ unsigned long *q; + unsigned int i; + unsigned int n = 0; + +@@ -411,14 +411,14 @@ read_mask(char *s, struct bitmask *bmp) + } + + /* Poor mans fls() */ +- for(i = 31; i >= 0; i--) ++ for(i = sizeof(long) * 8 - 1; i >= 0; i--) + if (test_bit(i, start + n)) + break; + + /* + * Return the last bit set + */ +- return ((sizeof(unsigned int)*8) * n) + i; ++ return ((sizeof(unsigned long)*8) * n) + i; + } + + /* diff --git a/numactl.changes b/numactl.changes index c60c990..c6f9ce0 100644 --- a/numactl.changes +++ b/numactl.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Dec 5 14:38:41 CET 2008 - bwalle@suse.de + +- Fix numademo memset fails with 'mbind: Invalid argument' + (bnc #455977). + ------------------------------------------------------------------- Thu Nov 20 11:58:59 CET 2008 - bwalle@suse.de diff --git a/numactl.spec b/numactl.spec index 30605ec..a18f651 100644 --- a/numactl.spec +++ b/numactl.spec @@ -23,14 +23,15 @@ Name: numactl License: GPL v2 only; GPL v2 or later Summary: NUMA Policy Control Version: 2.0.2 -Release: 16 +Release: 17 AutoReqProv: on Source: numactl-%{version}.tar.bz2 Group: System/Management BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: ia64 x86_64 ppc64 ppc Requires: perl -Patch0: numactl-compat.diff +Patch0: %{name}-compat.diff +Patch1: %{name}-64bit-bigendian.diff %description Control NUMA policy for individual processes. Offer libnuma for @@ -81,6 +82,7 @@ Authors: %prep %setup %patch0 -p1 +%patch1 -p1 %build make CFLAGS="${RPM_OPT_FLAGS}" @@ -120,6 +122,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/lib*so %changelog +* Fri Dec 05 2008 bwalle@suse.de +- Fix numademo memset fails with 'mbind: Invalid argument' + (bnc #455977). * Thu Nov 20 2008 bwalle@suse.de - Fixes to libnuma.c numa.h numacompat1.h by Daniel Gollub to fix v1 compatiblity (bnc#441440).