All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Elver <elver@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	fenghua.yu@intel.com, "H. Peter Anvin" <hpa@zytor.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Luck, Tony" <tony.luck@intel.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	yu-cheng.yu@intel.com, jgross@suse.com, sdeep@vmware.com,
	virtualization@lists.linux-foundation.org,
	kasan-dev <kasan-dev@googlegroups.com>,
	syzbot <syzbot+8db9e1ecde74e590a657@syzkaller.appspotmail.com>
Subject: Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers
Date: Thu, 6 Aug 2020 09:47:23 +0200	[thread overview]
Message-ID: <20200806074723.GA2364872@elver.google.com> (raw)
In-Reply-To: <CANpmjNNy3XKQqgrjGPPKKvXhAoF=mae7dk8hmoS4k4oNnnB=KA@mail.gmail.com>

On Wed, Aug 05, 2020 at 07:31PM +0200, Marco Elver wrote:
...
> Oh well, it seems that KCSAN on syzbot still crashes even with this
> "fix". It's harder to reproduce though, and I don't have a clear
> reproducer other than "fuzz the kernel" right now. I think the new IRQ
> state tracking code is still not compatible with KCSAN, even though we
> thought it would be. Most likely there are still ways to get recursion
> lockdep->KCSAN. An alternative would be to deal with the recursion
> like we did before, instead of trying to squash all of it. I'll try to
> investigate -- Peter, if you have ideas, help is appreciated.

Testing my hypothesis that raw then nested non-raw
local_irq_save/restore() breaks IRQ state tracking -- see the reproducer
below. This is at least 1 case I can think of that we're bound to hit.

Thanks,
-- Marco

------ >8 ------

diff --git a/init/main.c b/init/main.c
index 15bd0efff3df..0873319dcff4 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1041,6 +1041,22 @@ asmlinkage __visible void __init start_kernel(void)
 	sfi_init_late();
 	kcsan_init();
 
+	/* DEBUG CODE */
+	lockdep_assert_irqs_enabled(); /* Pass. */
+	{
+		unsigned long flags1;
+		raw_local_irq_save(flags1);
+		{
+			unsigned long flags2;
+			lockdep_assert_irqs_enabled(); /* Pass - expectedly blind. */
+			local_irq_save(flags2);
+			lockdep_assert_irqs_disabled(); /* Pass. */
+			local_irq_restore(flags2);
+		}
+		raw_local_irq_restore(flags1);
+	}
+	lockdep_assert_irqs_enabled(); /* FAIL! */
+
 	/* Do the rest non-__init'ed, we're now alive */
 	arch_call_rest_init();
 

  reply	other threads:[~2020-08-06 11:05 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05  7:19 upstream test error: WARNING in __local_bh_enable_ip syzbot
2020-08-05 13:26 ` [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers Marco Elver
2020-08-05 13:42   ` peterz
2020-08-05 13:42     ` peterz
2020-08-05 13:59     ` Marco Elver
2020-08-05 14:12       ` peterz
2020-08-05 14:12         ` peterz
2020-08-05 14:17         ` Jürgen Groß
2020-08-05 14:17           ` Jürgen Groß
2020-08-05 14:17         ` peterz
2020-08-05 14:17           ` peterz
2020-08-05 14:36           ` Marco Elver
2020-08-05 17:31             ` Marco Elver
2020-08-06  7:47               ` Marco Elver [this message]
2020-08-06 11:32                 ` peterz
2020-08-06 11:32                   ` peterz
2020-08-06 13:17                   ` Marco Elver
2020-08-06 16:06                     ` Marco Elver
2020-08-07  9:01                       ` Marco Elver
2020-08-07  9:24                         ` Jürgen Groß
2020-08-07  9:24                           ` Jürgen Groß
2020-08-07  9:50                           ` Marco Elver
2020-08-07 10:35                             ` Jürgen Groß
2020-08-07 10:35                               ` Jürgen Groß
2020-08-07 11:38                               ` Marco Elver
2020-08-07 12:04                                 ` Jürgen Groß
2020-08-07 12:04                                   ` Jürgen Groß
2020-08-07 12:08                                   ` Marco Elver
2020-08-07 15:19                                     ` Marco Elver
2020-08-11  7:00                                       ` Marco Elver
2020-08-11  7:04                                         ` Jürgen Groß
2020-08-11  7:04                                           ` Jürgen Groß
2020-08-11  7:41                                       ` Peter Zijlstra
2020-08-11  7:41                                         ` Peter Zijlstra
2020-08-11  7:57                                         ` Jürgen Groß
2020-08-11  7:57                                           ` Jürgen Groß
2020-08-11  8:12                                           ` Peter Zijlstra
2020-08-11  8:12                                             ` Peter Zijlstra
2020-08-11  8:18                                             ` Jürgen Groß
2020-08-11  8:18                                               ` Jürgen Groß
2020-08-11  8:38                                             ` Jürgen Groß
2020-08-11  8:38                                               ` Jürgen Groß
2020-08-11  9:20                                               ` peterz
2020-08-11  9:20                                                 ` peterz
2020-08-11  9:46                                                 ` peterz
2020-08-11  9:46                                                   ` peterz
2020-08-11 20:17                                                   ` peterz
2020-08-11 20:17                                                     ` peterz
2020-08-12  8:06                                                     ` Marco Elver
2020-08-12  8:18                                                       ` peterz
2020-08-12  8:18                                                         ` peterz
2020-08-12  8:57                                                         ` peterz
2020-08-12  8:57                                                           ` peterz
2020-08-06 21:02   ` kernel test robot
2020-08-06 21:02     ` kernel test robot

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=20200806074723.GA2364872@elver.google.com \
    --to=elver@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sdeep@vmware.com \
    --cc=syzbot+8db9e1ecde74e590a657@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=x86@kernel.org \
    --cc=yu-cheng.yu@intel.com \
    /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.