From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8963373318681144471==" MIME-Version: 1.0 From: Michael S. Tsirkin To: kbuild-all@lists.01.org Subject: Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE Date: Sun, 05 Apr 2020 05:00:58 -0400 Message-ID: <20200405045709-mutt-send-email-mst@kernel.org> In-Reply-To: <202004050718.B9NaFC2U%lkp@intel.com> List-Id: --===============8963373318681144471== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.g= it master > head: dff79597431045a775f2e5d4d9de31bfa0d32a34 > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: ref= ine vhost and vringh kconfig > config: arm-randconfig-a001-20200405 (attached as .config) > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 > reproduce: > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbi= n/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594 > # save the attached .config to linux build tree > GCC_VERSION=3D9.3.0 make.cross ARCH=3Darm = > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kbuild test robot > = > All error/warnings (new ones prefixed by >>): > = > In file included from include/linux/kernel.h:11, > from include/linux/list.h:9, > from include/linux/preempt.h:11, > from include/linux/spinlock.h:51, > from include/linux/seqlock.h:36, > from include/linux/time.h:6, > from include/linux/stat.h:19, > from include/linux/fcntl.h:5, > from include/linux/eventfd.h:12, > from drivers/vhost/vhost.c:13: > In function 'vhost_vring_set_addr', > inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1= 581:7, > inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10: > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_= 1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->= avail > VRING_AVAIL_ALIGN_SIZE > 350 | _compiletime_assert(condition, msg, __compiletime_assert_, __= LINE__) > | ^ > include/linux/compiler.h:331:4: note: in definition of macro '__compil= etime_assert' > 331 | prefix ## suffix(); \ > | ^~~~~~ > include/linux/compiler.h:350:2: note: in expansion of macro '_compilet= ime_assert' > 350 | _compiletime_assert(condition, msg, __compiletime_assert_, __= LINE__) > | ^~~~~~~~~~~~~~~~~~~ > include/linux/build_bug.h:39:37: note: in expansion of macro 'compilet= ime_assert' > 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond)= , msg) > | ^~~~~~~~~~~~~~~~~~ > include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG= _ON_MSG' > 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #conditio= n) > | ^~~~~~~~~~~~~~~~ > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_O= N' > 1533 | BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE); > | ^~~~~~~~~~~~ This compiler seems to be broken. We have: #define VRING_AVAIL_ALIGN_SIZE 2 and struct vring_avail __user *avail; and struct vring_avail { __virtio16 flags; __virtio16 idx; __virtio16 ring[]; }; = A compiler that decides to require alignment of > 2 bytes on a struct of packed u16's is likely broken in a bunch of other ways that just happen not to trigger a BUILD_BUG. The commit referenced just enables build on more platforms ... > vim +/__compiletime_assert_1533 +350 include/linux/compiler.h > = > 9a8ab1c39970a4 Daniel Santos 2013-02-21 336 = > 9a8ab1c39970a4 Daniel Santos 2013-02-21 337 #define _compiletime_assert= (condition, msg, prefix, suffix) \ > 9a8ab1c39970a4 Daniel Santos 2013-02-21 338 __compiletime_assert(condi= tion, msg, prefix, suffix) > 9a8ab1c39970a4 Daniel Santos 2013-02-21 339 = > 9a8ab1c39970a4 Daniel Santos 2013-02-21 340 /** > 9a8ab1c39970a4 Daniel Santos 2013-02-21 341 * compiletime_assert - bre= ak build and emit msg if condition is false > 9a8ab1c39970a4 Daniel Santos 2013-02-21 342 * @condition: a compile-ti= me constant condition to check > 9a8ab1c39970a4 Daniel Santos 2013-02-21 343 * @msg: a message to= emit if condition is false > 9a8ab1c39970a4 Daniel Santos 2013-02-21 344 * > 9a8ab1c39970a4 Daniel Santos 2013-02-21 345 * In tradition of POSIX as= sert, this macro will break the build if the > 9a8ab1c39970a4 Daniel Santos 2013-02-21 346 * supplied condition is *f= alse*, emitting the supplied error message if the > 9a8ab1c39970a4 Daniel Santos 2013-02-21 347 * compiler has support to = do so. > 9a8ab1c39970a4 Daniel Santos 2013-02-21 348 */ > 9a8ab1c39970a4 Daniel Santos 2013-02-21 349 #define compiletime_assert(= condition, msg) \ > 9a8ab1c39970a4 Daniel Santos 2013-02-21 @350 _compiletime_assert(condit= ion, msg, __compiletime_assert_, __LINE__) > 9a8ab1c39970a4 Daniel Santos 2013-02-21 351 = > = > :::::: The code at line 350 was first introduced by commit > :::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introd= uce compiletime_assert & BUILD_BUG_ON_MSG > = > :::::: TO: Daniel Santos > :::::: CC: Linus Torvalds > = > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============8963373318681144471==--