From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751681AbdJTB2H (ORCPT ); Thu, 19 Oct 2017 21:28:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50798 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750902AbdJTB2F (ORCPT ); Thu, 19 Oct 2017 21:28:05 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B16C4A0CDE Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jpoimboe@redhat.com Date: Thu, 19 Oct 2017 20:28:04 -0500 From: Josh Poimboeuf To: Andrei Vagin Cc: Ingo Molnar , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, peterz@infradead.org, hpa@zytor.com, tglx@linutronix.de Subject: Re: [2/2] x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit Message-ID: <20171020012804.vbqsrajia3ficwzm@treble> References: <9b1237bbe7244ed9cdf8db2dcb1253e37e1c341e.1507924831.git.jpoimboe@redhat.com> <20171019165103.GA15123@outlook.office365.com> <20171019181655.7yjgxuebkqzzcz4f@treble> <20171019223522.GA4499@outlook.office365.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20171019223522.GA4499@outlook.office365.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.25]); Fri, 20 Oct 2017 01:28:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 19, 2017 at 03:35:22PM -0700, Andrei Vagin wrote: > On Thu, Oct 19, 2017 at 01:16:55PM -0500, Josh Poimboeuf wrote: > > On Thu, Oct 19, 2017 at 09:51:04AM -0700, Andrei Vagin wrote: > > > Hi, > > > > > > We run CRIU tests for tip/auto-latest regularly, and a few days ago our > > > test job started to detect this warning in a kernel log: > > > > > > [ 44.235786] WARNING: can't dereference iret registers at ffff8801c5f17fe0 for ip ffffffff95f0d94b > > > > > > What does it mean? How critical is it? > > > > > > Our test job fails if it detects any warning in a kernel log. Maybe we > > > need to investigate reasons of this warning and try to eliminate it? > > > > > > Here are logs: > > > https://travis-ci.org/avagin/linux/jobs/289676634 > > > > I think it means the unwinder found some bad ORC unwinder metadata. Any > > chance you have access to the kernel binary? I need to know what code > > corresponds to that ffffffff95f0d94b address. > > > > Or if you can reproduce with the following patch, that should help: > > > > > > diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c > > index 570b70d3f604..95b633f0ce51 100644 > > --- a/arch/x86/kernel/unwind_orc.c > > +++ b/arch/x86/kernel/unwind_orc.c > > @@ -448,7 +448,7 @@ bool unwind_next_frame(struct unwind_state *state) > > > > case ORC_TYPE_REGS_IRET: > > if (!deref_stack_regs(state, sp, &state->ip, &state->sp, false)) { > > - orc_warn("can't dereference iret registers at %p for ip %p\n", > > + orc_warn("can't dereference iret registers at %p for ip %pB\n", > > (void *)sp, (void *)orig_ip); > > goto done; > > } > > I applied your patch and rerun tests. > > [ 44.947699] WARNING: can't dereference iret registers at ffff880178f5ffe0 for ip int3+0x5b/0x60 Thanks, that was enough for me to figure it out. Can you test the below fix? > and now here is a warning from kasan: > > [ 477.775676] ================================================================== > [ 477.775845] BUG: KASAN: stack-out-of-bounds in deref_stack_reg+0x11d/0x150 The KASAN warning is a known issue for which the fix is a little more complicated. v1 of the patch was here: https://lkml.kernel.org/r/cover.1507128293.git.jpoimboe@redhat.com diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 49167258d587..f6cdb7a1455e 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -808,7 +808,7 @@ apicinterrupt IRQ_WORK_VECTOR irq_work_interrupt smp_irq_work_interrupt .macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 ENTRY(\sym) - UNWIND_HINT_IRET_REGS offset=8 + UNWIND_HINT_IRET_REGS offset=\has_error_code*8 /* Sanity check */ .if \shift_ist != -1 && \paranoid == 0