Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7148024ybi; Mon, 8 Jul 2019 15:36:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9P0965rYD0dsGGOVIPZAWp2bd64t6rqtF3wOZjWsCVDO0IyrDP7yei7WMRlxh9d5E5Iq0 X-Received: by 2002:a17:902:b905:: with SMTP id bf5mr26147484plb.342.1562625384302; Mon, 08 Jul 2019 15:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625384; cv=none; d=google.com; s=arc-20160816; b=gRYa3vz+E9iFARkEdc+YVdbv5aTwYFV66GAtv8/+RqvKWFuhhvBnc5xuSpZfc60qMl uT+yGJ2/n1DhyPrPB5wJhKvHpplA4FHLUnJnZye/YSElwvxB84NhI9HomQtBBq5uI7QM iGnh6CKTrucKyRWSAZ+0Jnl8e3izoFlGXsoFE+tNxoPC1hVn0l/sCCe/jpWMQQ8ubcir /okmIyrMcmWNoUtcF/vc0l36czZyCPbXrJzijxaa2c4PDuw2MytXDnBqjkbr2xnhG/ck u4A0mNFRDtfHR+ow2FNLNCF+AxHdtNOF8fEA41LVk0AX1224+qotnnmoIc8wNUgQHNZc vgDw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RCerkL88C9NF6N68D+/ENgy3Pix+16pzDEXBo69XNdo=; b=0fagzDi8Gr0sHBUt4Zcbo1efS7e7dsjdBKvFm7P1rtu63H4gLeawtWqTGcFuKOdNEz rXBvlc5vdqG85J4PUqBEhky8DhRBefXlXAg18M3kcW1WCFQKJqAJEpEscO3654AD9yJb LzUmmn1DouWPmUswg4OgWor8fAJnrrEaw2pMh9E7P0VV5cW3X9Je1hMdoPGLyvIxeOa0 oDdlVxmMHcRjwrS40F8Wm3nUZNiO3DO/h8eB6OY3AdMKvU3bn/8rzcwseG9bYXZ7gUQc wtaD2K2+Xyo2y8NqgdTCW8Sm3Mq2BRneDZetxijPQcq1mq5SU0o6Xba2sz1Qk8TI92MV lBkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AI2u1vXU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4si19314947plq.93.2019.07.08.15.36.09; Mon, 08 Jul 2019 15:36:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AI2u1vXU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387917AbfGHPWO (ORCPT + 99 others); Mon, 8 Jul 2019 11:22:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:48564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387899AbfGHPWN (ORCPT ); Mon, 8 Jul 2019 11:22:13 -0400 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 41F2220665; Mon, 8 Jul 2019 15:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599332; bh=RSOkxXSyZ2sNkeOzn5fr775UMm1wxH2xyAEoEIewI0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AI2u1vXUNde5nxb+FNk04IZ24C/eubfvVTNTIHn38SgKg+IgM9qaT6TPTfZydQCT+ tYljTUc0JhTBBTv5KGd8sXOHonYjnscaTVrp1AglaiUkraBDu2IWX+zUAf6ym1WFEQ 3NswG7irJT8E0ukAO+4XcvdZJwKhgqzLO3ns6Qlk= 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 Subject: [PATCH 4.9 045/102] fs/proc/array.c: allow reporting eip/esp for all coredumping threads Date: Mon, 8 Jul 2019 17:12:38 +0200 Message-Id: <20190708150528.760963103@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150525.973820964@linuxfoundation.org> References: <20190708150525.973820964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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: 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 @@ -448,7 +448,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);