From: Ingo Molnar <mingo@kernel.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>,
Andi Kleen <ak@linux.intel.com>,
Dmitry Vyukov <dvyukov@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Andrey Konovalov <andreyknvl@google.com>,
Kostya Serebryany <kcc@google.com>,
Alexander Potapenko <glider@google.com>,
kasan-dev <kasan-dev@googlegroups.com>,
Borislav Petkov <bp@alien8.de>,
Denys Vlasenko <dvlasenk@redhat.com>,
Sasha Levin <sasha.levin@oracle.com>,
Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] x86/process: Silence KASAN warnings in get_wchan()
Date: Wed, 7 Oct 2015 09:22:37 +0200 [thread overview]
Message-ID: <20151007072237.GE7837@gmail.com> (raw)
In-Reply-To: <CALCETrUxUOhuqQr5wsrea1L2sTi9-vRXco2AswkReaLwpa3cMg@mail.gmail.com>
* Andy Lutomirski <luto@amacapital.net> wrote:
> On Tue, Oct 6, 2015 at 12:26 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> >
> >> On 10/05/2015 07:39 PM, Andi Kleen wrote:
> >> >> But, I think I have the solution.
> >> >> We could have some blacklist - list of function names which we should be ignored.
> >> >> In kasan_report() we could resolve return address to function name and compare it with name in list.
> >> >> If name in list -> ignore report.
> >> >
> >> > I think annotating statements is cleaner than functions, even if it
> >> > is more code. Much better documentation
> >> >
> >>
> >> I agree with that, that's why I suggested to add READ_ONCE_NOCHECK():
> >> READ_ONCE_NOCHECK()
> >> {
> >> kasan_disable_current();
> >> READ_ONCE();
> >> kasan_enable_current();
> >> }
> >>
> >> Anywone objects?
> >
> > Sounds good to me! As long as it's hidden from plain .c files I'm a happy camper.
> >
> > This should probably also be faster for KASAN than triggering a warning and having
> > to parse a blacklist, right?
> >
> >> > If disabling with an attribute doesn't work, you could put it into a special
> >> > section with __attribute__((section ...)) and check the start/end symbol
> >> > before reporting. That's how kprobes solves similar issues. It also has the
> >> > advantage that it stops inlining.
> >>
> >> Yes, it might be better. Although, because of broken -fconserve-stack, this may
> >> not work in some cases - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
> >> Function splitter may split original function into two parts and it always puts
> >> one split part in default .text section.
> >
> > We do a _ton_ of such section tricks in the kernel (all of exception handling is
> > based on that) - if that's broken by -fconserve-stack then the kernel is broken
> > much more widely.
> >
> > So unless KASAN wants to do something special here you can rely on sections just
> > fine.
>
> Kprobes is moving away from a section approach for some reason (not
> sure why), but the kprobe approach should work, too.
Do you mean NOKPROBE_SYMBOL() vs __kprobes?
So one concern is with functions being in multiple blacklists, so yeah, the
NOKPROBE_SYMBOL() approach might be more robust than __kprobes.
But note that NOKPROBE_SYMBOL() itself is still section based:
#define __NOKPROBE_SYMBOL(fname) \
static unsigned long __used \
__attribute__((section("_kprobe_blacklist"))) \
_kbl_addr_##fname = (unsigned long)fname;
Thanks,
Ingo
next prev parent reply other threads:[~2015-10-07 7:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 10:28 [PATCH] x86/process: Silence KASAN warnings in get_wchan() Andrey Ryabinin
2015-10-05 10:38 ` Dmitry Vyukov
2015-10-05 11:18 ` Borislav Petkov
2015-10-05 11:23 ` Ingo Molnar
2015-10-05 11:39 ` Dmitry Vyukov
2015-10-05 11:46 ` Andrey Ryabinin
2015-10-05 13:15 ` Borislav Petkov
2015-10-05 18:42 ` Andy Lutomirski
2015-10-05 16:39 ` Andi Kleen
2015-10-05 16:59 ` Andrey Ryabinin
2015-10-05 18:58 ` Andi Kleen
2015-10-06 7:26 ` Ingo Molnar
2015-10-06 7:38 ` Andrey Ryabinin
2015-10-06 18:11 ` Andy Lutomirski
2015-10-07 7:22 ` Ingo Molnar [this message]
2015-10-07 8:54 ` Andrey Ryabinin
2015-10-07 9:11 ` Andrey Ryabinin
2015-10-07 16:27 ` Andi Kleen
2015-10-07 18:48 ` Andrey Ryabinin
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=20151007072237.GE7837@gmail.com \
--to=mingo@kernel.org \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@google.com \
--cc=aryabinin@virtuozzo.com \
--cc=bp@alien8.de \
--cc=dvlasenk@redhat.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=kasan-dev@googlegroups.com \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=sasha.levin@oracle.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=wmglo@dent.med.uni-muenchen.de \
--cc=x86@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).