All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Alexander Potapenko <glider@google.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	Kees Cook <keescook@google.com>
Subject: Re: linux-next: build warning after merge of the akpm tree
Date: Mon, 7 Dec 2020 13:38:01 +0100	[thread overview]
Message-ID: <CACT4Y+bPPSQ1OgZ1NmUckOO2=07RE3C=deW6BpF0cOR9wnJsoA@mail.gmail.com> (raw)
In-Reply-To: <CACT4Y+bYVC=r+bPF7MziOZpJCYqrUj7CFt47Z5PSWjohZLYm+w@mail.gmail.com>

On Mon, Dec 7, 2020 at 1:08 PM Dmitry Vyukov <dvyukov@google.com> wrote:
> > > Hi all,
> > >
> > > After merging the akpm tree, today's linux-next build (powerpc
> > > allyesconfig) produced warnings like this:
> > >
> > > kernel/kcov.c:296:14: warning: conflicting types for built-in function '__sanitizer_cov_trace_switch'; expected 'void(long unsigned int,  void *)' [-Wbuiltin-declaration-mismatch]
> > >   296 | void notrace __sanitizer_cov_trace_switch(u64 val, u64 *cases)
> > >       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Odd.  clang wants that signature, according to
> > https://clang.llvm.org/docs/SanitizerCoverage.html.  But gcc seems to
> > want a different signature.  Beats me - best I can do is to cc various
> > likely culprits ;)
> >
> > Which gcc version?  Did you recently update gcc?
> >
> > > ld: warning: orphan section `.data..Lubsan_data177' from `arch/powerpc/oprofile/op_model_pa6t.o' being placed in section `.data..Lubsan_data177'
> > >
> > > (lots of these latter ones)
> > >
> > > I don't know what produced these, but it is in the akpm-current or
> > > akpm trees.
>
> I can reproduce this in x86_64 build as well but only if I enable
> UBSAN as well. There were some recent UBSAN changes by Kees, so maybe
> that's what affected the warning.
> Though, the warning itself looks legit and unrelated to UBSAN. In
> fact, if the compiler expects long and we accept u64, it may be broken
> on 32-bit arches...

No, I think it works, the argument should be uint64.

I think both gcc and clang signatures are correct and both want
uint64_t. The question is just how uint64_t is defined :) The old
printf joke that one can't write portable format specifier for
uint64_t.

What I know so far:
clang 11 does not produce this warning even with obviously wrong
signatures (e.g. short).
I wasn't able to trigger it with gcc on 32-bits at all. KCOV is not
supported on i386 and on arm I got no warnings even with obviously
wrong signatures (e.g. short).
Using "(unsigned long val, void *cases)" fixes the warning on x86_64.

I am still puzzled why gcc considers this as a builtin because we
don't enable -fsanitizer-coverage on this file. I am also puzzled how
UBSAN affects things.

We could change the signature to long, but it feels wrong/dangerous
because the variable should really be 64-bits (long is broken on
32-bits).
Or we could introduce a typedef that is long on 64-bits and 'long
long' on 32-bits.

  reply	other threads:[~2020-12-07 12:39 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 10:00 linux-next: build warning after merge of the akpm tree Stephen Rothwell
2020-12-05  5:19 ` Andrew Morton
2020-12-05  9:37   ` Stephen Rothwell
2020-12-07 12:08   ` Dmitry Vyukov
2020-12-07 12:38     ` Dmitry Vyukov [this message]
2020-12-07 12:52       ` Marco Elver
2020-12-09 10:06         ` Dmitry Vyukov
2020-12-08 12:01 ` Stephen Rothwell
2020-12-08 12:01   ` Stephen Rothwell
2020-12-09  4:44   ` Michael Ellerman
2020-12-09  4:44     ` Michael Ellerman
2020-12-09  7:07     ` Stephen Rothwell
2020-12-09  7:07       ` Stephen Rothwell
2020-12-10  0:19       ` Michael Ellerman
2020-12-10  0:19         ` Michael Ellerman
2020-12-10 21:17         ` Stephen Rothwell
2020-12-10 21:17           ` Stephen Rothwell
2020-12-09 10:33   ` Stephen Rothwell
2020-12-09 10:33     ` Stephen Rothwell
2020-12-09 18:56   ` Kees Cook
2020-12-09 18:56     ` Kees Cook
  -- strict thread matches above, loose matches on Subject: below --
2021-01-28  8:46 Stephen Rothwell
2021-02-01  7:14 ` Vijayanand Jitta
2020-02-28  4:35 Stephen Rothwell
2020-02-28  5:23 ` Arjun Roy
2020-01-06  6:11 Stephen Rothwell
2020-01-06  6:07 Stephen Rothwell
2020-01-07 23:11 ` Andrew Morton
2020-01-08 14:52   ` Steven Price
2018-11-30  5:40 Stephen Rothwell
2018-11-30 14:52 ` Dave Rodgman
2017-08-01  6:02 Stephen Rothwell
2017-08-01  6:15 ` Huang, Ying
2017-08-01 21:15   ` Arnd Bergmann
2017-06-26  6:30 Stephen Rothwell
2017-06-26 23:57 ` Wei Yang
2014-05-19  8:13 Stephen Rothwell
2014-05-19 15:13 ` Davidlohr Bueso
2014-05-19 19:48   ` Andrew Morton
2014-05-19 20:56     ` Davidlohr Bueso
2014-05-19 21:17       ` Andrew Morton
2014-05-19 21:36   ` Stephen Rothwell
2014-05-19 22:38     ` Davidlohr Bueso
2013-04-18  8:03 Stephen Rothwell
2013-04-10  8:33 Stephen Rothwell
2013-04-10  8:18 Stephen Rothwell
2013-02-20  6:34 Stephen Rothwell
2013-02-20 14:37 ` Peter Jones
2013-01-23  6:33 Stephen Rothwell
2013-01-23  6:43 ` Tang Chen
2012-11-09  3:43 Stephen Rothwell
2012-11-09 10:00 ` Grant Likely
2012-10-25  3:35 Stephen Rothwell
2012-04-27  5:44 Stephen Rothwell
2012-04-27  6:22 ` Cyrill Gorcunov
2012-04-27  6:28   ` Stephen Rothwell
2012-04-27  6:40     ` Cyrill Gorcunov
2011-08-10  2:13 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACT4Y+bPPSQ1OgZ1NmUckOO2=07RE3C=deW6BpF0cOR9wnJsoA@mail.gmail.com' \
    --to=dvyukov@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=keescook@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.