From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932517AbdESVCG (ORCPT ); Fri, 19 May 2017 17:02:06 -0400 Received: from terminus.zytor.com ([65.50.211.136]:46783 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932402AbdESVCE (ORCPT ); Fri, 19 May 2017 17:02:04 -0400 Subject: Re: [PATCH 7/7] DWARF: add the config option To: Josh Poimboeuf , linux-kernel@vger.kernel.org Cc: Jiri Slaby , Andrew Morton , live-patching@vger.kernel.org, Thomas Gleixner , Ingo Molnar , the arch/x86 maintainers , Andy Lutomirski , Jiri Kosina , Linus Torvalds References: <20170505122200.31436-1-jslaby@suse.cz> <20170505122200.31436-7-jslaby@suse.cz> <20170507165524.cdxfuwbd5alr7v6k@treble> <20170519205354.caeyqri2k6gvso3w@treble> From: "H. Peter Anvin" Message-ID: Date: Fri, 19 May 2017 13:57:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170519205354.caeyqri2k6gvso3w@treble> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/19/17 13:53, Josh Poimboeuf wrote: >> >> One instance of the structure would exist for each time the stack >> pointer changes, e.g. for every function entry, push/pop, and rsp >> add/subtract. The data could be assembled and sorted offline, possibly >> derived from DWARF, or more likely, generated by objtool. After doing >> some rough calculations, I think the section size would be comparable to >> the sizes of the DWARF .eh_frame sections it would replace. >> >> If it worked, the "undwarf" unwinder would be a lot simpler than a real >> DWARF unwinder. And validating the sanity of the data at runtime would >> be a lot more straightforward. It could ensure that each stack pointer >> is within the bounds of the current stack, like our current unwinder >> does. > > I've been hacking away at this, and so far it's working well. The code > is much simpler than a DWARF unwinder. Right now the kernel piece is > only ~350 lines of code. The vast majority of the changes are in > objtool. > > It's now successfully unwinding through entry code and most other asm > files, dumping entry regs, dealing with aligned stacks, dynamic stacks, > etc. > > Here's the struct in its current state: How are you handling control flow? -hpa