* [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
@ 2024-08-01 11:35 kernel test robot
2024-08-01 12:47 ` Gustavo A. R. Silva
0 siblings, 1 reply; 9+ messages in thread
From: kernel test robot @ 2024-08-01 11:35 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: llvm, oe-kbuild-all, Gustavo A. R. Silva, LKML
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20240729-cbc-2
head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18] RDMA/uverbs: Use static_assert() to check struct sizes
config: hexagon-randconfig-001-20240801 (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 430b90f04533b099d788db2668176038be38c53b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408011956.wscyBwq6-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
In file included from drivers/infiniband/core/uverbs.h:46:
In file included from include/rdma/ib_verbs.h:15:
In file included from include/linux/ethtool.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:10:
In file included from include/linux/mm.h:2228:
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
In file included from drivers/infiniband/core/uverbs.h:46:
In file included from include/rdma/ib_verbs.h:15:
In file included from include/linux/ethtool.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
In file included from drivers/infiniband/core/uverbs.h:46:
In file included from include/rdma/ib_verbs.h:15:
In file included from include/linux/ethtool.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
In file included from drivers/infiniband/core/uverbs.h:46:
In file included from include/rdma/ib_verbs.h:15:
In file included from include/linux/ethtool.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
In file included from drivers/infiniband/core/uverbs.h:49:
In file included from include/rdma/uverbs_std_types.h:10:
>> include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644 | "struct member likely outside of struct_group_tagged()");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
| ^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates to '56 == 52'
643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644 | "struct member likely outside of struct_group_tagged()");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
7 warnings and 1 error generated.
vim +643 include/rdma/uverbs_ioctl.h
630
631 struct uverbs_attr_bundle {
632 /* New members MUST be added within the struct_group() macro below. */
633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
634 struct ib_udata driver_udata;
635 struct ib_udata ucore;
636 struct ib_uverbs_file *ufile;
637 struct ib_ucontext *context;
638 struct ib_uobject *uobject;
639 DECLARE_BITMAP(attr_present, UVERBS_API_ATTR_BKEY_LEN);
640 );
641 struct uverbs_attr attrs[];
642 };
> 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
644 "struct member likely outside of struct_group_tagged()");
645
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
2024-08-01 11:35 [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged() kernel test robot
@ 2024-08-01 12:47 ` Gustavo A. R. Silva
2024-08-01 19:08 ` Nathan Chancellor
0 siblings, 1 reply; 9+ messages in thread
From: Gustavo A. R. Silva @ 2024-08-01 12:47 UTC (permalink / raw)
To: kernel test robot, Gustavo A. R. Silva; +Cc: llvm, oe-kbuild-all, LKML
On 01/08/24 05:35, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20240729-cbc-2
> head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
> commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18] RDMA/uverbs: Use static_assert() to check struct sizes
> config: hexagon-randconfig-001-20240801 (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/config)
> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 430b90f04533b099d788db2668176038be38c53b)
Clang 20.0.0?? (thinkingface)
--
Gustavo
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202408011956.wscyBwq6-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> In file included from drivers/infiniband/core/uverbs.h:46:
> In file included from include/rdma/ib_verbs.h:15:
> In file included from include/linux/ethtool.h:18:
> In file included from include/linux/if_ether.h:19:
> In file included from include/linux/skbuff.h:17:
> In file included from include/linux/bvec.h:10:
> In file included from include/linux/highmem.h:10:
> In file included from include/linux/mm.h:2228:
> include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
> 514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
> | ~~~~~~~~~~~ ^ ~~~
> In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> In file included from drivers/infiniband/core/uverbs.h:46:
> In file included from include/rdma/ib_verbs.h:15:
> In file included from include/linux/ethtool.h:18:
> In file included from include/linux/if_ether.h:19:
> In file included from include/linux/skbuff.h:17:
> In file included from include/linux/bvec.h:10:
> In file included from include/linux/highmem.h:12:
> In file included from include/linux/hardirq.h:11:
> In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
> In file included from include/asm-generic/hardirq.h:17:
> In file included from include/linux/irq.h:20:
> In file included from include/linux/io.h:14:
> In file included from arch/hexagon/include/asm/io.h:328:
> include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> 548 | val = __raw_readb(PCI_IOBASE + addr);
> | ~~~~~~~~~~ ^
> include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> 561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
> | ~~~~~~~~~~ ^
> include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
> 37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
> | ^
> In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> In file included from drivers/infiniband/core/uverbs.h:46:
> In file included from include/rdma/ib_verbs.h:15:
> In file included from include/linux/ethtool.h:18:
> In file included from include/linux/if_ether.h:19:
> In file included from include/linux/skbuff.h:17:
> In file included from include/linux/bvec.h:10:
> In file included from include/linux/highmem.h:12:
> In file included from include/linux/hardirq.h:11:
> In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
> In file included from include/asm-generic/hardirq.h:17:
> In file included from include/linux/irq.h:20:
> In file included from include/linux/io.h:14:
> In file included from arch/hexagon/include/asm/io.h:328:
> include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> 574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
> | ~~~~~~~~~~ ^
> include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
> 35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
> | ^
> In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> In file included from drivers/infiniband/core/uverbs.h:46:
> In file included from include/rdma/ib_verbs.h:15:
> In file included from include/linux/ethtool.h:18:
> In file included from include/linux/if_ether.h:19:
> In file included from include/linux/skbuff.h:17:
> In file included from include/linux/bvec.h:10:
> In file included from include/linux/highmem.h:12:
> In file included from include/linux/hardirq.h:11:
> In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
> In file included from include/asm-generic/hardirq.h:17:
> In file included from include/linux/irq.h:20:
> In file included from include/linux/io.h:14:
> In file included from arch/hexagon/include/asm/io.h:328:
> include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> 585 | __raw_writeb(value, PCI_IOBASE + addr);
> | ~~~~~~~~~~ ^
> include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> 595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
> | ~~~~~~~~~~ ^
> include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> 605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
> | ~~~~~~~~~~ ^
> In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> In file included from drivers/infiniband/core/uverbs.h:49:
> In file included from include/rdma/uverbs_std_types.h:10:
>>> include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
> 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 644 | "struct member likely outside of struct_group_tagged()");
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
> 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
> | ^
> include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> | ^~~~
> include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates to '56 == 52'
> 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 644 | "struct member likely outside of struct_group_tagged()");
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> | ^~~~
> 7 warnings and 1 error generated.
>
>
> vim +643 include/rdma/uverbs_ioctl.h
>
> 630
> 631 struct uverbs_attr_bundle {
> 632 /* New members MUST be added within the struct_group() macro below. */
> 633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
> 634 struct ib_udata driver_udata;
> 635 struct ib_udata ucore;
> 636 struct ib_uverbs_file *ufile;
> 637 struct ib_ucontext *context;
> 638 struct ib_uobject *uobject;
> 639 DECLARE_BITMAP(attr_present, UVERBS_API_ATTR_BKEY_LEN);
> 640 );
> 641 struct uverbs_attr attrs[];
> 642 };
> > 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> 644 "struct member likely outside of struct_group_tagged()");
> 645
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
2024-08-01 12:47 ` Gustavo A. R. Silva
@ 2024-08-01 19:08 ` Nathan Chancellor
2024-08-01 20:17 ` Gustavo A. R. Silva
0 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2024-08-01 19:08 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: kernel test robot, Gustavo A. R. Silva, llvm, oe-kbuild-all, LKML
On Thu, Aug 01, 2024 at 06:47:58AM -0600, Gustavo A. R. Silva wrote:
>
>
> On 01/08/24 05:35, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20240729-cbc-2
> > head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
> > commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18] RDMA/uverbs: Use static_assert() to check struct sizes
> > config: hexagon-randconfig-001-20240801 (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/config)
> > compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 430b90f04533b099d788db2668176038be38c53b)
>
>
> Clang 20.0.0?? (thinkingface)
Indeed, Clang 19 branched and main is now 20 :)
https://github.com/llvm/llvm-project/commit/8f701b5df0adb3a2960d78ca2ad9cf53f39ba2fe
Cheers,
Nathan
> --
> Gustavo
>
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202408011956.wscyBwq6-lkp@intel.com/
> >
> > All errors (new ones prefixed by >>):
> >
> > In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> > In file included from drivers/infiniband/core/uverbs.h:46:
> > In file included from include/rdma/ib_verbs.h:15:
> > In file included from include/linux/ethtool.h:18:
> > In file included from include/linux/if_ether.h:19:
> > In file included from include/linux/skbuff.h:17:
> > In file included from include/linux/bvec.h:10:
> > In file included from include/linux/highmem.h:10:
> > In file included from include/linux/mm.h:2228:
> > include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
> > 514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
> > | ~~~~~~~~~~~ ^ ~~~
> > In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> > In file included from drivers/infiniband/core/uverbs.h:46:
> > In file included from include/rdma/ib_verbs.h:15:
> > In file included from include/linux/ethtool.h:18:
> > In file included from include/linux/if_ether.h:19:
> > In file included from include/linux/skbuff.h:17:
> > In file included from include/linux/bvec.h:10:
> > In file included from include/linux/highmem.h:12:
> > In file included from include/linux/hardirq.h:11:
> > In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
> > In file included from include/asm-generic/hardirq.h:17:
> > In file included from include/linux/irq.h:20:
> > In file included from include/linux/io.h:14:
> > In file included from arch/hexagon/include/asm/io.h:328:
> > include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> > 548 | val = __raw_readb(PCI_IOBASE + addr);
> > | ~~~~~~~~~~ ^
> > include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> > 561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
> > | ~~~~~~~~~~ ^
> > include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
> > 37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
> > | ^
> > In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> > In file included from drivers/infiniband/core/uverbs.h:46:
> > In file included from include/rdma/ib_verbs.h:15:
> > In file included from include/linux/ethtool.h:18:
> > In file included from include/linux/if_ether.h:19:
> > In file included from include/linux/skbuff.h:17:
> > In file included from include/linux/bvec.h:10:
> > In file included from include/linux/highmem.h:12:
> > In file included from include/linux/hardirq.h:11:
> > In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
> > In file included from include/asm-generic/hardirq.h:17:
> > In file included from include/linux/irq.h:20:
> > In file included from include/linux/io.h:14:
> > In file included from arch/hexagon/include/asm/io.h:328:
> > include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> > 574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
> > | ~~~~~~~~~~ ^
> > include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
> > 35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
> > | ^
> > In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> > In file included from drivers/infiniband/core/uverbs.h:46:
> > In file included from include/rdma/ib_verbs.h:15:
> > In file included from include/linux/ethtool.h:18:
> > In file included from include/linux/if_ether.h:19:
> > In file included from include/linux/skbuff.h:17:
> > In file included from include/linux/bvec.h:10:
> > In file included from include/linux/highmem.h:12:
> > In file included from include/linux/hardirq.h:11:
> > In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
> > In file included from include/asm-generic/hardirq.h:17:
> > In file included from include/linux/irq.h:20:
> > In file included from include/linux/io.h:14:
> > In file included from arch/hexagon/include/asm/io.h:328:
> > include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> > 585 | __raw_writeb(value, PCI_IOBASE + addr);
> > | ~~~~~~~~~~ ^
> > include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> > 595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
> > | ~~~~~~~~~~ ^
> > include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> > 605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
> > | ~~~~~~~~~~ ^
> > In file included from drivers/infiniband/core/ib_core_uverbs.c:8:
> > In file included from drivers/infiniband/core/uverbs.h:49:
> > In file included from include/rdma/uverbs_std_types.h:10:
> > > > include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
> > 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 644 | "struct member likely outside of struct_group_tagged()");
> > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
> > 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
> > | ^
> > include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> > | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> > | ^~~~
> > include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates to '56 == 52'
> > 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 644 | "struct member likely outside of struct_group_tagged()");
> > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> > | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> > | ^~~~
> > 7 warnings and 1 error generated.
> >
> >
> > vim +643 include/rdma/uverbs_ioctl.h
> >
> > 630
> > 631 struct uverbs_attr_bundle {
> > 632 /* New members MUST be added within the struct_group() macro below. */
> > 633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
> > 634 struct ib_udata driver_udata;
> > 635 struct ib_udata ucore;
> > 636 struct ib_uverbs_file *ufile;
> > 637 struct ib_ucontext *context;
> > 638 struct ib_uobject *uobject;
> > 639 DECLARE_BITMAP(attr_present, UVERBS_API_ATTR_BKEY_LEN);
> > 640 );
> > 641 struct uverbs_attr attrs[];
> > 642 };
> > > 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > 644 "struct member likely outside of struct_group_tagged()");
> > 645
> >
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
2024-08-01 19:08 ` Nathan Chancellor
@ 2024-08-01 20:17 ` Gustavo A. R. Silva
2024-08-01 22:14 ` Nathan Chancellor
0 siblings, 1 reply; 9+ messages in thread
From: Gustavo A. R. Silva @ 2024-08-01 20:17 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, Gustavo A. R. Silva, llvm, oe-kbuild-all, LKML
On 01/08/24 13:08, Nathan Chancellor wrote:
> On Thu, Aug 01, 2024 at 06:47:58AM -0600, Gustavo A. R. Silva wrote:
>>
>>
>> On 01/08/24 05:35, kernel test robot wrote:
>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20240729-cbc-2
>>> head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
>>> commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18] RDMA/uverbs: Use static_assert() to check struct sizes
>>> config: hexagon-randconfig-001-20240801 (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/config)
>>> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 430b90f04533b099d788db2668176038be38c53b)
>>
>>
>> Clang 20.0.0?? (thinkingface)
>
> Indeed, Clang 19 branched and main is now 20 :)
>
> https://github.com/llvm/llvm-project/commit/8f701b5df0adb3a2960d78ca2ad9cf53f39ba2fe
Yeah, but is that a stable release?
BTW, I don't see GCC reporting the same problem below:
>>>>> include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
>>> 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
>>> | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> 644 | "struct member likely outside of struct_group_tagged()");
>>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
>>> 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
>>> | ^
>>> include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
>>> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
>>> | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
>>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
>>> | ^~~~
>>> include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates to '56 == 52'
>>> 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
>>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> 644 | "struct member likely outside of struct_group_tagged()");
>>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
>>> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
>>> | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
>>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
>>> | ^~~~
>>> 7 warnings and 1 error generated.
>>>
>>>
>>> vim +643 include/rdma/uverbs_ioctl.h
>>>
>>> 630
>>> 631 struct uverbs_attr_bundle {
>>> 632 /* New members MUST be added within the struct_group() macro below. */
>>> 633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
>>> 634 struct ib_udata driver_udata;
>>> 635 struct ib_udata ucore;
>>> 636 struct ib_uverbs_file *ufile;
>>> 637 struct ib_ucontext *context;
>>> 638 struct ib_uobject *uobject;
>>> 639 DECLARE_BITMAP(attr_present, UVERBS_API_ATTR_BKEY_LEN);
>>> 640 );
>>> 641 struct uverbs_attr attrs[];
>>> 642 };
>>> > 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
>>> 644 "struct member likely outside of struct_group_tagged()");
>>> 645
>>>
>>
Thanks
--
Gustavo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
2024-08-01 20:17 ` Gustavo A. R. Silva
@ 2024-08-01 22:14 ` Nathan Chancellor
2024-08-01 22:35 ` Gustavo A. R. Silva
0 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2024-08-01 22:14 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: kernel test robot, Gustavo A. R. Silva, llvm, oe-kbuild-all,
LKML, Brian Cain, linux-hexagon
On Thu, Aug 01, 2024 at 02:17:50PM -0600, Gustavo A. R. Silva wrote:
>
>
> On 01/08/24 13:08, Nathan Chancellor wrote:
> > On Thu, Aug 01, 2024 at 06:47:58AM -0600, Gustavo A. R. Silva wrote:
> > >
> > >
> > > On 01/08/24 05:35, kernel test robot wrote:
> > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20240729-cbc-2
> > > > head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
> > > > commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18] RDMA/uverbs: Use static_assert() to check struct sizes
> > > > config: hexagon-randconfig-001-20240801 (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/config)
> > > > compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 430b90f04533b099d788db2668176038be38c53b)
> > >
> > >
> > > Clang 20.0.0?? (thinkingface)
> >
> > Indeed, Clang 19 branched and main is now 20 :)
> >
> > https://github.com/llvm/llvm-project/commit/8f701b5df0adb3a2960d78ca2ad9cf53f39ba2fe
>
> Yeah, but is that a stable release?
No, but the Intel folks have tested tip of tree LLVM against the kernel
for us for a few years now to try and catch issues such as this.
> BTW, I don't see GCC reporting the same problem below:
Hexagon does not have a GCC backend anymore so it is not going to be
possible to do an exact A/B comparison with this configuration but...
> > > > > > include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
> > > > 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > > > | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > 644 | "struct member likely outside of struct_group_tagged()");
> > > > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
> > > > 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
> > > > | ^
> > > > include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> > > > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> > > > | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> > > > | ^~~~
> > > > include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates to '56 == 52'
This seems to give some indication that perhaps there may be some
architecture specific here with padding maybe? I seem to recall ARM OABI
having something similar. Adding the Hexagon folks/list to get some more
clarification. Full warning and context:
https://lore.kernel.org/202408011956.wscyBwq6-lkp@intel.com/
The problematic section preprocessed since sometimes the macros
obfuscate things:
struct uverbs_attr_bundle {
union {
struct {
struct ib_udata driver_udata;
struct ib_udata ucore;
struct ib_uverbs_file *ufile;
struct ib_ucontext *context;
struct ib_uobject *uobject;
unsigned long attr_present[(((UVERBS_API_ATTR_BKEY_LEN) +
((sizeof(long) * 8)) - 1) /
((sizeof(long) * 8)))];
};
struct uverbs_attr_bundle_hdr {
struct ib_udata driver_udata;
struct ib_udata ucore;
struct ib_uverbs_file *ufile;
struct ib_ucontext *context;
struct ib_uobject *uobject;
unsigned long attr_present[(((UVERBS_API_ATTR_BKEY_LEN) +
((sizeof(long) * 8)) - 1) /
((sizeof(long) * 8)))];
} hdr;
};
struct uverbs_attr attrs[];
};
_Static_assert(__builtin_offsetof(struct uverbs_attr_bundle, attrs) ==
sizeof(struct uverbs_attr_bundle_hdr),
"struct member likely outside of struct_group_tagged()");
FWIW, I see this with all versions of Clang that the kernel supports
with this configuration.
Cheers,
Nathan
> > > > 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > > > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > 644 | "struct member likely outside of struct_group_tagged()");
> > > > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> > > > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> > > > | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> > > > | ^~~~
> > > > 7 warnings and 1 error generated.
> > > >
> > > >
> > > > vim +643 include/rdma/uverbs_ioctl.h
> > > >
> > > > 630
> > > > 631 struct uverbs_attr_bundle {
> > > > 632 /* New members MUST be added within the struct_group() macro below. */
> > > > 633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
> > > > 634 struct ib_udata driver_udata;
> > > > 635 struct ib_udata ucore;
> > > > 636 struct ib_uverbs_file *ufile;
> > > > 637 struct ib_ucontext *context;
> > > > 638 struct ib_uobject *uobject;
> > > > 639 DECLARE_BITMAP(attr_present, UVERBS_API_ATTR_BKEY_LEN);
> > > > 640 );
> > > > 641 struct uverbs_attr attrs[];
> > > > 642 };
> > > > > 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > > > 644 "struct member likely outside of struct_group_tagged()");
> > > > 645
> > > >
> > >
>
> Thanks
> --
> Gustavo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
2024-08-01 22:14 ` Nathan Chancellor
@ 2024-08-01 22:35 ` Gustavo A. R. Silva
2024-08-02 22:19 ` Nathan Chancellor
0 siblings, 1 reply; 9+ messages in thread
From: Gustavo A. R. Silva @ 2024-08-01 22:35 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, Gustavo A. R. Silva, llvm, oe-kbuild-all,
LKML, Brian Cain, linux-hexagon
On 01/08/24 16:14, Nathan Chancellor wrote:
> On Thu, Aug 01, 2024 at 02:17:50PM -0600, Gustavo A. R. Silva wrote:
>>
>>
>> On 01/08/24 13:08, Nathan Chancellor wrote:
>>> On Thu, Aug 01, 2024 at 06:47:58AM -0600, Gustavo A. R. Silva wrote:
>>>>
>>>>
>>>> On 01/08/24 05:35, kernel test robot wrote:
>>>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20240729-cbc-2
>>>>> head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
>>>>> commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18] RDMA/uverbs: Use static_assert() to check struct sizes
>>>>> config: hexagon-randconfig-001-20240801 (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/config)
>>>>> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 430b90f04533b099d788db2668176038be38c53b)
>>>>
>>>>
>>>> Clang 20.0.0?? (thinkingface)
>>>
>>> Indeed, Clang 19 branched and main is now 20 :)
>>>
>>> https://github.com/llvm/llvm-project/commit/8f701b5df0adb3a2960d78ca2ad9cf53f39ba2fe
>>
>> Yeah, but is that a stable release?
>
> No, but the Intel folks have tested tip of tree LLVM against the kernel
> for us for a few years now to try and catch issues such as this.
Oh, I see, fine. :)
>
>> BTW, I don't see GCC reporting the same problem below:
>
> Hexagon does not have a GCC backend anymore so it is not going to be
> possible to do an exact A/B comparison with this configuration but...
>
>>>>>>> include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
>>>>> 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
>>>>> | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> 644 | "struct member likely outside of struct_group_tagged()");
>>>>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
>>>>> 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
>>>>> | ^
>>>>> include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
>>>>> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
>>>>> | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
>>>>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
>>>>> | ^~~~
>>>>> include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates to '56 == 52'
>
> This seems to give some indication that perhaps there may be some
> architecture specific here with padding maybe? I seem to recall ARM OABI
> having something similar. Adding the Hexagon folks/list to get some more
> clarification. Full warning and context:
>
> https://lore.kernel.org/202408011956.wscyBwq6-lkp@intel.com/
>
> The problematic section preprocessed since sometimes the macros
> obfuscate things:
>
> struct uverbs_attr_bundle {
> union {
> struct {
> struct ib_udata driver_udata;
> struct ib_udata ucore;
> struct ib_uverbs_file *ufile;
> struct ib_ucontext *context;
> struct ib_uobject *uobject;
> unsigned long attr_present[(((UVERBS_API_ATTR_BKEY_LEN) +
> ((sizeof(long) * 8)) - 1) /
> ((sizeof(long) * 8)))];
> };
> struct uverbs_attr_bundle_hdr {
> struct ib_udata driver_udata;
> struct ib_udata ucore;
> struct ib_uverbs_file *ufile;
> struct ib_ucontext *context;
> struct ib_uobject *uobject;
> unsigned long attr_present[(((UVERBS_API_ATTR_BKEY_LEN) +
> ((sizeof(long) * 8)) - 1) /
> ((sizeof(long) * 8)))];
> } hdr;
> };
>
> struct uverbs_attr attrs[];
> };
> _Static_assert(__builtin_offsetof(struct uverbs_attr_bundle, attrs) ==
> sizeof(struct uverbs_attr_bundle_hdr),
> "struct member likely outside of struct_group_tagged()");
>
> FWIW, I see this with all versions of Clang that the kernel supports
> with this configuration.
I don't have access to a Clang compiler right now; I wonder if you could
help me get the output of this command:
pahole -C uverbs_attr_bundle drivers/infiniband/core/rdma_core.o
Thanks in advance!
-Gustavo
>
> Cheers,
> Nathan
>
>>>>> 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
>>>>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> 644 | "struct member likely outside of struct_group_tagged()");
>>>>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
>>>>> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
>>>>> | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
>>>>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
>>>>> | ^~~~
>>>>> 7 warnings and 1 error generated.
>>>>>
>>>>>
>>>>> vim +643 include/rdma/uverbs_ioctl.h
>>>>>
>>>>> 630
>>>>> 631 struct uverbs_attr_bundle {
>>>>> 632 /* New members MUST be added within the struct_group() macro below. */
>>>>> 633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
>>>>> 634 struct ib_udata driver_udata;
>>>>> 635 struct ib_udata ucore;
>>>>> 636 struct ib_uverbs_file *ufile;
>>>>> 637 struct ib_ucontext *context;
>>>>> 638 struct ib_uobject *uobject;
>>>>> 639 DECLARE_BITMAP(attr_present, UVERBS_API_ATTR_BKEY_LEN);
>>>>> 640 );
>>>>> 641 struct uverbs_attr attrs[];
>>>>> 642 };
>>>>> > 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
>>>>> 644 "struct member likely outside of struct_group_tagged()");
>>>>> 645
>>>>>
>>>>
>>
>> Thanks
>> --
>> Gustavo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
2024-08-01 22:35 ` Gustavo A. R. Silva
@ 2024-08-02 22:19 ` Nathan Chancellor
2024-08-06 15:36 ` [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct memb Brian Cain
0 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2024-08-02 22:19 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: kernel test robot, Gustavo A. R. Silva, llvm, oe-kbuild-all,
LKML, Brian Cain, linux-hexagon
On Thu, Aug 01, 2024 at 04:35:59PM -0600, Gustavo A. R. Silva wrote:
>
>
> On 01/08/24 16:14, Nathan Chancellor wrote:
> > On Thu, Aug 01, 2024 at 02:17:50PM -0600, Gustavo A. R. Silva wrote:
> > >
> > >
> > > On 01/08/24 13:08, Nathan Chancellor wrote:
> > > > On Thu, Aug 01, 2024 at 06:47:58AM -0600, Gustavo A. R. Silva wrote:
> > > > >
> > > > >
> > > > > On 01/08/24 05:35, kernel test robot wrote:
> > > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20240729-cbc-2
> > > > > > head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
> > > > > > commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18] RDMA/uverbs: Use static_assert() to check struct sizes
> > > > > > config: hexagon-randconfig-001-20240801 (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-lkp@intel.com/config)
> > > > > > compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 430b90f04533b099d788db2668176038be38c53b)
> > > > >
> > > > >
> > > > > Clang 20.0.0?? (thinkingface)
> > > >
> > > > Indeed, Clang 19 branched and main is now 20 :)
> > > >
> > > > https://github.com/llvm/llvm-project/commit/8f701b5df0adb3a2960d78ca2ad9cf53f39ba2fe
> > >
> > > Yeah, but is that a stable release?
> >
> > No, but the Intel folks have tested tip of tree LLVM against the kernel
> > for us for a few years now to try and catch issues such as this.
>
> Oh, I see, fine. :)
>
> >
> > > BTW, I don't see GCC reporting the same problem below:
> >
> > Hexagon does not have a GCC backend anymore so it is not going to be
> > possible to do an exact A/B comparison with this configuration but...
> >
> > > > > > > > include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
> > > > > > 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > 644 | "struct member likely outside of struct_group_tagged()");
> > > > > > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
> > > > > > 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
> > > > > > | ^
> > > > > > include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> > > > > > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> > > > > > | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> > > > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> > > > > > | ^~~~
> > > > > > include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates to '56 == 52'
> >
> > This seems to give some indication that perhaps there may be some
> > architecture specific here with padding maybe? I seem to recall ARM OABI
> > having something similar. Adding the Hexagon folks/list to get some more
> > clarification. Full warning and context:
> >
> > https://lore.kernel.org/202408011956.wscyBwq6-lkp@intel.com/
> >
> > The problematic section preprocessed since sometimes the macros
> > obfuscate things:
> >
> > struct uverbs_attr_bundle {
> > union {
> > struct {
> > struct ib_udata driver_udata;
> > struct ib_udata ucore;
> > struct ib_uverbs_file *ufile;
> > struct ib_ucontext *context;
> > struct ib_uobject *uobject;
> > unsigned long attr_present[(((UVERBS_API_ATTR_BKEY_LEN) +
> > ((sizeof(long) * 8)) - 1) /
> > ((sizeof(long) * 8)))];
> > };
> > struct uverbs_attr_bundle_hdr {
> > struct ib_udata driver_udata;
> > struct ib_udata ucore;
> > struct ib_uverbs_file *ufile;
> > struct ib_ucontext *context;
> > struct ib_uobject *uobject;
> > unsigned long attr_present[(((UVERBS_API_ATTR_BKEY_LEN) +
> > ((sizeof(long) * 8)) - 1) /
> > ((sizeof(long) * 8)))];
> > } hdr;
> > };
> >
> > struct uverbs_attr attrs[];
> > };
> > _Static_assert(__builtin_offsetof(struct uverbs_attr_bundle, attrs) ==
> > sizeof(struct uverbs_attr_bundle_hdr),
> > "struct member likely outside of struct_group_tagged()");
> >
> > FWIW, I see this with all versions of Clang that the kernel supports
> > with this configuration.
>
> I don't have access to a Clang compiler right now; I wonder if you could
> help me get the output of this command:
>
> pahole -C uverbs_attr_bundle drivers/infiniband/core/rdma_core.o
We disabled CONFIG_DEBUG_INFO_BTF for Hexagon because elfutils does not
support Hexagon relocations but this is built-in for this configuration
so I removed that limitation and ended up with:
$ pahole -C uverbs_attr_bundle vmlinux
struct uverbs_attr_bundle {
union {
struct {
struct ib_udata driver_udata; /* 0 16 */
struct ib_udata ucore; /* 16 16 */
struct ib_uverbs_file * ufile; /* 32 4 */
struct ib_ucontext * context; /* 36 4 */
struct ib_uobject * uobject; /* 40 4 */
unsigned long attr_present[2]; /* 44 8 */
}; /* 0 52 */
struct uverbs_attr_bundle_hdr hdr; /* 0 52 */
}; /* 0 52 */
/* XXX 4 bytes hole, try to pack */
union {
struct {
struct ib_udata driver_udata; /* 0 16 */
struct ib_udata ucore; /* 16 16 */
struct ib_uverbs_file * ufile; /* 32 4 */
struct ib_ucontext * context; /* 36 4 */
struct ib_uobject * uobject; /* 40 4 */
unsigned long attr_present[2]; /* 44 8 */
}; /* 0 52 */
struct uverbs_attr_bundle_hdr hdr; /* 0 52 */
};
struct uverbs_attr attrs[]; /* 56 0 */
/* size: 56, cachelines: 1, members: 2 */
/* sum members: 52, holes: 1, sum holes: 4 */
/* last cacheline: 56 bytes */
};
If you want any other information or want me to test anything, I am more
than happy to do so.
Cheers,
Nathan
> > > > > > 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > 644 | "struct member likely outside of struct_group_tagged()");
> > > > > > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> > > > > > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> > > > > > | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> > > > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> > > > > > | ^~~~
> > > > > > 7 warnings and 1 error generated.
> > > > > >
> > > > > >
> > > > > > vim +643 include/rdma/uverbs_ioctl.h
> > > > > >
> > > > > > 630
> > > > > > 631 struct uverbs_attr_bundle {
> > > > > > 632 /* New members MUST be added within the struct_group() macro below. */
> > > > > > 633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
> > > > > > 634 struct ib_udata driver_udata;
> > > > > > 635 struct ib_udata ucore;
> > > > > > 636 struct ib_uverbs_file *ufile;
> > > > > > 637 struct ib_ucontext *context;
> > > > > > 638 struct ib_uobject *uobject;
> > > > > > 639 DECLARE_BITMAP(attr_present, UVERBS_API_ATTR_BKEY_LEN);
> > > > > > 640 );
> > > > > > 641 struct uverbs_attr attrs[];
> > > > > > 642 };
> > > > > > > 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > 644 "struct member likely outside of struct_group_tagged()");
> > > > > > 645
> > > > > >
> > > > >
> > >
> > > Thanks
> > > --
> > > Gustavo
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct memb...
2024-08-02 22:19 ` Nathan Chancellor
@ 2024-08-06 15:36 ` Brian Cain
[not found] ` <CH3PR02MB102474F1D633D03102B5F2855B8872@CH3PR02MB10247.namprd02.prod.outlook.com>
0 siblings, 1 reply; 9+ messages in thread
From: Brian Cain @ 2024-08-06 15:36 UTC (permalink / raw)
To: Nathan Chancellor, Gustavo A. R. Silva
Cc: kernel test robot, Gustavo A. R. Silva, llvm, oe-kbuild-all,
LKML, linux-hexagon, Sid Manning, Sundeep Kushwaha
> -----Original Message-----
> From: Nathan Chancellor <nathan@kernel.org>
> Sent: Friday, August 2, 2024 5:20 PM
> To: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Cc: kernel test robot <lkp@intel.com>; Gustavo A. R. Silva
> <gustavoars@kernel.org>; llvm@lists.linux.dev; oe-kbuild-all@lists.linux.dev;
> LKML <linux-kernel@vger.kernel.org>; Brian Cain <bcain@quicinc.com>; linux-
> hexagon@vger.kernel.org
> Subject: Re: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18]
> include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to
> requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) ==
> sizeof(struct uverbs_attr_bundle_hdr)': struct memb...
>
> WARNING: This email originated from outside of Qualcomm. Please be wary of
> any links or attachments, and do not enable macros.
>
> On Thu, Aug 01, 2024 at 04:35:59PM -0600, Gustavo A. R. Silva wrote:
> >
> >
> > On 01/08/24 16:14, Nathan Chancellor wrote:
> > > On Thu, Aug 01, 2024 at 02:17:50PM -0600, Gustavo A. R. Silva wrote:
> > > >
> > > >
> > > > On 01/08/24 13:08, Nathan Chancellor wrote:
> > > > > On Thu, Aug 01, 2024 at 06:47:58AM -0600, Gustavo A. R. Silva wrote:
> > > > > >
> > > > > >
> > > > > > On 01/08/24 05:35, kernel test robot wrote:
> > > > > > > tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
> testing/wfamnae-next20240729-cbc-2
> > > > > > > head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
> > > > > > > commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18]
> RDMA/uverbs: Use static_assert() to check struct sizes
> > > > > > > config: hexagon-randconfig-001-20240801
> (https://download.01.org/0day-ci/archive/20240801/202408011956.wscyBwq6-
> lkp@intel.com/config)
> > > > > > > compiler: clang version 20.0.0git (https://github.com/llvm/llvm-
> project 430b90f04533b099d788db2668176038be38c53b)
> > > > > >
> > > > > >
> > > > > > Clang 20.0.0?? (thinkingface)
> > > > >
> > > > > Indeed, Clang 19 branched and main is now 20 :)
> > > > >
> > > > > https://github.com/llvm/llvm-
> project/commit/8f701b5df0adb3a2960d78ca2ad9cf53f39ba2fe
> > > >
> > > > Yeah, but is that a stable release?
> > >
> > > No, but the Intel folks have tested tip of tree LLVM against the kernel
> > > for us for a few years now to try and catch issues such as this.
> >
> > Oh, I see, fine. :)
> >
> > >
> > > > BTW, I don't see GCC reporting the same problem below:
> > >
> > > Hexagon does not have a GCC backend anymore so it is not going to be
> > > possible to do an exact A/B comparison with this configuration but...
> > >
> > > > > > > > > include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed
> due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) ==
> sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of
> struct_group_tagged()
> > > > > > > 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) ==
> sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > > |
> ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > 644 | "struct member likely outside of
> struct_group_tagged()");
> > > > > > > |
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > include/linux/stddef.h:16:32: note: expanded from macro
> 'offsetof'
> > > > > > > 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE,
> MEMBER)
> > > > > > > | ^
> > > > > > > include/linux/build_bug.h:77:50: note: expanded from macro
> 'static_assert'
> > > > > > > 77 | #define static_assert(expr, ...) __static_assert(expr,
> ##__VA_ARGS__, #expr)
> > > > > > > |
> ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > include/linux/build_bug.h:78:56: note: expanded from macro
> '__static_assert'
> > > > > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr,
> msg)
> > > > > > > | ^~~~
> > > > > > > include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates
> to '56 == 52'
> > >
> > > This seems to give some indication that perhaps there may be some
> > > architecture specific here with padding maybe? I seem to recall ARM OABI
> > > having something similar. Adding the Hexagon folks/list to get some more
> > > clarification. Full warning and context:
> > >
> > > https://lore.kernel.org/202408011956.wscyBwq6-lkp@intel.com/
> > >
There might be hexagon-specific padding requirements, but not ones that I've stumbled across before. I've added Sundeep from the compiler team who may be able to help.
> > > The problematic section preprocessed since sometimes the macros
> > > obfuscate things:
> > >
> > > struct uverbs_attr_bundle {
> > > union {
> > > struct {
> > > struct ib_udata driver_udata;
> > > struct ib_udata ucore;
> > > struct ib_uverbs_file *ufile;
> > > struct ib_ucontext *context;
> > > struct ib_uobject *uobject;
> > > unsigned long attr_present[(((UVERBS_API_ATTR_BKEY_LEN)
> +
> > > ((sizeof(long) * 8)) - 1) /
> > > ((sizeof(long) * 8)))];
> > > };
> > > struct uverbs_attr_bundle_hdr {
> > > struct ib_udata driver_udata;
> > > struct ib_udata ucore;
> > > struct ib_uverbs_file *ufile;
> > > struct ib_ucontext *context;
> > > struct ib_uobject *uobject;
> > > unsigned long attr_present[(((UVERBS_API_ATTR_BKEY_LEN)
> +
> > > ((sizeof(long) * 8)) - 1) /
> > > ((sizeof(long) * 8)))];
> > > } hdr;
> > > };
> > >
> > > struct uverbs_attr attrs[];
> > > };
> > > _Static_assert(__builtin_offsetof(struct uverbs_attr_bundle, attrs) ==
> > > sizeof(struct uverbs_attr_bundle_hdr),
> > > "struct member likely outside of struct_group_tagged()");
> > >
> > > FWIW, I see this with all versions of Clang that the kernel supports
> > > with this configuration.
> >
> > I don't have access to a Clang compiler right now; I wonder if you could
> > help me get the output of this command:
> >
> > pahole -C uverbs_attr_bundle drivers/infiniband/core/rdma_core.o
>
> We disabled CONFIG_DEBUG_INFO_BTF for Hexagon because elfutils does not
> support Hexagon relocations but this is built-in for this configuration
> so I removed that limitation and ended up with:
>
> $ pahole -C uverbs_attr_bundle vmlinux
> struct uverbs_attr_bundle {
> union {
> struct {
> struct ib_udata driver_udata; /* 0 16 */
> struct ib_udata ucore; /* 16 16 */
> struct ib_uverbs_file * ufile; /* 32 4 */
> struct ib_ucontext * context; /* 36 4 */
> struct ib_uobject * uobject; /* 40 4 */
> unsigned long attr_present[2]; /* 44 8 */
> }; /* 0 52 */
> struct uverbs_attr_bundle_hdr hdr; /* 0 52 */
> }; /* 0 52 */
>
> /* XXX 4 bytes hole, try to pack */
> union {
> struct {
> struct ib_udata driver_udata; /* 0 16 */
> struct ib_udata ucore; /* 16 16 */
> struct ib_uverbs_file * ufile; /* 32 4 */
> struct ib_ucontext * context; /* 36 4 */
> struct ib_uobject * uobject; /* 40 4 */
> unsigned long attr_present[2]; /* 44 8 */
> }; /* 0 52 */
> struct uverbs_attr_bundle_hdr hdr; /* 0 52 */
> };
>
>
> struct uverbs_attr attrs[]; /* 56 0 */
>
> /* size: 56, cachelines: 1, members: 2 */
> /* sum members: 52, holes: 1, sum holes: 4 */
> /* last cacheline: 56 bytes */
> };
>
> If you want any other information or want me to test anything, I am more
> than happy to do so.
>
> Cheers,
> Nathan
>
> > > > > > > 643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) ==
> sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > > |
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > 644 | "struct member likely outside of
> struct_group_tagged()");
> > > > > > > |
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > include/linux/build_bug.h:77:50: note: expanded from macro
> 'static_assert'
> > > > > > > 77 | #define static_assert(expr, ...) __static_assert(expr,
> ##__VA_ARGS__, #expr)
> > > > > > > |
> ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > include/linux/build_bug.h:78:56: note: expanded from macro
> '__static_assert'
> > > > > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr,
> msg)
> > > > > > > | ^~~~
> > > > > > > 7 warnings and 1 error generated.
> > > > > > >
> > > > > > >
> > > > > > > vim +643 include/rdma/uverbs_ioctl.h
> > > > > > >
> > > > > > > 630
> > > > > > > 631 struct uverbs_attr_bundle {
> > > > > > > 632 /* New members MUST be added within the
> struct_group() macro below. */
> > > > > > > 633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
> > > > > > > 634 struct ib_udata driver_udata;
> > > > > > > 635 struct ib_udata ucore;
> > > > > > > 636 struct ib_uverbs_file *ufile;
> > > > > > > 637 struct ib_ucontext *context;
> > > > > > > 638 struct ib_uobject *uobject;
> > > > > > > 639 DECLARE_BITMAP(attr_present,
> UVERBS_API_ATTR_BKEY_LEN);
> > > > > > > 640 );
> > > > > > > 641 struct uverbs_attr attrs[];
> > > > > > > 642 };
> > > > > > > > 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) ==
> sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > > 644 "struct member likely outside of
> struct_group_tagged()");
> > > > > > > 645
> > > > > > >
> > > > > >
> > > >
> > > > Thanks
> > > > --
> > > > Gustavo
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct memb...
[not found] ` <CH3PR02MB102474F1D633D03102B5F2855B8872@CH3PR02MB10247.namprd02.prod.outlook.com>
@ 2024-08-14 16:30 ` Steven Walk
0 siblings, 0 replies; 9+ messages in thread
From: Steven Walk @ 2024-08-14 16:30 UTC (permalink / raw)
To: Brian Cain, Nathan Chancellor, Gustavo A. R. Silva, Steven Walk (QUIC)
Cc: kernel test robot, Gustavo A. R. Silva, llvm, oe-kbuild-all,
LKML, linux-hexagon, Sid Manning, Sundeep Kushwaha
Hello Brian, et.al
This is not related to clang-20.
The compiler is asserting because the expression is not considering the alignment
of the 'attrs' member. This can be seen in the output when -fdump-record-layouts
is added the compiler (and the assert commented out). The union in
question is:
struct uverbs_attr_bundle {
union { <union entries including uverbs_attr_bundle_hdr> }
struct uverbs_attr attrs[];
};
Static_assert(
__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
"struct member likely outside of struct_group_tagged()")
note: expression evaluates to '56 == 52'
Regards,
Steve Walk
Evidence below.
28127 *** Dumping AST Record Layout
28128 0 | struct uverbs_attr_bundle
28129 0 | union uverbs_attr_bundle::(anonymous at noAssert.c:94178:2)
28130 0 | struct uverbs_attr_bundle::(anonymous at noAssert.c:94178:10)
28131 0 | struct ib_udata driver_udata
28132 0 | const void * inbuf
28133 4 | void * outbuf
28134 8 | size_t inlen
28135 12 | size_t outlen
28136 16 | struct ib_udata ucore
28137 16 | const void * inbuf
28138 20 | void * outbuf
28139 24 | size_t inlen
28140 28 | size_t outlen
28141 32 | struct ib_uverbs_file * ufile
28142 36 | struct ib_ucontext * context
28143 40 | struct ib_uobject * uobject
28144 44 | unsigned long[2] attr_present
28145 0 | struct uverbs_attr_bundle_hdr hdr
28146 0 | struct ib_udata driver_udata
28147 0 | const void * inbuf
28148 4 | void * outbuf
28149 8 | size_t inlen
28150 12 | size_t outlen
28151 16 | struct ib_udata ucore
28152 16 | const void * inbuf
28153 20 | void * outbuf
28154 24 | size_t inlen
28155 28 | size_t outlen
28156 32 | struct ib_uverbs_file * ufile
28157 36 | struct ib_ucontext * context
28158 40 | struct ib_uobject * uobject
28159 44 | unsigned long[2] attr_present
28160 56 | struct uverbs_attr[] attrs //<<--- Field used in _Static_assert
28161 | [sizeof=56, align=8]
28162
28022 *** Dumping AST Record Layout
28023 0 | union uverbs_attr::(anonymous at noAssert.c:94169:2)
28024 0 | struct uverbs_ptr_attr ptr_attr
28025 0 | union uverbs_ptr_attr::(anonymous at noAssert.c:94149:2)
28026 0 | void * ptr
28027 0 | u64 data
28028 8 | u16 len
28029 10 | u16 uattr_idx
28030 12 | u8 enum_id
28031 0 | struct uverbs_obj_attr obj_attr
28032 0 | struct ib_uobject * uobject
28033 4 | const struct uverbs_api_attr * attr_elm
28034 0 | struct uverbs_objs_arr_attr objs_arr_attr
28035 0 | struct ib_uobject ** uobjects
28036 4 | u16 len
28037 | [sizeof=16, align=8] //<<--- Required alignment
28038
This record is in the union that cries.
28093 *** Dumping AST Record Layout
28094 0 | union uverbs_attr_bundle::(anonymous at noAssert.c:94178:2)
28095 0 | struct uverbs_attr_bundle::(anonymous at noAssert.c:94178:10)
28096 0 | struct ib_udata driver_udata
28097 0 | const void * inbuf
28098 4 | void * outbuf
28099 8 | size_t inlen
28100 12 | size_t outlen
28101 16 | struct ib_udata ucore
28102 16 | const void * inbuf
28103 20 | void * outbuf
28104 24 | size_t inlen
28105 28 | size_t outlen
28106 32 | struct ib_uverbs_file * ufile
28107 36 | struct ib_ucontext * context
28108 40 | struct ib_uobject * uobject
28109 44 | unsigned long[2] attr_present
28110 0 | struct uverbs_attr_bundle_hdr hdr
28111 0 | struct ib_udata driver_udata
28112 0 | const void * inbuf
28113 4 | void * outbuf
28114 8 | size_t inlen
28115 12 | size_t outlen
28116 16 | struct ib_udata ucore
28117 16 | const void * inbuf
28118 20 | void * outbuf
28119 24 | size_t inlen
28120 28 | size_t outlen
28121 32 | struct ib_uverbs_file * ufile
28122 36 | struct ib_ucontext * context
28123 40 | struct ib_uobject * uobject
28124 44 | unsigned long[2] attr_present
28125 | [sizeof=52, align=4]
28126
-----Original Message-----
From: Brian Cain <bcain@quicinc.com>
Sent: Tuesday, August 13, 2024 10:27 PM
To: Brian Cain <bcain@quicinc.com>; Nathan Chancellor <nathan@kernel.org>; Gustavo A. R. Silva <gustavo@embeddedor.com>; Steven Walk (QUIC) <quic_walk@quicinc.com>
Cc: kernel test robot <lkp@intel.com>; Gustavo A. R. Silva <gustavoars@kernel.org>; llvm@lists.linux.dev; oe-kbuild-all@lists.linux.dev; LKML <linux-kernel@vger.kernel.org>; linux-hexagon@vger.kernel.org; Sid Manning <sidneym@quicinc.com>; Sundeep Kushwaha <sundeepk@quicinc.com>
Subject: RE: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct memb...
> -----Original Message-----
> From: Brian Cain <bcain@quicinc.com>
> Sent: Tuesday, August 6, 2024 10:36 AM
> To: Nathan Chancellor <nathan@kernel.org>; Gustavo A. R. Silva
> <gustavo@embeddedor.com>
> Cc: kernel test robot <lkp@intel.com>; Gustavo A. R. Silva
> <gustavoars@kernel.org>; llvm@lists.linux.dev;
> oe-kbuild-all@lists.linux.dev; LKML <linux-kernel@vger.kernel.org>;
> linux-hexagon@vger.kernel.org; Sid Manning <sidneym@quicinc.com>;
> Sundeep Kushwaha <sundeepk@quicinc.com>
> Subject: RE: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18]
> include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due
> to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs)
> == sizeof(struct uverbs_attr_bundle_hdr)': struct memb...
>
> WARNING: This email originated from outside of Qualcomm. Please be
> wary of any links or attachments, and do not enable macros.
>
> > -----Original Message-----
> > From: Nathan Chancellor <nathan@kernel.org>
> > Sent: Friday, August 2, 2024 5:20 PM
> > To: Gustavo A. R. Silva <gustavo@embeddedor.com>
> > Cc: kernel test robot <lkp@intel.com>; Gustavo A. R. Silva
> > <gustavoars@kernel.org>; llvm@lists.linux.dev;
> > oe-kbuild-all@lists.linux.dev; LKML <linux-kernel@vger.kernel.org>;
> > Brian Cain <bcain@quicinc.com>; linux- hexagon@vger.kernel.org
> > Subject: Re: [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18]
> > include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed
> > due to requirement '__builtin_offsetof(struct uverbs_attr_bundle,
> > attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct memb...
> >
> > WARNING: This email originated from outside of Qualcomm. Please be
> > wary
> of
> > any links or attachments, and do not enable macros.
> >
> > On Thu, Aug 01, 2024 at 04:35:59PM -0600, Gustavo A. R. Silva wrote:
> > >
> > >
> > > On 01/08/24 16:14, Nathan Chancellor wrote:
> > > > On Thu, Aug 01, 2024 at 02:17:50PM -0600, Gustavo A. R. Silva wrote:
> > > > >
> > > > >
> > > > > On 01/08/24 13:08, Nathan Chancellor wrote:
> > > > > > On Thu, Aug 01, 2024 at 06:47:58AM -0600, Gustavo A. R. Silva wrote:
> > > > > > >
> > > > > > >
> > > > > > > On 01/08/24 05:35, kernel test robot wrote:
> > > > > > > > tree:
> > https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
> > testing/wfamnae-next20240729-cbc-2
> > > > > > > > head: df15c862c1b93b6e1f6c90b0d7971f7a6ad66751
> > > > > > > > commit: e7cd9f429a852fb7e37a706c7d08fc36e7863e06 [11/18]
> > RDMA/uverbs: Use static_assert() to check struct sizes
> > > > > > > > config: hexagon-randconfig-001-20240801
> > (https://download.01.org/0day-
> ci/archive/20240801/202408011956.wscyBwq6-
> > lkp@intel.com/config)
> > > > > > > > compiler: clang version 20.0.0git
> > > > > > > > (https://github.com/llvm/llvm-
> > project 430b90f04533b099d788db2668176038be38c53b)
> > > > > > >
> > > > > > >
> > > > > > > Clang 20.0.0?? (thinkingface)
> > > > > >
> > > > > > Indeed, Clang 19 branched and main is now 20 :)
> > > > > >
> > > > > > https://github.com/llvm/llvm-
> > project/commit/8f701b5df0adb3a2960d78ca2ad9cf53f39ba2fe
> > > > >
> > > > > Yeah, but is that a stable release?
> > > >
> > > > No, but the Intel folks have tested tip of tree LLVM against the
> > > > kernel for us for a few years now to try and catch issues such as this.
> > >
> > > Oh, I see, fine. :)
> > >
> > > >
> > > > > BTW, I don't see GCC reporting the same problem below:
> > > >
> > > > Hexagon does not have a GCC backend anymore so it is not going
> > > > to be possible to do an exact A/B comparison with this configuration but...
> > > >
> > > > > > > > > > include/rdma/uverbs_ioctl.h:643:15: error: static
> > > > > > > > > > assertion
> failed
> > due to requirement '__builtin_offsetof(struct uverbs_attr_bundle,
> > attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member
> > likely outside of
> > struct_group_tagged()
> > > > > > > > 643 | static_assert(offsetof(struct
> > > > > > > > uverbs_attr_bundle, attrs)
> ==
> > sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > > > |
> >
> ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > > 644 | "struct member likely outside of
> > struct_group_tagged()");
> > > > > > > > |
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > > include/linux/stddef.h:16:32: note: expanded from
> > > > > > > > macro
> > 'offsetof'
> > > > > > > > 16 | #define offsetof(TYPE, MEMBER)
> __builtin_offsetof(TYPE,
> > MEMBER)
> > > > > > > > | ^
> > > > > > > > include/linux/build_bug.h:77:50: note: expanded
> > > > > > > > from macro
> > 'static_assert'
> > > > > > > > 77 | #define static_assert(expr, ...)
> > > > > > > > __static_assert(expr,
> > ##__VA_ARGS__, #expr)
> > > > > > > > |
> > ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > > include/linux/build_bug.h:78:56: note: expanded
> > > > > > > > from macro
> > '__static_assert'
> > > > > > > > 78 | #define __static_assert(expr, msg, ...)
> > > > > > > > _Static_assert(expr,
> > msg)
> > > > > > > > | ^~~~
> > > > > > > > include/rdma/uverbs_ioctl.h:643:58: note:
> > > > > > > > expression evaluates
> > to '56 == 52'
> > > >
> > > > This seems to give some indication that perhaps there may be
> > > > some architecture specific here with padding maybe? I seem to
> > > > recall ARM OABI having something similar. Adding the Hexagon
> > > > folks/list to get some more clarification. Full warning and context:
> > > >
> > > > https://lore.kernel.org/202408011956.wscyBwq6-lkp@intel.com/
> > > >
>
> There might be hexagon-specific padding requirements, but not ones
> that I've stumbled across before. I've added Sundeep from the
> compiler team who may be able to help.
Steve suggested I try dumping the record layouts using clang's "-fdump-record-layouts". I did so using the clang 18.1.8 binary from https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8 -- I thought it was reasonable to use this older release because it still generates the static assertion. But I can repeat it with clang-20 built from the bot's cited commit if preferred.
Steve - can you give any advice about the compiler's behavior wrt this struct layout and the assertion?
I've attached the unabridged output from clang with "-fdump-record-layouts". Here's an excerpt:
*** Dumping AST Record Layout
0 | struct uverbs_attr_bundle_hdr
0 | struct ib_udata driver_udata
0 | const void * inbuf
4 | void * outbuf
8 | size_t inlen
12 | size_t outlen
16 | struct ib_udata ucore
16 | const void * inbuf
20 | void * outbuf
24 | size_t inlen
28 | size_t outlen
32 | struct ib_uverbs_file * ufile
36 | struct ib_ucontext * context
40 | struct ib_uobject * uobject
44 | unsigned long[2] attr_present
| [sizeof=52, align=4]
*** Dumping AST Record Layout
0 | union uverbs_attr_bundle::(anonymous at ../include/rdma/uverbs_ioctl.h:633:2)
0 | struct uverbs_attr_bundle::(anonymous at ../include/rdma/uverbs_ioctl.h:633:2)
0 | struct ib_udata driver_udata
0 | const void * inbuf
4 | void * outbuf
8 | size_t inlen
12 | size_t outlen
16 | struct ib_udata ucore
16 | const void * inbuf
20 | void * outbuf
24 | size_t inlen
28 | size_t outlen
32 | struct ib_uverbs_file * ufile
36 | struct ib_ucontext * context
40 | struct ib_uobject * uobject
44 | unsigned long[2] attr_present
0 | struct uverbs_attr_bundle_hdr hdr
0 | struct ib_udata driver_udata
0 | const void * inbuf
4 | void * outbuf
8 | size_t inlen
12 | size_t outlen
16 | struct ib_udata ucore
16 | const void * inbuf
20 | void * outbuf
24 | size_t inlen
In file included from ../drivers/infiniband/core/ib_core_uverbs.c:8:
In file included from ../drivers/infiniband/core/uverbs.h:49:
In file included from ../include/rdma/uverbs_std_types.h:10:
../include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged()
643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644 | "struct member likely outside of struct_group_tagged()");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
| ^
../include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
../include/rdma/uverbs_ioctl.h:643:58: note: expression evaluates to '56 == 52'
643 | static_assert(offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644 | "struct member likely outside of struct_group_tagged()");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
28 | size_t outlen
32 | struct ib_uverbs_file * ufile
36 | struct ib_ucontext * context
40 | struct ib_uobject * uobject
44 | unsigned long[2] attr_present
| [sizeof=52, align=4]
I've also attached the "clang -cc1" invocation and preprocessed C output for reference.
> > > > The problematic section preprocessed since sometimes the macros
> > > > obfuscate things:
> > > >
> > > > struct uverbs_attr_bundle {
> > > > union {
> > > > struct {
> > > > struct ib_udata driver_udata;
> > > > struct ib_udata ucore;
> > > > struct ib_uverbs_file *ufile;
> > > > struct ib_ucontext *context;
> > > > struct ib_uobject *uobject;
> > > > unsigned long
> attr_present[(((UVERBS_API_ATTR_BKEY_LEN)
> > +
> > > > ((sizeof(long) * 8)) - 1) /
> > > > ((sizeof(long) * 8)))];
> > > > };
> > > > struct uverbs_attr_bundle_hdr {
> > > > struct ib_udata driver_udata;
> > > > struct ib_udata ucore;
> > > > struct ib_uverbs_file *ufile;
> > > > struct ib_ucontext *context;
> > > > struct ib_uobject *uobject;
> > > > unsigned long
> attr_present[(((UVERBS_API_ATTR_BKEY_LEN)
> > +
> > > > ((sizeof(long) * 8)) - 1) /
> > > > ((sizeof(long) * 8)))];
> > > > } hdr;
> > > > };
> > > >
> > > > struct uverbs_attr attrs[]; };
> > > > _Static_assert(__builtin_offsetof(struct uverbs_attr_bundle, attrs) ==
> > > > sizeof(struct uverbs_attr_bundle_hdr),
> > > > "struct member likely outside of
> > > > struct_group_tagged()");
> > > >
> > > > FWIW, I see this with all versions of Clang that the kernel
> > > > supports with this configuration.
> > >
> > > I don't have access to a Clang compiler right now; I wonder if you
> > > could help me get the output of this command:
> > >
> > > pahole -C uverbs_attr_bundle drivers/infiniband/core/rdma_core.o
> >
> > We disabled CONFIG_DEBUG_INFO_BTF for Hexagon because elfutils does
> not
> > support Hexagon relocations but this is built-in for this
> > configuration so I removed that limitation and ended up with:
> >
> > $ pahole -C uverbs_attr_bundle vmlinux struct uverbs_attr_bundle {
> > union {
> > struct {
> > struct ib_udata driver_udata; /* 0 16 */
> > struct ib_udata ucore; /* 16 16 */
> > struct ib_uverbs_file * ufile; /* 32 4 */
> > struct ib_ucontext * context; /* 36 4 */
> > struct ib_uobject * uobject; /* 40 4 */
> > unsigned long attr_present[2]; /* 44 8 */
> > }; /* 0 52 */
> > struct uverbs_attr_bundle_hdr hdr; /* 0 52 */
> > }; /* 0 52 */
> >
> > /* XXX 4 bytes hole, try to pack */
> > union {
> > struct {
> > struct ib_udata driver_udata; /* 0 16 */
> > struct ib_udata ucore; /* 16 16 */
> > struct ib_uverbs_file * ufile; /* 32 4 */
> > struct ib_ucontext * context; /* 36 4 */
> > struct ib_uobject * uobject; /* 40 4 */
> > unsigned long attr_present[2]; /* 44 8 */
> > }; /* 0 52 */
> > struct uverbs_attr_bundle_hdr hdr; /* 0 52 */
> > };
> >
> >
> > struct uverbs_attr attrs[]; /* 56 0 */
> >
> > /* size: 56, cachelines: 1, members: 2 */
> > /* sum members: 52, holes: 1, sum holes: 4 */
> > /* last cacheline: 56 bytes */ };
> >
> > If you want any other information or want me to test anything, I am
> > more than happy to do so.
> >
> > Cheers,
> > Nathan
> >
> > > > > > > > 643 | static_assert(offsetof(struct
> > > > > > > > uverbs_attr_bundle, attrs)
> ==
> > sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > > > |
> >
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > > 644 | "struct member likely outside of
> > struct_group_tagged()");
> > > > > > > > |
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > > include/linux/build_bug.h:77:50: note: expanded
> > > > > > > > from macro
> > 'static_assert'
> > > > > > > > 77 | #define static_assert(expr, ...)
> > > > > > > > __static_assert(expr,
> > ##__VA_ARGS__, #expr)
> > > > > > > > |
> > ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > > include/linux/build_bug.h:78:56: note: expanded
> > > > > > > > from macro
> > '__static_assert'
> > > > > > > > 78 | #define __static_assert(expr, msg, ...)
> > > > > > > > _Static_assert(expr,
> > msg)
> > > > > > > > | ^~~~
> > > > > > > > 7 warnings and 1 error generated.
> > > > > > > >
> > > > > > > >
> > > > > > > > vim +643 include/rdma/uverbs_ioctl.h
> > > > > > > >
> > > > > > > > 630
> > > > > > > > 631 struct uverbs_attr_bundle {
> > > > > > > > 632 /* New members MUST be added within the
> > struct_group() macro below. */
> > > > > > > > 633 struct_group_tagged(uverbs_attr_bundle_hdr, hdr,
> > > > > > > > 634 struct ib_udata driver_udata;
> > > > > > > > 635 struct ib_udata ucore;
> > > > > > > > 636 struct ib_uverbs_file *ufile;
> > > > > > > > 637 struct ib_ucontext *context;
> > > > > > > > 638 struct ib_uobject *uobject;
> > > > > > > > 639 DECLARE_BITMAP(attr_present,
> > UVERBS_API_ATTR_BKEY_LEN);
> > > > > > > > 640 );
> > > > > > > > 641 struct uverbs_attr attrs[];
> > > > > > > > 642 };
> > > > > > > > > 643 static_assert(offsetof(struct uverbs_attr_bundle, attrs) ==
> > sizeof(struct uverbs_attr_bundle_hdr),
> > > > > > > > 644 "struct member likely outside of
> > struct_group_tagged()");
> > > > > > > > 645
> > > > > > > >
> > > > > > >
> > > > >
> > > > > Thanks
> > > > > --
> > > > > Gustavo
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-08-14 16:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-01 11:35 [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct member likely outside of struct_group_tagged() kernel test robot
2024-08-01 12:47 ` Gustavo A. R. Silva
2024-08-01 19:08 ` Nathan Chancellor
2024-08-01 20:17 ` Gustavo A. R. Silva
2024-08-01 22:14 ` Nathan Chancellor
2024-08-01 22:35 ` Gustavo A. R. Silva
2024-08-02 22:19 ` Nathan Chancellor
2024-08-06 15:36 ` [gustavoars:testing/wfamnae-next20240729-cbc-2 11/18] include/rdma/uverbs_ioctl.h:643:15: error: static assertion failed due to requirement '__builtin_offsetof(struct uverbs_attr_bundle, attrs) == sizeof(struct uverbs_attr_bundle_hdr)': struct memb Brian Cain
[not found] ` <CH3PR02MB102474F1D633D03102B5F2855B8872@CH3PR02MB10247.namprd02.prod.outlook.com>
2024-08-14 16:30 ` Steven Walk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®