From owner-freebsd-hackers@freebsd.org Thu Dec 24 17:25:45 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15AC1A511A5; Thu, 24 Dec 2015 17:25:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E982113D5; Thu, 24 Dec 2015 17:25:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C9FD2B989; Thu, 24 Dec 2015 12:25:43 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Cc: Arlie Stephens , hackers@freebsd.org Subject: Re: Examining Page Tables in Kernel Crash Dumps (amd64) Date: Thu, 24 Dec 2015 08:10:17 -0800 Message-ID: <2188443.PY7dC12t9i@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20151222235920.GA21736@worldash.org> References: <20151222235920.GA21736@worldash.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 24 Dec 2015 12:25:43 -0500 (EST) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2015 17:25:45 -0000 On Tuesday, December 22, 2015 03:59:20 PM Arlie Stephens wrote: > I'm chasing a bug in an elderly, customized freebsd kernel that appears to > result in corrupted page tables. > > kgdb is not cooperating when I attempt to look at addresses of kernel > page tables. I've replicated that part on an elderly stock freebsd > system, running freebsd 8.4. , and it looks to me like it's probably > getting that limitation from libkvm. > > Obviously I don't expect community help with an ancient freebsd > issue... particularly one probably caused by our own customizations. > > But given the tool chain changes upstream, I don't expect testing with > whatever kgdb has turned into there to be very relevant ;-( > > So far, the only way I know to get a look at kernel page table > contents in FreeBSD is on live systems with ddb. > > I would like to know whether there are any tools I haven't noticed for > dealing with page tables in crash dumps - or, for that matter, whether > kgdb is supposed to be able to display the kernel's recursive page > tables. > > Failing that, I may just have to write one ;-) (Or figure out how to > chase my problem on live systems.) kgdb depends on libkvm to handle translations of virtual addresses to offsets in the vmcore file (which is then used by kvm_read to read the relevant data). On amd64 you can cheat a bit by using direct map addresses (I use this in my gdb macros to walk the page tables by hand so I can look at raw PDEs, PTEs, etc.). (For the macros I use you can look at www.freebsd.org/~jhb/gdb/gdb6.amd64) Normally you download the files there and do 'source gdb6' which will pull in gdb6.amd64. The 'pmap_*' macros try to replicate the behavior of the equivalent functions in pmap.c. -- John Baldwin