From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B7FBC2D0D1 for ; Thu, 19 Dec 2019 18:38:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C7F02468D for ; Thu, 19 Dec 2019 18:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780700; bh=GMdPGt8ElWlIoWM7NGMD1M1j3aJxaKrQidEZgFvOLC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hFKjTX5VUeDqJNuYqfBJ7sX/ZXoOSeIixFSARSeEHYeq4bs50Kv8VGz2q2omyWLf+ juH7NjNkzDP94dZRfX4jeg5p6mpJeGMKFUAkPSyrr9XssgJucS/GlScWrD5g0X6DjS iADxiIrrUUqD99S3UremMlgW1l65ZYeaZkjzTyAQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727351AbfLSSiS (ORCPT ); Thu, 19 Dec 2019 13:38:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:56244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728005AbfLSSiS (ORCPT ); Thu, 19 Dec 2019 13:38:18 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 607992467F; Thu, 19 Dec 2019 18:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780697; bh=GMdPGt8ElWlIoWM7NGMD1M1j3aJxaKrQidEZgFvOLC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m36So0AvL0J8iWTH2iMiEGYqaWPcCidOGi9rj3oaU0nU/52ddT6TVrsa/KiQ3lwDR bjJtdXPDRKN3mM0KGKt65t/N99fjXHZMX9Qcu8Q/Q2kKWh34v6G74eo+iWcOqcofdO 0xKFNYP9szWy505hj9zfFD4eWyNLbfBrqTxi/1cQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Ogness , Jan Luebbe , Alexey Dobriyan , Andy Lutomirski , Andrew Morton , Linus Torvalds , "zhangyi (F)" Subject: [PATCH 4.4 081/162] fs/proc/array.c: allow reporting eip/esp for all coredumping threads Date: Thu, 19 Dec 2019 19:33:09 +0100 Message-Id: <20191219183212.732854666@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: John Ogness commit cb8f381f1613cafe3aec30809991cd56e7135d92 upstream. 0a1eb2d474ed ("fs/proc: Stop reporting eip and esp in /proc/PID/stat") stopped reporting eip/esp and fd7d56270b52 ("fs/proc: Report eip/esp in /prod/PID/stat for coredumping") reintroduced the feature to fix a regression with userspace core dump handlers (such as minicoredumper). Because PF_DUMPCORE is only set for the primary thread, this didn't fix the original problem for secondary threads. Allow reporting the eip/esp for all threads by checking for PF_EXITING as well. This is set for all the other threads when they are killed. coredump_wait() waits for all the tasks to become inactive before proceeding to invoke a core dumper. Link: http://lkml.kernel.org/r/87y32p7i7a.fsf@linutronix.de Link: http://lkml.kernel.org/r/20190522161614.628-1-jlu@pengutronix.de Fixes: fd7d56270b526ca3 ("fs/proc: Report eip/esp in /prod/PID/stat for coredumping") Signed-off-by: John Ogness Reported-by: Jan Luebbe Tested-by: Jan Luebbe Cc: Alexey Dobriyan Cc: Andy Lutomirski Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: zhangyi (F) Signed-off-by: Greg Kroah-Hartman --- fs/proc/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -434,7 +434,7 @@ static int do_task_stat(struct seq_file * a program is not able to use ptrace(2) in that case. It is * safe because the task has stopped executing permanently. */ - if (permitted && (task->flags & PF_DUMPCORE)) { + if (permitted && (task->flags & (PF_EXITING|PF_DUMPCORE))) { if (try_get_task_stack(task)) { eip = KSTK_EIP(task); esp = KSTK_ESP(task);