From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A4ADCA9EB7 for ; Wed, 23 Oct 2019 13:38:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6521721928 for ; Wed, 23 Oct 2019 13:38:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6521721928 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 06E596B0003; Wed, 23 Oct 2019 09:38:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01EAF6B0006; Wed, 23 Oct 2019 09:38:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E78576B0007; Wed, 23 Oct 2019 09:38:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0178.hostedemail.com [216.40.44.178]) by kanga.kvack.org (Postfix) with ESMTP id C6FF96B0003 for ; Wed, 23 Oct 2019 09:38:46 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 7583C180AD80F for ; Wed, 23 Oct 2019 13:38:46 +0000 (UTC) X-FDA: 76075154652.22.sofa71_86c01f00d254d X-HE-Tag: sofa71_86c01f00d254d X-Filterd-Recvd-Size: 3889 Received: from Galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Oct 2019 13:38:45 +0000 (UTC) Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iNGqX-0002jw-6r; Wed, 23 Oct 2019 15:38:41 +0200 Date: Wed, 23 Oct 2019 15:38:40 +0200 (CEST) From: Thomas Gleixner To: Cyrill Gorcunov cc: LKML , Ingo Molnar , Peter Zijlstra , linux-mm@kvack.org, Catalin Marinas Subject: Re: [BUG -tip] kmemleak and stacktrace cause page faul In-Reply-To: <20191023133204.GH12121@uranus.lan> Message-ID: References: <20191019114421.GK9698@uranus.lan> <20191022142325.GD12121@uranus.lan> <20191022145619.GE12121@uranus.lan> <20191023133204.GH12121@uranus.lan> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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