From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966759AbdLSLFr (ORCPT ); Tue, 19 Dec 2017 06:05:47 -0500 Received: from terminus.zytor.com ([65.50.211.136]:50235 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965133AbdLSLFn (ORCPT ); Tue, 19 Dec 2017 06:05:43 -0500 Date: Tue, 19 Dec 2017 03:01:27 -0800 From: tip-bot for Josh Poimboeuf Message-ID: Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, mingo@kernel.org, jpoimboe@redhat.com, tglx@linutronix.de, mbenes@suse.cz Reply-To: torvalds@linux-foundation.org, jpoimboe@redhat.com, mingo@kernel.org, peterz@infradead.org, tglx@linutronix.de, mbenes@suse.cz, linux-kernel@vger.kernel.org, hpa@zytor.com, luto@kernel.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/stacktrace: Make zombie stack traces reliable Git-Commit-ID: 6454b3bdd138dfc640deb5e7b9a0668fca2d55dd X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6454b3bdd138dfc640deb5e7b9a0668fca2d55dd Gitweb: https://git.kernel.org/tip/6454b3bdd138dfc640deb5e7b9a0668fca2d55dd Author: Josh Poimboeuf AuthorDate: Mon, 18 Dec 2017 15:13:44 -0600 Committer: Ingo Molnar CommitDate: Tue, 19 Dec 2017 09:01:05 +0100 x86/stacktrace: Make zombie stack traces reliable Commit: 1959a60182f4 ("x86/dumpstack: Pin the target stack when dumping it") changed the behavior of stack traces for zombies. Before that commit, /proc//stack reported the last execution path of the zombie before it died: [] do_exit+0x6f7/0xa80 [] do_group_exit+0x39/0xa0 [] __wake_up_parent+0x0/0x30 [] system_call_fastpath+0x16/0x1b [<00007fd128f9c4f9>] 0x7fd128f9c4f9 [] 0xffffffffffffffff After the commit, it just reports an empty stack trace. The new behavior is actually probably more correct. If the stack refcount has gone down to zero, then the task has already gone through do_exit() and isn't going to run anymore. The stack could be freed at any time and is basically gone, so reporting an empty stack makes sense. However, save_stack_trace_tsk_reliable() treats such a missing stack condition as an error. That can cause livepatch transition stalls if there are any unreaped zombies. Instead, just treat it as a reliable, empty stack. Reported-and-tested-by: Miroslav Benes Signed-off-by: Josh Poimboeuf Cc: Andy Lutomirski Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: live-patching@vger.kernel.org Fixes: af085d9084b4 ("stacktrace/x86: add function for detecting reliable stack traces") Link: http://lkml.kernel.org/r/e4b09e630e99d0c1080528f0821fc9d9dbaeea82.1513631620.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/stacktrace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 77835bc..20161ef 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c @@ -164,8 +164,12 @@ int save_stack_trace_tsk_reliable(struct task_struct *tsk, { int ret; + /* + * If the task doesn't have a stack (e.g., a zombie), the stack is + * "reliably" empty. + */ if (!try_get_task_stack(tsk)) - return -EINVAL; + return 0; ret = __save_stack_trace_reliable(trace, tsk);