From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Dave Jones <davej@codemonkey.org.uk>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: UBSAN: run-time undefined behavior sanity checker
Date: Mon, 1 Feb 2016 19:08:46 +0300 [thread overview]
Message-ID: <56AF830E.1050707@virtuozzo.com> (raw)
In-Reply-To: <20160126165322.GA24364@codemonkey.org.uk>
On 01/26/2016 07:53 PM, Dave Jones wrote:
> <off-list because of huge config>
>
> On Mon, Jan 25, 2016 at 05:03:48PM +0300, Andrey Ryabinin wrote:
>
> > > So disabling that option fixed booting on one machine, but every other I've
> > > tried it on hangs the same way, really early. Any thoughts on how to chase this down ?
> > >
> > Try to disable instrumentation for early code, like in the patch bellow.
> >
> >
> > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> > index b1b78ff..d39a954 100644
> > --- a/arch/x86/kernel/Makefile
> > +++ b/arch/x86/kernel/Makefile
> > @@ -20,6 +20,8 @@ KASAN_SANITIZE_head$(BITS).o := n
> > KASAN_SANITIZE_dumpstack.o := n
> > KASAN_SANITIZE_dumpstack_$(BITS).o := n
> >
> > +UBSAN_SANITIZE := n
> > +
> > CFLAGS_irq.o := -I$(src)/../include/asm/trace
> >
> > obj-y := process_$(BITS).o signal.o
>
> This didn't help.
>
> > Also send me you .config please. Perhaps I will be able to reproduce this.
>
> below. Though I diffed a similar config from a machine where UBSAN works,
> and the only differences seemed to be mostly benign stuff or hw specific drivers.
>
So after I enabled UBSAN_ALIGNMENT in your config, the kernel didn't boot.
That is because unaligned access happens before lockdep_init() so ubsan callback takes the
spinlock before locked_init() which is not allowed.
As far as I understood most of your machines doesn't boot even without UBSAN_ALIGNMENT.
So I'm guessing it might be similar problem.
Could you try it without CONFIG_DEBUG_LOCKDEP?
Or alternatively with patch like this:
diff --git a/lib/ubsan.c b/lib/ubsan.c
index 8799ae5..220e9d9 100644
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -146,13 +146,13 @@ static bool location_is_valid(struct source_location *loc)
return loc->file_name != NULL;
}
-static DEFINE_SPINLOCK(report_lock);
+//static DEFINE_SPINLOCK(report_lock);
static void ubsan_prologue(struct source_location *location,
unsigned long *flags)
{
current->in_ubsan++;
- spin_lock_irqsave(&report_lock, *flags);
+// spin_lock_irqsave(&report_lock, *flags);
pr_err("========================================"
"========================================\n");
@@ -164,7 +164,7 @@ static void ubsan_epilogue(unsigned long *flags)
dump_stack();
pr_err("========================================"
"========================================\n");
- spin_unlock_irqrestore(&report_lock, *flags);
+// spin_unlock_irqrestore(&report_lock, *flags);
current->in_ubsan--;
}
next prev parent reply other threads:[~2016-02-01 16:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160121205717.AF61F661293@gitolite.kernel.org>
2016-01-22 5:15 ` Dave Jones
2016-01-22 16:43 ` Andrey Ryabinin
2016-01-22 17:00 ` Dave Jones
2016-01-25 14:03 ` Andrey Ryabinin
[not found] ` <20160126165322.GA24364@codemonkey.org.uk>
2016-02-01 16:08 ` Andrey Ryabinin [this message]
2016-02-01 22:18 ` Dave Jones
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=56AF830E.1050707@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=davej@codemonkey.org.uk \
--cc=linux-kernel@vger.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
Powered by JetHome