linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Marco Elver <elver@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Will Deacon <will@kernel.org>,
	"Jose E. Marchesi" <jemarch@gnu.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-toolchains@vger.kernel.org
Subject: Re: Linux Plumbers Conf 2021
Date: Wed, 19 May 2021 12:56:54 +0100	[thread overview]
Message-ID: <20210519115654.GC2797@C02TD0UTHF1T.local> (raw)
In-Reply-To: <CANpmjNN-QKq3G3oeNtmM5DaFBh=BW1S99k=xEZ2DVgQpGFQ=xw@mail.gmail.com>

On Wed, May 19, 2021 at 12:19:38PM +0200, Marco Elver wrote:
> On Wed, 19 May 2021 at 11:32, Mark Rutland <mark.rutland@arm.com> wrote:
> >
> > On Tue, May 18, 2021 at 10:03:06PM +0200, Peter Zijlstra wrote:
> > > On Tue, May 18, 2021 at 09:57:26AM -0700, Nick Desaulniers wrote:
> > > > On Tue, May 18, 2021 at 6:23 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > >
> > > > >  - validates noinstr annotation; *HOWEVER* we rely on objtool to NOP
> > > > >    all __sanitizer_cov_* calls in .noinstr/.entry text sections because
> > > > >    __no_sanitize_cov is 'broken' in all known compilers.
> > > >
> > > > ^ Do you have more information on this?
> > >
> > > Random link in the middle of a relevant thread:
> > >
> > >   https://lkml.kernel.org/r/CANpmjNPNa2f=kAF6c199oYVJ0iSyirQRGxeOBLxa9PmakSXRbA@mail.gmail.com
> > >
> > > Notable quote:
> > >
> > > "It's everywhere. We cannot mark noinstr functions to not be
> > > instrumented by KCOV/-fsanitize-coverage, because no compiler provides
> > > an attribute to do so. GCC doesn't have
> > > __attribute__((no_sanitize_coverage)) and Clang doesn't have
> > > __attribute__((no_sanitize("coverage")), and therefore we can't have
> > > __no_sanitize_coverage."
> 
> Hmm, we really need to add those. I looked at it briefly for Clang,
> and I think it turned out more complicated than I thought and then
> after seeing objtool "solved it", more pressing things came up. :-/
> 
> > Yuck; I wasn't aware of that.
> >
> > This means that arm64's entry code is unsound (along with some other
> > parts) if kcov is enabled.
> 
> We still have "KCOV_INSTRUMENT_file.o := n" (or "KCOV_INSTRUMENT := n"
> for everything in a Makefile) for now. Not great, but for entry code
> it might be good enough.

FWIW, I've prepared some patches to do just that; it requires moving
some functions around so that we don't unnecessarily prevent
instrumentation, but otherwise that does seem to be good enough for what
we have today.

I'll send that out shortly as part of some entry code rework.

> > That *really* needs an attribute, and going forward we shouldn't accept
> > new compiler instrumentation that we can't opt-out of like this.
> 
> Strangely enough, in Clang, there's -fsanitize-coverage-blocklist, but
> that's pretty useless for the kernel. Maintaining a list of functions
> doesn't scale, and we just need an attribute. I'll ping a few of the
> people who know Clang's fsanitize-coverage a bit better.

Great, thanks!

I think that kernel-side we should have a policy going forward that for
new instrumentation it must be possible to opt-out like this (and when
support is added, `noinstr` gets upsated to opt-out). Correspondingly on
the compiler-side, it'd be good if that was seen as a general
requirement for new instrumentation.

Thanks,
Mark.

  reply	other threads:[~2021-05-19 11:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKwvOdm-Vb2BGRCmtYCh5JcGkM+XedzSMdNr8kQLbY4y_85EvA@mail.gmail.com>
     [not found] ` <20210518121447.GB7914@willie-the-truck>
     [not found]   ` <20210518124311.r4fwv6lfz3erkqnb@treble>
2021-05-18 12:48     ` Linux Plumbers Conf 2021 Josh Poimboeuf
2021-05-18 13:21       ` Peter Zijlstra
2021-05-18 16:57         ` Nick Desaulniers
2021-05-18 20:03           ` Peter Zijlstra
2021-05-18 20:15             ` Nick Desaulniers
2021-05-19  9:32             ` Mark Rutland
2021-05-19 10:19               ` Marco Elver
2021-05-19 11:56                 ` Mark Rutland [this message]
2021-05-19 14:04                   ` Marco Elver
2021-05-19 15:02                     ` Martin Liška
2021-05-19 15:05                       ` Marco Elver
2021-05-20  8:34                         ` Martin Liška
2021-06-16 23:01   ` Nick Desaulniers
2021-06-24 20:35     ` Nick Desaulniers
2021-06-24 20:37       ` Nick Desaulniers
2021-06-28 17:59         ` Will Deacon

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=20210519115654.GC2797@C02TD0UTHF1T.local \
    --to=mark.rutland@arm.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=elver@google.com \
    --cc=jemarch@gnu.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).