Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1451607 - [RHEL-7.4/rdma-core/libibumad] redefined htonll and ntohll
[RHEL-7.4/rdma-core/libibumad] redefined htonll and ntohll
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rdma-core (Show other bugs)
7.4
All Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Jarod Wilson
Mike Stowell
:
Depends On:
Blocks: 1353018 1450776 1454376
  Show dependency treegraph
 
Reported: 2017-05-17 03:04 EDT by Honggang LI
Modified: 2017-08-01 13:00 EDT (History)
8 users (show)

See Also:
Fixed In Version: rdma-core-13-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1454376 (view as bug list)
Environment:
Last Closed: 2017-08-01 13:00:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:2011 normal SHIPPED_LIVE RDMA stack bug fix and enhancement update 2017-08-01 13:59:05 EDT

  None (edit)
Description Honggang LI 2017-05-17 03:04:16 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
Comment 2 Honggang LI 2017-05-17 03:06:56 EDT
After revert 29bb8f07da911, opa-ff compiling works again.
Comment 4 Honggang LI 2017-05-17 08:11:25 EDT
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
Comment 5 Jarod Wilson 2017-05-17 17:40:08 EDT
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.
Comment 6 Honggang LI 2017-05-22 09:42:56 EDT
Setup the 'blocker+' flag as it blocks opa-ff compiling.
Comment 11 errata-xmlrpc 2017-08-01 13:00:15 EDT
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

Note You need to log in before you can comment on or make changes to this bug.