Red Hat Bugzilla – Bug 1451607
[RHEL-7.4/rdma-core/libibumad] redefined htonll and ntohll
Last modified: 2017-08-01 13:00:15 EDT
Description of problem: Upstream commit 29bb8f07da9110fa167b55e5013de80adfd1e99b redefined those two functions. It break OPA-FF compiling. One of those duplicated functions should be removed. ------------------------------------------------------------ gcc -pipe -DTARGET_CPU_FAMILY_X86 -Wall -D__X86_64__ -DCPU_LE -m64 -fno-strict-aliasing -fstack-protector -DLINUX -Dlinux -D__LINUX__ -DPRODUCT=OPENIB_FF -DPRODUCT_OPENIB_FF -DMODULEVERSION=10.3.1.0.7 -DIB_STACK_OPENIB -fpic -g -I. -I/home/test/rpmbuild/BUILD/opa-ff-10.3.1.0-8/builtinclude.OPENIB_FF.release -I/home/test/rpmbuild/BUILD/opa-ff-10.3.1.0-8/builtinclude.OPENIB_FF.release/iba -I/home/test/rpmbuild/BUILD/opa-ff-10.3.1.0-8/builtinclude.OPENIB_FF.release/iba/public -I/usr/include/infiniband -I/usr/include -c src/dsap_scan_fabric.c -o build.OPENIB_FF.release/src/dsap_scan_fabric.o In file included from src/dsap_scan_fabric.c:34:0: /usr/include/infiniband/umad.h:237:52: error: redefinition of 'htonll' static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return htobe64(x); } ^ In file included from src/dsap_scan_fabric.c:33:0: /usr/include/infiniband/mad.h:1671:24: note: previous definition of 'htonll' was here static inline uint64_t htonll(uint64_t x) ^ In file included from src/dsap_scan_fabric.c:34:0: /usr/include/infiniband/umad.h:238:52: error: redefinition of 'ntohll' static inline __attribute__((deprecated)) uint64_t ntohll(uint64_t x) { return be64toh(x); } ^ In file included from src/dsap_scan_fabric.c:33:0: /usr/include/infiniband/mad.h:1665:24: note: previous definition of 'ntohll' was here static inline uint64_t ntohll(uint64_t x) ^ src/dsap_scan_fabric.c: In function 'dsap_publish_paths': src/dsap_scan_fabric.c:315:5: warning: 'ntohll' is deprecated (declared at /usr/include/infiniband/umad.h:238) [-Wdeprecated-declarations] ------------------------------------------------------------ Version-Release number of selected component (if applicable): libibmad-devel-1.3.12-1.el7.x86_64 rdma-core-devel-13-5.el7.x86_64 How reproducible: always Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: rdma-core (master)]$ git remote -v origin https://github.com/linux-rdma/rdma-core.git (fetch) origin https://github.com/linux-rdma/rdma-core.git (push) rdma-core (master)]$ git show 29bb8f07da911 commit 29bb8f07da9110fa167b55e5013de80adfd1e99b Author: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Date: Thu Feb 9 13:14:36 2017 -0700 umad: Replace htonll macros with proper inlines and mark deprecated This allowed code using these public definitions to continue to compile but will get warnings from gcc. Users should move to glibc's endian.h We want to avoid new users of these macros in our tree. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> diff --git a/libibumad/umad.h b/libibumad/umad.h index d574d5d..ee8605d 100644 --- a/libibumad/umad.h +++ b/libibumad/umad.h @@ -229,14 +229,13 @@ static inline void umad_free(void *umad) } #ifndef ntohll - #if __BYTE_ORDER == __LITTLE_ENDIAN - #define ntohll(x) bswap_64(x) - #elif __BYTE_ORDER == __BIG_ENDIAN - #define ntohll(x) x - #endif -#endif -#ifndef htonll - #define htonll ntohll +#undef htonll +#undef ntohll +/* Users should use the glibc functions directly, not these wrappers */ +static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return htobe64(x); } +static inline __attribute__((deprecated)) uint64_t ntohll(uint64_t x) { return be64toh(x); } +#define htonll htonll +#define ntohll ntohll #endif END_C_DECLS
After revert 29bb8f07da911, opa-ff compiling works again.
Compiling infiniband-diags also failed because of this issue. libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I./include -I/usr/include -I/usr/include/infiniband -Wall -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c src/query_smp.c -fPIC -DPIC -o .libs/libibnetdisc_la-query_smp.o In file included from src/query_smp.c:41:0: /usr/include/infiniband/umad.h:237:52: error: redefinition of 'htonll' static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return htobe64(x); } ^ In file included from ./include/infiniband/ibnetdisc.h:40:0, from src/query_smp.c:40: /usr/include/infiniband/mad.h:1671:24: note: previous definition of 'htonll' was here static inline uint64_t htonll(uint64_t x) ^ In file included from src/query_smp.c:41:0: /usr/include/infiniband/umad.h:238:52: error: redefinition of 'ntohll' static inline __attribute__((deprecated)) uint64_t ntohll(uint64_t x) { return be64toh(x); } ^ In file included from ./include/infiniband/ibnetdisc.h:40:0, from src/query_smp.c:40: /usr/include/infiniband/mad.h:1665:24: note: previous definition of 'ntohll' was here static inline uint64_t ntohll(uint64_t x) ^ make[2]: *** [libibnetdisc_la-query_smp.lo] Error 1 make[2]: Leaving directory `/home/test/rpmbuild/BUILD/infiniband-diags-1.6.7/libibnetdisc' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/test/rpmbuild/BUILD/infiniband-diags-1.6.7' make: *** [all] Error 2
I'm not so sure this is rdma-core's bug. What is providing /usr/include/infiniband/mad.h that has the other definition? Looks like it's coming from libibmad-devel, and that's probably where it needs to be removed. Would have to ask upstream to be sure, but it looks like the intention of the rdma-core change was to force people to use glibc's definitions instead of these extra ones.
Setup the 'blocker+' flag as it blocks opa-ff compiling.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2017:2011