Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2264786ybl; Thu, 19 Dec 2019 10:40:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzwYjb7YcuAhQtMeDYkjTlb8Pg5WB1jXpfE1BA5f9/xS+kK0nnMDHow30Q+ER+KrzDaQsP9 X-Received: by 2002:a9d:75da:: with SMTP id c26mr10283268otl.40.1576780805425; Thu, 19 Dec 2019 10:40:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576780805; cv=none; d=google.com; s=arc-20160816; b=XtSY1DNqr6CXuTB8B64H4PikJ5Hw+6834Hk7jzm7HZdPdDxq6tLIK2S6cg2Ifvc1oH 19H0jH+GPvUaYFj1AYeqcXNs/F8tRgJiqN7tF1l7AhzN3GNEFPDt8koMj7CiqC/Slwva 18hvvJGvbSJWkfVs8RIg8n6jB5uppBlY7c8sJwHc+Uj+IWODqOJ0fZAGDyYzCLEdLcvv Govf/E0c++2AB1Sfv6Qs+WHvt4Uw4dh13bkOiAhy2RSHGxJ5t5HC7SujYqWVTckTnHc5 798MDq0Grijz9ipgblb/XF8MrktlferE+QLTS60WYVweREk2nVAXLM4EylQzle/An+7w 4z+Q== 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=/xYPt59KiY18MmW4Rw5tA9SV22bGcbJJrWhziECJKRU=; b=I7nBULTkNuS80fR3xDtBZXhnJ2Z2sYxSLY2i61Avxm7OUBINn8f+LKUjnT3RoMRAKm pdgqeYq1BcVr7YE0+xIIrio7GTYIrGObtmnhG+rddTDDlkQHvxpkP46iP0T7xig23x57 XyCDtm9TM11voH62MO1MHZSMBSu4EMH7+cUjsOTiAAGScGTSEeGJUzP4o3nKFcWrgufR q5vcYdrLlN+WlGu5Lf4J+06e4Pi0ypy4SfD11nL4W0oYmpTMbLIzquTRaZVca1GSikLd XLdaf1Ma+MpDDVTUo++N/fNeGzd0yzz9WNy/nNqeg5UaZ7rDLLYu05/LOGdq7+h2usOt lKJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m36So0Av; 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 r12si3583731otq.156.2019.12.19.10.39.52; Thu, 19 Dec 2019 10:40:05 -0800 (PST) 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=m36So0Av; 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 S1727711AbfLSSiU (ORCPT + 99 others); Thu, 19 Dec 2019 13:38:20 -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: 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: 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);