Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3056745ybi; Tue, 2 Jul 2019 01:17:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqznn+DhC4zw1goRn8gVyLZ/DZulE+sysXreDzmcj639T7scOwhTern5vEbm4ymlxBK6GJyv X-Received: by 2002:a17:902:2f84:: with SMTP id t4mr34394245plb.57.1562055428340; Tue, 02 Jul 2019 01:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055428; cv=none; d=google.com; s=arc-20160816; b=S+uEcxYWN/4V7Kt+Lg1sBXwrAN2Gz66+OTJ2YJHwouuy2StayBViVe7KTF9ks5lHuJ QDOOtklxfQ14zfjc0gSfRinTL5GtKyoKEtftvhqdVYomo4u0OANkk1Umb72HQh3SNfVG ODRmvUFqkNWfA+osZGtnjG51MJVMK3xSa/XYvYy1V6DTKak4M+RSQn/3xth7dXKowknH rWVp5wBawTGaYkUv2qBCmzKcUUf0TpHHi8JEQ6YhKZoBuMtG8nowyYg8xfsAWxAGm5kO 0JFWzHNySYTLh72clE8sYsgS/HJliStAf5m+faN2PX+6TnwPg12+DN6JEHNrCZZDzc7A +GUw== 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=41f+bhaRcamJna2CIk/yz3TKonrGkahPmCgQ8BXwg9g=; b=hMl5nGb31DcvfWmHK2BWXYHcKGKyVmB1a9Ym/Ufg/PV4F5K7zyrnNjRnCeGPMPLQt0 HOLd/sX6ZQDzJuUtrGuv8lmKZEKRHFY6Gjf273IHgElYl5AqGtXn0C94LN2hLf3Xv4aq lEXo4Mxu5Goib79tQxXW5kseOfMJerTw9o6VoRmpxcY9/3RzVKwjFtpL0wgYJlCUOhv7 gXl2qcTeRKUI10K5ybK2bHMI0tflsma437+xw9qAcep9Mmb77lyRDFdhhzvxQyxaM4Mi sW7DiaAg1jvoHG5EcT7yQ9T1B4r2sO1X3Nl9mveQ2Qz7W2d6XbvIFslkmJV/AKTe3O3r hONw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eK+Ypg5I; 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 q10si1764721pjq.46.2019.07.02.01.16.53; Tue, 02 Jul 2019 01:17:08 -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=eK+Ypg5I; 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 S1726434AbfGBIDs (ORCPT + 99 others); Tue, 2 Jul 2019 04:03:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:48934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727521AbfGBIDq (ORCPT ); Tue, 2 Jul 2019 04:03:46 -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 478A721479; Tue, 2 Jul 2019 08:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054625; bh=pgr4lMIt6R9jlG/y2bAE8ZAcSMfZIODCILhoxOWYumg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eK+Ypg5I+JgEWy/OP46iZPqrlPF4vXiMSMHNc/OWUjqGSrkx6RGSSYdFqOWYBMcc6 T7vC6c662ZmFm2GkVBIgd/VL0WR/vSE9nNi9ZYhxUCz+mSYjo3TjV7k9CB4SAd6UFc Z7YsEViTgok18bsl2+f1mjN4TVB76iRiR8XJYXEU= 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 5.1 04/55] fs/proc/array.c: allow reporting eip/esp for all coredumping threads Date: Tue, 2 Jul 2019 10:01:12 +0200 Message-Id: <20190702080124.301015287@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080124.103022729@linuxfoundation.org> References: <20190702080124.103022729@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 @@ -462,7 +462,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);