linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc: report eip and esp for all threads when coredumping
@ 2019-05-22 16:16 Jan Luebbe
  2019-05-22 17:13 ` Alexey Dobriyan
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jan Luebbe @ 2019-05-22 16:16 UTC (permalink / raw)
  To: Alexey Dobriyan, Andrew Morton, John Ogness, Andy Lutomirski
  Cc: kernel, linux-kernel, linux-fsdevel, Jan Luebbe

Commit 0a1eb2d474ed ("fs/proc: Stop reporting eip and esp in
/proc/PID/stat") stopped reporting eip/esp and commit 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. This commit checks
mm->core_state instead, as already done for /proc/<pid>/status in
task_core_dumping(). As we have a mm_struct available here anyway, this
seems to be a clean solution.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 fs/proc/array.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index 2edbb657f859..b76b1e29fc36 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -462,7 +462,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
 		 * 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 && (!!mm->core_state)) {
 			if (try_get_task_stack(task)) {
 				eip = KSTK_EIP(task);
 				esp = KSTK_ESP(task);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-06-03 19:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 16:16 [PATCH] proc: report eip and esp for all threads when coredumping Jan Luebbe
2019-05-22 17:13 ` Alexey Dobriyan
2019-05-22 18:00 ` Andrew Morton
2019-05-23  8:15   ` Jan Lübbe
2019-05-24 23:50 ` John Ogness
     [not found]   ` <20190525143220.e771b7915d17f22dad1438fa@linux-foundation.org>
2019-05-26 19:41     ` John Ogness
2019-05-29  8:55       ` [PATCHv2] fs/proc: allow reporting eip/esp for all coredumping threads John Ogness
2019-05-29 21:55         ` Andrew Morton
2019-05-30  0:58         ` [PATCHv3] " John Ogness
2019-05-30  1:14           ` Andrew Morton
2019-06-03 19:54           ` Jan Lübbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).