Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1259299ybl; Mon, 2 Dec 2019 00:15:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwxNSCnlqZHkoOp6TxIvMEIeJnPsjhkSktosGHPnZT2SkRH0x/LjG1hF+24enupiVp45son X-Received: by 2002:a05:6402:2047:: with SMTP id bc7mr4242624edb.88.1575274544516; Mon, 02 Dec 2019 00:15:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575274544; cv=none; d=google.com; s=arc-20160816; b=AFugHR1AUDPOSa9vwKO4rr2sm868oSVcccxM+mQRGMxhzNDW61eZ7USjU9v8/SqJpT 6n3vXMnvLc901aVrRj4qEn6YQ9UjP6vEAuPFEwSeYPfCUwWQYT8qVw/Znpf0AmYFFot6 GRNkLaV0bGJmUXGh+cd+C6PeQ5pDXuh1GNUimr0TngUbpEMNgMOlL72QUFA5aFlu3Q79 0EA6ih6+GMwoNweIHjmpgJ8orYMI6jiCt7GYoxzX1WfuAudRJo1d9u5rKVRZKxsShXD7 srcDFBTnp1vnI0tEXi1S9kdDfhmDa3hJ9psWEBkFspy6z6IusWyb2U+TvXqOf/7fr1Ky g/sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=p8xsWZBBh3YiQHrDkSRUhqTgBxoQADc7FAOplPlnmxU=; b=jHcKGJAW4Kgh6++2CYwgabnTE6PzGdVfckspUMtwYu9oKxdrv0EQarmU8m1thlk3s9 JVqW3SG8GzALQc3qwtMmQv1vcfmKUNUTISzzHDjHLm1TkiFXw7HQ1fMMtGmPXM/sLJeB X75gnfNkxiWyHnFRzRWUPbmkkXkrlKSZ8DqWH6vPf0RY3cILmNUhAyGjoWDT/+utg6uz eF1ABuYmCPLERdmV64g3GnWmRs/BWhHCLdPkk8D7ZMv1Ey1iK6otYOBf5C6dcT1AjYxt 4oNkpaAuigy33dhHyUY7e+93BqTAiPl7cdM/65ZdfYDp0ZUgmapRTO8EeoOKvUAeKMyX oVBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 ns21si20919323ejb.272.2019.12.02.00.15.21; Mon, 02 Dec 2019 00:15:44 -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; 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 S1727326AbfLBIOZ (ORCPT + 99 others); Mon, 2 Dec 2019 03:14:25 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:44838 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726386AbfLBIOY (ORCPT ); Mon, 2 Dec 2019 03:14:24 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B119688A35CFBD2BA1F2; Mon, 2 Dec 2019 16:14:22 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Mon, 2 Dec 2019 16:14:13 +0800 From: "zhangyi (F)" To: CC: , , , , , , , , , , , Subject: [PATCH 4.4 7/7] fs/proc/array.c: allow reporting eip/esp for all coredumping threads Date: Mon, 2 Dec 2019 16:35:19 +0800 Message-ID: <20191202083519.23138-8-yi.zhang@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191202083519.23138-1-yi.zhang@huawei.com> References: <20191202083519.23138-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected 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) --- 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 42e33ea50d1c..6238f45eed02 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -434,7 +434,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 && (task->flags & (PF_EXITING|PF_DUMPCORE))) { if (try_get_task_stack(task)) { eip = KSTK_EIP(task); esp = KSTK_ESP(task); -- 2.17.2