public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Vince Weaver <vincent.weaver@maine.edu>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andy Lutomirski <luto@kernel.org>
Subject: Re: perf: fuzzer causes stack going in wrong direction warnings
Date: Wed, 2 May 2018 15:50:09 -0500	[thread overview]
Message-ID: <20180502205009.codkvscnh4j4hm6b@treble> (raw)
In-Reply-To: <20180501220458.p3rgwzh3jcqt4jmm@treble>

On Tue, May 01, 2018 at 05:04:58PM -0500, Josh Poimboeuf wrote:
> On Tue, May 01, 2018 at 03:59:31PM -0400, Vince Weaver wrote:
> > On Tue, 1 May 2018, Josh Poimboeuf wrote:
> > 
> > > Can you try the following patch?
> > 
> > I applied the patch, but the warnings don't really look that different.
> > 
> > [   62.220322] WARNING: stack recursion on stack type 4
> > [   62.220326] WARNING: can't dereference registers at 000000009ca2e86d for ip swapgs_restore_regs_and_return_to_usermode+0x79/0x87
> > [  367.597013] WARNING: stack going in the wrong direction? ip=native_sched_clock+0x9/0x90
> 
> Bummer.  I'll need to come up with a patch to dump more info.

After looking closer, I realized that at least some of these warnings
are due to bad unwind hints in the entry code.  Can you try this patch
instead of the last one?

diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h
index be63330c5511..73f5d4c10304 100644
--- a/arch/x86/entry/calling.h
+++ b/arch/x86/entry/calling.h
@@ -165,6 +165,7 @@ For 32-bit we have the following conventions - kernel is built with
 	.endif
 	popq %rdx
 	popq %rsi
+	UNWIND_HINT_IRET_REGS offset=16
 	.if \pop_rdi
 	popq %rdi
 	.endif
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 805f52703ee3..c6c54ce30090 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -306,7 +306,6 @@ GLOBAL(entry_SYSCALL_64_after_hwframe)
 	 */
 syscall_return_via_sysret:
 	/* rcx and r11 are already restored (see code above) */
-	UNWIND_HINT_EMPTY
 	POP_REGS pop_rdi=0 skip_r11rcx=1
 
 	/*
@@ -315,6 +314,7 @@ syscall_return_via_sysret:
 	 */
 	movq	%rsp, %rdi
 	movq	PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp
+	UNWIND_HINT_EMPTY
 
 	pushq	RSP-RDI(%rdi)	/* RSP */
 	pushq	(%rdi)		/* RDI */
@@ -666,6 +666,7 @@ GLOBAL(swapgs_restore_regs_and_return_to_usermode)
 	 */
 	movq	%rsp, %rdi
 	movq	PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp
+	UNWIND_HINT_EMPTY
 
 	/* Copy the IRET frame to the trampoline stack. */
 	pushq	6*8(%rdi)	/* SS */
@@ -1640,6 +1641,7 @@ nmi_restore:
 	 * at the "iret" frame.
 	 */
 	addq	$6*8, %rsp
+	UNWIND_HINT_IRET_REGS
 
 	/*
 	 * Clear "NMI executing".  Set DF first so that we can easily
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 92b6a2c21631..d66f14bb6c50 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1239,7 +1239,7 @@ static int update_insn_state_regs(struct instruction *insn, struct insn_state *s
 	struct cfi_reg *cfa = &state->cfa;
 	struct stack_op *op = &insn->stack_op;
 
-	if (cfa->base != CFI_SP)
+	if (cfa->base != CFI_SP && cfa->base != CFI_SP_INDIRECT)
 		return 0;
 
 	/* push */

  reply	other threads:[~2018-05-02 20:50 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 16:12 perf: perf_fuzzer quickly locks up on 4.15-rc7 Vince Weaver
2018-01-08 17:30 ` Ingo Molnar
2018-01-08 20:29   ` Vince Weaver
2018-01-09 10:25     ` Peter Zijlstra
2018-01-09 13:26       ` Peter Zijlstra
2018-01-09 13:36         ` Peter Zijlstra
2018-01-09 13:44         ` Vince Weaver
2018-01-09 15:12           ` Peter Zijlstra
2018-01-09 15:24             ` Vince Weaver
2018-01-09 15:33               ` Peter Zijlstra
2018-01-09 15:56                 ` Vince Weaver
2018-01-09 16:05                   ` Peter Zijlstra
2018-01-09 17:07                     ` Josh Poimboeuf
2018-01-11  5:25                       ` Josh Poimboeuf
2018-01-11 19:00                         ` Vince Weaver
2018-01-11 19:21                           ` Josh Poimboeuf
2018-01-11 19:50                             ` Peter Zijlstra
2018-01-11 19:57                               ` Vince Weaver
2018-01-11 20:43                                 ` Vince Weaver
2018-05-01 13:29                             ` perf: fuzzer causes stack going in wrong direction warnings Vince Weaver
2018-05-01 13:58                               ` Josh Poimboeuf
2018-05-01 19:59                                 ` Vince Weaver
2018-05-01 22:04                                   ` Josh Poimboeuf
2018-05-02 20:50                                     ` Josh Poimboeuf [this message]
2018-05-04 14:35                                       ` Vince Weaver
2018-05-04 16:25                                         ` Josh Poimboeuf
2018-05-04 17:00                                           ` Vince Weaver
2018-05-05 15:38                                           ` Vince Weaver
2018-05-05 18:29                                             ` Josh Poimboeuf
2018-05-06 23:49                                               ` Josh Poimboeuf
2018-05-10 13:48                                                 ` Peter Zijlstra
2018-05-10 14:27                                                   ` Josh Poimboeuf
2018-05-10 23:16                                                   ` Josh Poimboeuf
2018-01-09 16:16                 ` perf: perf_fuzzer quickly locks up on 4.15-rc7 Ingo Molnar
2018-01-09 16:20                   ` Peter Zijlstra
2018-01-09 17:18                 ` Vince Weaver
2018-01-10 15:28                   ` Vince Weaver
2018-01-09 16:14             ` Peter Zijlstra
2018-01-09 17:53               ` Steven Rostedt
2018-01-09 18:02                 ` Peter Zijlstra
2018-01-09 18:09                   ` Steven Rostedt
2018-01-09 19:53                     ` Peter Zijlstra
2018-01-11  9:13           ` Peter Zijlstra
2018-01-11 15:26             ` Vince Weaver
2018-01-11 15:38               ` Peter Zijlstra
2018-01-11 16:41                 ` Vince Weaver
2018-01-11 16:58                   ` Vince Weaver
2018-01-11 17:03                     ` Peter Zijlstra
2018-01-11 18:04                       ` Vince Weaver
2018-01-11 18:20                         ` Vince Weaver
2018-01-11 19:01                           ` Peter Zijlstra
2018-01-11 19:11                       ` Peter Zijlstra
2018-01-11 20:15                         ` Vince Weaver
2018-01-11 20:40                           ` Vince Weaver
2018-01-11 20:57                             ` Peter Zijlstra
2018-01-12 19:48                               ` Vince Weaver
2018-01-11 20:42                           ` Peter Zijlstra
2018-01-11 15:29             ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180502205009.codkvscnh4j4hm6b@treble \
    --to=jpoimboe@redhat.com \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.weaver@maine.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox