Bug 2047784

Summary: ib_user_ioctl_verbs.h in rdma-core-devel vs in kernel-headers can cause compilation failures
Product: Red Hat Enterprise Linux 8 Reporter: Adam Goldman <adam.goldman>
Component: rdma-coreAssignee: Kamal Heib <kheib>
Status: CLOSED WONTFIX QA Contact: Infiniband QE <infiniband-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: anton.bodner, hwkernel-mgr, kheib, rdma-dev-team
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-28 07:28:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adam Goldman 2022-01-28 14:28:44 UTC
Description of problem:

Attempting to include both headers with the same ifdef ("IB_USER_IOCTL_VERBS_H") wrapper can produce a failure depending on order of include, as the files are not identical.

Problem headers:
  /usr/include/rdma/ib_user_ioctl_verbs.h 
  /usr/include/infiniband/ib_user_ioctl_verbs.h


Version-Release number of selected component (if applicable):
  /usr/include/infiniband/ib_user_ioctl_verbs.h rdma-core-devel-32.0-4.el8.x86_64
  /usr/include/rdma/ib_user_ioctl_verbs.h       kernel-headers-4.18.0-305.el8.x86_64

There appear to be differences in other RHEL versions, though not the same fields.

How reproducible:

Compile simple c file with different defines.

Simple c file:
====
#ifdef BAD_ORDER
# include <rdma/ib_user_ioctl_verbs.h>
# include <infiniband/ib_user_ioctl_verbs.h>
#else
# include <infiniband/ib_user_ioctl_verbs.h>
# include <rdma/ib_user_ioctl_verbs.h>
#endif
int main(int argc, char **argv) {
    enum ib_uverbs_gid_type type = IB_UVERBS_GID_TYPE_IB;
    (void)type;
    return 0;
}
====
Steps to Reproduce:
1. gcc -DBAD_ORDER rdma.c


Actual results:
Compile this with "-DBAD_ORDER":

rdma.c: In function 'main':
rdma.c:11:7: error: variable 'type' has initializer but incomplete type
  enum ib_uverbs_gid_type type = IB_UVERBS_GID_TYPE_IB;
       ^~~~~~~~~~~~~~~~~~
rdma.c:11:33: error: 'IB_UVERBS_GID_TYPE_IB' undeclared (first use in this function); did you mean 'IB_UVERBS_PCF_TRAP_SUP'?
  enum ib_uverbs_gid_type type = IB_UVERBS_GID_TYPE_IB;
                                 ^~~~~~~~~~~~~~~~~~~~~
                                 IB_UVERBS_PCF_TRAP_SUP
rdma.c:11:33: note: each undeclared identifier is reported only once for each function it appears in
rdma.c:11:26: error: storage size of 'type' isn't known
  enum ib_uverbs_gid_type type = IB_UVERBS_GID_TYPE_IB;
                          ^~~~

Expected results:
No error

Additional info:
These files can de indirectly included from higher-level includes like verbs.h, etc.

Comment 3 RHEL Program Management 2023-07-28 07:28:13 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.