From: Thomas Gleixner <tglx@linutronix.de>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
linux-mm@kvack.org, Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [BUG -tip] kmemleak and stacktrace cause page faul
Date: Wed, 23 Oct 2019 15:38:40 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1910231536220.2308@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20191023133204.GH12121@uranus.lan>
On Wed, 23 Oct 2019, Cyrill Gorcunov wrote:
> On Wed, Oct 23, 2019 at 03:21:05PM +0200, Thomas Gleixner wrote:
> > Errm. estack_pages is statically initialized and it's an array of:.
> >
> > struct estack_pages {
> > u32 offs;
> > u16 size;
> > u16 type;
> > };
> >
> > [0,2,4,5,6,8,10,12] are guard pages so 0 is not that crappy at all
>
> Wait, Thomas, I might be wrong, but per-cpu is initialized to the pointer,
> the memory for this estack_pages has not yet been allocated, no?
static const
struct estack_pages estack_pages[CEA_ESTACK_PAGES] ____cacheline_aligned = {
EPAGERANGE(DF),
EPAGERANGE(NMI),
EPAGERANGE(DB1),
EPAGERANGE(DB),
EPAGERANGE(MCE),
};
It's statically allocated. So it's available from the very beginning.
> The diff I made to fetch the values are
>
> diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
> index 753b8cfe8b8a..bf0d755b6079 100644
> --- a/arch/x86/kernel/dumpstack_64.c
> +++ b/arch/x86/kernel/dumpstack_64.c
> @@ -101,8 +101,18 @@ static bool in_exception_stack(unsigned long *stack, struct stack_info *info)
>
> /* Calc page offset from start of exception stacks */
> k = (stk - begin) >> PAGE_SHIFT;
> +
> /* Lookup the page descriptor */
> ep = &estack_pages[k];
> +
> + printk("stk 0x%lx k %u begin 0x%lx end 0x%lx estack_pages 0x%lx ep 0x%lx\n",
> + stk, k, begin, end, (long)(void *)&estack_pages[0], (long)(void *)ep);
> +
> + for (k = 0; k < CEA_ESTACK_PAGES; k++) {
> + long v = *(long *)(void *)&estack_pages[k];
> + printk("estack_pages[%d] = 0x%lx\n", k, v);
And as I explained to you properly decoded the values _ARE_ correct and
make sense.
> + }
> +
> /* Guard page? */
> if (!ep->size)
> return false;
>
>
> >
> > e.g. 0x51000 00001000
> >
> > bit 0-31: 00001000 Offset 0x1000: 1 Page
> > bit 32-47: 1000 Size 0x1000: 1 Page
> > bit 48-63: 5 Type 5: STACK_TYPE_EXCEPTION + ESTACK_DF
> >
> > So, no. This is NOT the problem.
>
> I drop the left of your reply. True, I agreed with anything you said.
>
> You know I didn't manage to dive more into this problem yesterday
> but if time permits I'll continue today. It is easily triggering
> under kvm (the kernel I'm building is almost without modules so
> I simply upload bzImage into the guest). FWIW, the config I'm
> using is https://gist.github.com/cyrillos/7cd5d2510a99af8ea872f07ac6f9095b
That's helpful because I enabled kmemleak and the kernel comes up just fine.
Thanks,
tglx
next prev parent reply other threads:[~2019-10-23 13:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-19 11:44 [BUG -tip] kmemleak and stacktrace cause page faul Cyrill Gorcunov
2019-10-22 14:23 ` Cyrill Gorcunov
2019-10-22 14:56 ` Cyrill Gorcunov
2019-10-23 13:21 ` Thomas Gleixner
2019-10-23 13:32 ` Cyrill Gorcunov
2019-10-23 13:38 ` Thomas Gleixner [this message]
2019-10-23 13:44 ` Cyrill Gorcunov
2019-10-23 13:47 ` Thomas Gleixner
2019-10-23 13:53 ` Cyrill Gorcunov
2019-10-23 13:59 ` Cyrill Gorcunov
2019-10-23 18:05 ` [PATCH] x86/dumpstack/64: Don't evaluate exception stacks before setup Thomas Gleixner
2019-10-23 18:31 ` Matthew Wilcox
2019-10-23 18:43 ` Cyrill Gorcunov
2019-10-23 21:27 ` Thomas Gleixner
2019-10-23 19:17 ` Josh Poimboeuf
2019-11-04 23:56 ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
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=alpine.DEB.2.21.1910231536220.2308@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=catalin.marinas@arm.com \
--cc=gorcunov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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).