From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755832AbdEGVsx (ORCPT ); Sun, 7 May 2017 17:48:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47644 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754595AbdEGVst (ORCPT ); Sun, 7 May 2017 17:48:49 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BC82E2BFA6 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jpoimboe@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BC82E2BFA6 Date: Sun, 7 May 2017 16:48:36 -0500 From: Josh Poimboeuf To: hpa@zytor.com Cc: Ingo Molnar , Linus Torvalds , Jiri Slaby , Andrew Morton , live-patching@vger.kernel.org, Linux Kernel Mailing List , Thomas Gleixner , Ingo Molnar , the arch/x86 maintainers , Andy Lutomirski , Jiri Kosina Subject: Re: [PATCH 7/7] DWARF: add the config option Message-ID: <20170507214836.62odebycv42fzngm@treble> References: <20170505122200.31436-1-jslaby@suse.cz> <20170505122200.31436-7-jslaby@suse.cz> <20170507165524.cdxfuwbd5alr7v6k@treble> <20170507175915.ggwfusgvbwfqsvtz@gmail.com> <3980F538-919F-4A51-B7FE-4EC6E86AA259@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3980F538-919F-4A51-B7FE-4EC6E86AA259@zytor.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 07 May 2017 21:48:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 07, 2017 at 11:08:19AM -0700, hpa@zytor.com wrote: > On May 7, 2017 10:59:16 AM PDT, Ingo Molnar wrote: > > > >* 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. > > > >That's something I've been thinking about as well: if objtool generates > >the > >unwinder data structures then the kernel is not directly exposed to > >tooling bugs > >anymore. > > > >A fair chunk of the fragility of DWARF comes from the fact that it's > >generated by > >a tool chain that we cannot fix as part of the kernel project. If GCC > >generates > >crap debuginfo, and GDB happens to work with it but the kernel not, > >we'll have to > >work it around in the kernel. If GCC starts bloating debuginfo in the > >future we > >are screwed as well, etc. > > > >If objtool generates debuginfo then it's _our_ responsibility to have > >sane > >unwinder info and we obviously manage its structure and size as well. > >Win-win. > > > >The unwinder itself should still do sanity checks, etc. (like all good > >debugging > >infrastructure code) - but the nature of the kernel's exposure to tool > >chain > >details changes in a very fundamental way. > > > >So yes, I think this is a very good idea, assuming it works in > >practice! ;-) > > > >Thanks, > > > > Ingo > > Can objtool verify the unwinder at each address in the kernel, or is that an AI-complete problem? It can't verify the *unwinder*, but it can verify the data which is fed to the unwinder (either DWARF or the structs I proposed above). For each function, it follows every possible code path, and it can keep track of the stack pointer while doing so. -- Josh