lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 13 Sep 2021 10:00:02 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     kernel test robot <lkp@...el.com>,
        Nathan Chancellor <nathan@...nel.org>, llvm@...ts.linux.dev,
        kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com
Subject: Re: drivers/infiniband/hw/qib/qib_sysfs.c:413:1: error: static_assert
 expression is not an integral constant expression

On Mon, Sep 13, 2021 at 9:53 AM Jason Gunthorpe <jgg@...dia.com> wrote:
>
> On Sat, Sep 11, 2021 at 08:17:08PM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   926de8c4326c14fcf35f1de142019043597a4fac
> > commit: 84f969e1c48ed3825986e91a0786e363d57f69d1 IB/qib: Fix null pointer subtraction compiler warning
> > date:   3 days ago
> > config: x86_64-randconfig-a014-20210911 (attached as .config)
> > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=84f969e1c48ed3825986e91a0786e363d57f69d1
> >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >         git fetch --no-tags linus master
> >         git checkout 84f969e1c48ed3825986e91a0786e363d57f69d1
> >         # save the attached .config to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=x86_64 SHELL=/bin/bash
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@...el.com>
> >
> > All errors (new ones prefixed by >>):
> >
> > >> drivers/infiniband/hw/qib/qib_sysfs.c:413:1: error: static_assert expression is not an integral constant expression
> >    QIB_DIAGC_ATTR(rc_resends);
> >    ^~~~~~~~~~~~~~~~~~~~~~~~~~
> >    drivers/infiniband/hw/qib/qib_sysfs.c:406:16: note: expanded from macro 'QIB_DIAGC_ATTR'
> >            static_assert(&((struct qib_ibport *)0)->rvp.n_##N != (u64 *)NULL);    \
> >            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> >    #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> >                                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> >    #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >                                                           ^~~~
> >    drivers/infiniband/hw/qib/qib_sysfs.c:413:1: note: cannot access field of null pointer
> >    drivers/infiniband/hw/qib/qib_sysfs.c:406:43: note: expanded from macro 'QIB_DIAGC_ATTR'
> >            static_assert(&((struct qib_ibport *)0)->rvp.n_##N != (u64 *)NULL);    \
> >                                                     ^
> >    drivers/infiniband/hw/qib/qib_sysfs.c:414:1: error: static_assert expression is not an integral constant expression
> >    QIB_DIAGC_ATTR(seq_naks);
> >    ^~~~~~~~~~~~~~~~~~~~~~~~
>
> Nick/Nathan
>
> Clang is being a real PITA here - do you know of a solution?

Hi Jason,
Thanks for wrestling with this.  We filed a quick thread last week to
track this:
https://github.com/ClangBuiltLinux/linux/issues/1452
With conferences this and next week, and -Werror fallout, there's a
lot of fire right now and not a lot of time to triage.

I guess I'm curious, what is the intent of what this code is trying to
do, and can this be replaced with BUILD_BUG_ON?

>
> This macro would like to know that the passed in member name has a u64
> type, all the things I've come up with fail on clang - but many work
> fine on gcc. Frankly I think this case is a clang bug myself..

Perhaps, though this assertion looks a bit like offsetof() to me. I
wonder if that can help here?
-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ