virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: peterz@infradead.org
To: Marco Elver <elver@google.com>
Cc: "Jürgen Groß" <jgross@suse.com>,
	fenghua.yu@intel.com, yu-cheng.yu@intel.com, "Luck,
	Tony" <tony.luck@intel.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>,
	kasan-dev <kasan-dev@googlegroups.com>,
	virtualization@lists.linux-foundation.org,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	syzbot <syzbot+8db9e1ecde74e590a657@syzkaller.appspotmail.com>,
	"Wei Liu" <wei.liu@kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>
Subject: Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers
Date: Wed, 12 Aug 2020 10:18:32 +0200	[thread overview]
Message-ID: <20200812081832.GK2674@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200812080650.GA3894595@elver.google.com>

On Wed, Aug 12, 2020 at 10:06:50AM +0200, Marco Elver wrote:
> On Tue, Aug 11, 2020 at 10:17PM +0200, peterz@infradead.org wrote:
> > On Tue, Aug 11, 2020 at 11:46:51AM +0200, peterz@infradead.org wrote:
> > 
> > > So let me once again see if I can't find a better solution for this all.
> > > Clearly it needs one :/
> > 
> > So the below boots without triggering the debug code from Marco -- it
> > should allow nesting local_irq_save/restore under raw_local_irq_*().
> > 
> > I tried unconditional counting, but there's some _reallly_ wonky /
> > asymmetric code that wrecks that and I've not been able to come up with
> > anything useful.
> > 
> > This one starts counting when local_irq_save() finds it didn't disable
> > IRQs while lockdep though it did. At that point, local_irq_restore()
> > will decrement and enable things again when it reaches 0.
> > 
> > This assumes local_irq_save()/local_irq_restore() are nested sane, which
> > is mostly true.
> > 
> > This leaves #PF, which I fixed in these other patches, but I realized it
> > needs fixing for all architectures :-( No bright ideas there yet.
> > 
> > ---
> >  arch/x86/entry/thunk_32.S       |  5 ----
> >  include/linux/irqflags.h        | 45 +++++++++++++++++++-------------
> >  init/main.c                     | 16 ++++++++++++
> >  kernel/locking/lockdep.c        | 58 +++++++++++++++++++++++++++++++++++++++++
> >  kernel/trace/trace_preemptirq.c | 33 +++++++++++++++++++++++
> >  5 files changed, 134 insertions(+), 23 deletions(-)
> 
> Testing this again with syzkaller produced some new reports:
> 
> 	BUG: stack guard page was hit in error_entry
> 	BUG: stack guard page was hit in exc_int3
> 	PANIC: double fault in error_entry
> 	PANIC: double fault in exc_int3
> 
> Most of them have corrupted reports, but this one might be useful:
> 
> 	BUG: stack guard page was hit at 000000001fab0982 (stack is 00000000063f33dc..00000000bf04b0d8)
> 	BUG: stack guard page was hit at 00000000ca97ac69 (stack is 00000000af3e6c84..000000001597e1bf)
> 	kernel stack overflow (double-fault): 0000 [#1] PREEMPT SMP
> 	CPU: 1 PID: 4709 Comm: kworker/1:1H Not tainted 5.8.0+ #5
> 	Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1 04/01/2014
> 	Workqueue: events_highpri snd_vmidi_output_work
> 	RIP: 0010:exc_int3+0x5/0xf0 arch/x86/kernel/traps.c:636
> 	Code: c9 85 4d 89 e8 31 c0 e8 a9 7d 68 fd e9 90 fe ff ff e8 0f 35 00 00 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 55 53 48 89 fb <e8> 76 0e 00 00 85 c0 74 03 5b 5d c3 f6 83 88 00 00 00 03 74 7e 48
> 	RSP: 0018:ffffc90008114000 EFLAGS: 00010083
> 	RAX: 0000000084e00e17 RBX: ffffc90008114018 RCX: ffffffff84e00e17
> 	RDX: 0000000000000000 RSI: ffffffff84e00a39 RDI: ffffc90008114018
> 	RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
> 	R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> 	R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
> 	FS:  0000000000000000(0000) GS:ffff88807dc80000(0000) knlGS:0000000000000000
> 	CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> 	CR2: ffffc90008113ff8 CR3: 000000002dae4006 CR4: 0000000000770ee0
> 	DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> 	DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> 	PKRU: 00000000
> 	Call Trace:
> 	 asm_exc_int3+0x31/0x40 arch/x86/include/asm/idtentry.h:537
> 	RIP: 0010:arch_static_branch include/trace/events/preemptirq.h:40 [inline]
> 	RIP: 0010:static_key_false include/linux/jump_label.h:200 [inline]
> 	RIP: 0010:trace_irq_enable_rcuidle+0xd/0x120 include/trace/events/preemptirq.h:40
> 	Code: 24 08 48 89 df e8 43 8d ef ff 48 89 df 5b e9 4a 2e 99 03 66 2e 0f 1f 84 00 00 00 00 00 55 41 56 53 48 89 fb e8 84 1a fd ff cc <1f> 44 00 00 5b 41 5e 5d c3 65 8b 05 ab 74 c3 7e 89 c0 31 f6 48 0f
> 	RSP: 0018:ffffc900081140f8 EFLAGS: 00000093
> 	RAX: ffffffff813d9e8c RBX: ffffffff81314dd3 RCX: ffff888076ce6000
> 	RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81314dd3
> 	RBP: 0000000000000000 R08: ffffffff813da3d4 R09: 0000000000000001
> 	R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> 	R13: 0000000000000082 R14: 0000000000000000 R15: ffff888076ce6000
> 	 trace_hardirqs_restore+0x59/0x80 kernel/trace/trace_preemptirq.c:106
> 	 rcu_irq_enter_irqson+0x43/0x70 kernel/rcu/tree.c:1074
> 	 trace_irq_enable_rcuidle+0x87/0x120 include/trace/events/preemptirq.h:40
> 	 trace_hardirqs_restore+0x59/0x80 kernel/trace/trace_preemptirq.c:106
> 	 rcu_irq_enter_irqson+0x43/0x70 kernel/rcu/tree.c:1074
> 	 trace_irq_enable_rcuidle+0x87/0x120 include/trace/events/preemptirq.h:40
> 	 trace_hardirqs_restore+0x59/0x80 kernel/trace/trace_preemptirq.c:106
> 	 rcu_irq_enter_irqson+0x43/0x70 kernel/rcu/tree.c:1074
> 	 trace_irq_enable_rcuidle+0x87/0x120 include/trace/events/preemptirq.h:40
> 	 trace_hardirqs_restore+0x59/0x80 kernel/trace/trace_preemptirq.c:106
> 	 rcu_irq_enter_irqson+0x43/0x70 kernel/rcu/tree.c:1074
> 
> 	<... repeated many many times ...>
> 
> 	 trace_irq_enable_rcuidle+0x87/0x120 include/trace/events/preemptirq.h:40
> 	 trace_hardirqs_restore+0x59/0x80 kernel/trace/trace_preemptirq.c:106
> 	 rcu_irq_enter_irqson+0x43/0x70 kernel/rcu/tree.c:1074
> 	Lost 500 message(s)!
> 	BUG: stack guard page was hit at 00000000cab483ba (stack is 00000000b1442365..00000000c26f9ad3)
> 	BUG: stack guard page was hit at 00000000318ff8d8 (stack is 00000000fd87d656..0000000058100136)
> 	---[ end trace 4157e0bb4a65941a ]---

Wheee... recursion! Let me try and see if I can make something of that.

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2020-08-12  8:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0000000000007d3b2d05ac1c303e@google.com>
     [not found] ` <20200805132629.GA87338@elver.google.com>
2020-08-05 13:42   ` [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers peterz
     [not found]     ` <20200805135940.GA156343@elver.google.com>
2020-08-05 14:12       ` peterz
2020-08-05 14:17         ` Jürgen Groß
2020-08-05 14:17         ` peterz
     [not found]           ` <CANpmjNN6FWZ+MsAn3Pj+WEez97diHzqF8hjONtHG15C2gSpSgw@mail.gmail.com>
     [not found]             ` <CANpmjNNy3XKQqgrjGPPKKvXhAoF=mae7dk8hmoS4k4oNnnB=KA@mail.gmail.com>
     [not found]               ` <20200806074723.GA2364872@elver.google.com>
2020-08-06 11:32                 ` peterz
     [not found]                   ` <20200806131702.GA3029162@elver.google.com>
     [not found]                     ` <CANpmjNNqt8YrCad4WqgCoXvH47pRXtSLpnTKhD8W8+UpoYJ+jQ@mail.gmail.com>
     [not found]                       ` <CANpmjNO860SHpNve+vaoAOgarU1SWy8o--tUWCqNhn82OLCiew@mail.gmail.com>
2020-08-07  9:24                         ` Jürgen Groß
     [not found]                           ` <20200807095032.GA3528289@elver.google.com>
2020-08-07 10:35                             ` Jürgen Groß
     [not found]                               ` <20200807113838.GA3547125@elver.google.com>
2020-08-07 12:04                                 ` Jürgen Groß
     [not found]                                   ` <CANpmjNPau_DEYadey9OL+iFZKEaUTqnFnyFs1dU12o00mg7ofA@mail.gmail.com>
     [not found]                                     ` <20200807151903.GA1263469@elver.google.com>
     [not found]                                       ` <CANpmjNM1jASqCFYZpteVrZCa2V2D_DbXaqvoCV_Ac2boYfDXnQ@mail.gmail.com>
2020-08-11  7:04                                         ` Jürgen Groß
2020-08-11  7:41                                       ` Peter Zijlstra
2020-08-11  7:57                                         ` Jürgen Groß
2020-08-11  8:12                                           ` Peter Zijlstra
2020-08-11  8:18                                             ` Jürgen Groß
2020-08-11  8:38                                             ` Jürgen Groß
2020-08-11  9:20                                               ` peterz
2020-08-11  9:46                                                 ` peterz
2020-08-11 20:17                                                   ` peterz
     [not found]                                                     ` <20200812080650.GA3894595@elver.google.com>
2020-08-12  8:18                                                       ` peterz [this message]
2020-08-12  8:57                                                         ` peterz

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=20200812081832.GK2674@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=elver@google.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=paulmck@kernel.org \
    --cc=rostedt@goodmis.org \
    --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=wei.liu@kernel.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 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).