From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753367AbdG2Dyk (ORCPT ); Fri, 28 Jul 2017 23:54:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47498 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753112AbdG2Dyj (ORCPT ); Fri, 28 Jul 2017 23:54:39 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0716B16000C Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jpoimboe@redhat.com Date: Fri, 28 Jul 2017 22:54:37 -0500 From: Josh Poimboeuf To: "Levin, Alexander (Sasha Levin)" Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "live-patching@vger.kernel.org" , Linus Torvalds , Andy Lutomirski , Jiri Slaby , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Mike Galbraith Subject: Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder Message-ID: <20170729035437.fmnxmeedrq55bpwm@treble> References: <0a6cbfb40f8da99b7a45a1a8302dc6aef16ec812.1500938583.git.jpoimboe@redhat.com> <20170728164844.tee7ujqluv2fgarf@sasha-lappy> <20170728175234.pmou7z6dosbi7krh@treble> <20170728182954.imivl45vrc7toarp@sasha-lappy> <20170728185720.fwczcezbkrlxmwqb@treble> <20170728195912.panyn4p6e6ovueey@sasha-lappy> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170728195912.panyn4p6e6ovueey@sasha-lappy> 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.38]); Sat, 29 Jul 2017 03:54:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 28, 2017 at 07:59:12PM +0000, Levin, Alexander (Sasha Levin) wrote: > On Fri, Jul 28, 2017 at 01:57:20PM -0500, Josh Poimboeuf wrote: > >Thanks, that's much better. I'm relieved the unwinder didn't screw that > >up, at least. > > > >This looks like a tricky one. Is it easily recreatable? > > Yeah, I just hit it again with slightly different initial calls: Sasha sent me some data privately. As I suspected, the cause is some bad ORC data. Objtool incorrectly assumes that once the frame pointer is set up, it no longer gets touched. For example: ffffffff81820680 : ffffffff81820680: 41 56 push %r14 ffffffff81820682: 41 55 push %r13 ffffffff81820684: 41 54 push %r12 ffffffff81820686: 49 89 fc mov %rdi,%r12 ffffffff81820689: 55 push %rbp ffffffff8182068a: 53 push %rbx ffffffff8182068b: 48 bb 00 00 00 00 00 movabs $0xdffffc0000000000,%rbx ffffffff81820692: fc ff df ffffffff81820695: 48 83 c4 80 add $0xffffffffffffff80,%rsp ffffffff81820699: 48 89 e5 mov %rsp,%rbp ffffffff8182069c: 48 c7 04 24 b3 8a b5 movq $0x41b58ab3,(%rsp) ffffffff818206a3: 41 ffffffff818206a4: 48 c7 44 24 08 07 a5 movq $0xffffffff8621a507,0x8(%rsp) ffffffff818206ab: 21 86 ffffffff818206a9: R_X86_64_32S .rodata+0xa1a507 ffffffff818206ad: 48 c1 ed 03 shr $0x3,%rbp In this case, rbp was pushed ("push %rbp") and then replaced with rsp ("mov %rsp, %rbp"), which is the normal frame pointer setup. But then rbp was modified ("shr 0x3, %rbp"), which objtool didn't expect. Objtool will need to be made smarter here somehow. I'll be on vacation next week so it might be a week or so before I can come up with the fix. Despite the scary KASAN warning, this is only a minor bug. The ORC data isn't perfect yet, so these types of issues will happen until we get the kinks worked out. The good news is the unwinder recovered from the bad ORC data gracefully, and the oops dump still showed the rest of the addresses (with question marks). -- Josh