Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp840680ybh; Wed, 22 Jul 2020 14:56:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4b3l7FcgQftsEX1mRfcpRV4UWus+ti5qTr4TTVUbGD+nd38Jiui57ILql6witAhYWHTx1 X-Received: by 2002:aa7:d04e:: with SMTP id n14mr1443990edo.161.1595454996968; Wed, 22 Jul 2020 14:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595454996; cv=none; d=google.com; s=arc-20160816; b=eOgmHNtjjc+6hWSHVeO6To4hUljwXszvdLJM4dUGjBvcqe31a5uE3hMSl7vVXBFkaC jN8kOtI+FwHheMsXAn+pR0W4wcam6JM67V3FfuwH6rRBz+n6NCOnh9+LLdsNt3+ReIb2 ZJwDvr4LYROrp9JotTdd50p/tiHKDc/70esF+uXhVzFCAlBUQ8HXlK5ulgi51fNpaarj 20s81L0hcYyUFBAenEN3a00/RfRHdtxLsfJLipW5or6Sih5oQt3+RsG4Ii3msSE042vM tIUKuCBqTnCCNeWtO1Npg09RAj0dJOIvyKUgmGnoIim0uDsiopagKN2U15UXrieen5Ag nztw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=onB23TV72snXsM4Kk96d5u93DsT0lvJ0OrxNxUiy8sE=; b=nzh7feaTtUnTkoBl7kz+M+asUTdclQ2vBm0MiAteqzJhFf3gKfZCRJ/Qevdo7L6Xmq XNfi5f+c+2B7NKOCii8Ij8sIsNiE3PtY+lqM8/aHP/6GA17LQCYi6NoyofHEovYlUwvK JT7Sy9i3n5x5VW3+GRhUWihJ5KCFVW5cc0RzmLVzaULEugvH+442As06oO0Cif3gvuX3 8f2zVLy2KlwCEMtUss1WRUcWI6NygVQD6ID6rK6fsdg6vfAQ/h1GPPEauyQMtbXA389I irIYKxaHIDTY7Am1UEleiAO7/KaTYXxZ8GS+jgGlAs/CsqH9r84AFCPM+Q3dV8l0EgaY BlEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=p0o6P5s5; dkim=neutral (no key) header.i=@vger.kernel.org; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si780689edp.515.2020.07.22.14.56.15; Wed, 22 Jul 2020 14:56:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=p0o6P5s5; dkim=neutral (no key) header.i=@vger.kernel.org; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733010AbgGVVzl (ORCPT + 99 others); Wed, 22 Jul 2020 17:55:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730837AbgGVVzi (ORCPT ); Wed, 22 Jul 2020 17:55:38 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79671C0619E1; Wed, 22 Jul 2020 14:55:38 -0700 (PDT) Date: Wed, 22 Jul 2020 21:55:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595454936; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=onB23TV72snXsM4Kk96d5u93DsT0lvJ0OrxNxUiy8sE=; b=p0o6P5s5BhdLlp7pKo4s6PmgWr+C9miZGU0gCo8LtmjeDMKEON1TUpaN/IcnRCjZLc22TD nfYe1D1ykPnGi2WFB9/J8a1BfqxGqQQhEUXIQJ4eOG8X5JNxHbNONJ8/ow/Vs0GzYelEZf p85qxdTPsDnLv5wsbHQ/15wKwyrUCHZ0idXQUKKiPcSbhxSuzFexCWo3GeJy9u6dMyGCdX 4x5nQjubva1HfG20SziXeDB4kCgTf8kDWFr4rVAIAlrWzxek5o59WtBa3ICaPAmmJ6PSqb Ji2P+BzNucC43+MLBJyV5J9glJFyJ800lMP0QM6csi/fqRrejNeXoqYwDcpPmw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595454936; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=onB23TV72snXsM4Kk96d5u93DsT0lvJ0OrxNxUiy8sE=; b=ThnfCRmojj4756uQOXu4tU+8xR4DYwcdu9i8JkV7KolVSHgqd7Tyrb/gh6K/8uYYw1tBK1 GaPUy/amx7HMn2Ag== From: "tip-bot2 for Josh Poimboeuf" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/stacktrace: Fix reliable check for empty user task stacks Cc: Wang ShaoBo , Josh Poimboeuf , Thomas Gleixner , x86 , LKML In-Reply-To: References: MIME-Version: 1.0 Message-ID: <159545493605.4006.17560256116826409394.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 039a7a30ec102ec866d382a66f87f6f7654f8140 Gitweb: https://git.kernel.org/tip/039a7a30ec102ec866d382a66f87f6f7654f8140 Author: Josh Poimboeuf AuthorDate: Fri, 17 Jul 2020 09:04:26 -05:00 Committer: Thomas Gleixner CommitterDate: Wed, 22 Jul 2020 23:47:47 +02:00 x86/stacktrace: Fix reliable check for empty user task stacks If a user task's stack is empty, or if it only has user regs, ORC reports it as a reliable empty stack. But arch_stack_walk_reliable() incorrectly treats it as unreliable. That happens because the only success path for user tasks is inside the loop, which only iterates on non-empty stacks. Generally, a user task must end in a user regs frame, but an empty stack is an exception to that rule. Thanks to commit 71c95825289f ("x86/unwind/orc: Fix error handling in __unwind_start()"), unwind_start() now sets state->error appropriately. So now for both ORC and FP unwinders, unwind_done() and !unwind_error() always means the end of the stack was successfully reached. So the success path for kthreads is no longer needed -- it can also be used for empty user tasks. Reported-by: Wang ShaoBo Signed-off-by: Josh Poimboeuf Signed-off-by: Thomas Gleixner Tested-by: Wang ShaoBo Link: https://lkml.kernel.org/r/f136a4e5f019219cbc4f4da33b30c2f44fa65b84.1594994374.git.jpoimboe@redhat.com --- arch/x86/kernel/stacktrace.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 6ad43fc..2fd698e 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c @@ -58,7 +58,6 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, * or a page fault), which can make frame pointers * unreliable. */ - if (IS_ENABLED(CONFIG_FRAME_POINTER)) return -EINVAL; } @@ -81,10 +80,6 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, if (unwind_error(&state)) return -EINVAL; - /* Success path for non-user tasks, i.e. kthreads and idle tasks */ - if (!(task->flags & (PF_KTHREAD | PF_IDLE))) - return -EINVAL; - return 0; }