Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3C50C433FE for ; Mon, 22 Nov 2021 15:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238593AbhKVPFl (ORCPT ); Mon, 22 Nov 2021 10:05:41 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:38428 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbhKVPFh (ORCPT ); Mon, 22 Nov 2021 10:05:37 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]:51368) by out01.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mpApw-002FBc-Ru; Mon, 22 Nov 2021 08:02:28 -0700 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95]:52422 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mpApu-00ChBL-Jd; Mon, 22 Nov 2021 08:02:28 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Vladimir Divjak Cc: , , , , , In-Reply-To: <20211122005347.1467288-1-vladimir.divjak@bmw.de> (Vladimir Divjak's message of "Mon, 22 Nov 2021 01:53:47 +0100") References: <20211122005347.1467288-1-vladimir.divjak@bmw.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Date: Mon, 22 Nov 2021 09:02:15 -0600 Message-ID: <875ysknsi0.fsf@email.froward.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1mpApu-00ChBL-Jd;;;mid=<875ysknsi0.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+YS9+H3cN9mVA3trJJZMYtEKpoB6QI+KQ= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH] ptrace: exit: re-trigger PTRACE_EVENT_EXIT after coredump finished X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vladimir Divjak writes: > Re-trigger PTRACE_EVENT_EXIT > (if one is requested with PTRACE_SEIZE setting PTRACE_O_TRACEEXIT option) > for a process being core-dumped, after the coredump is finished. > > This enables a potential tracer - coredump user mode helper > (or any other tracer started after the coredump was initiated) > to receive the PTRACE_EVENT_EXIT for all threads of the crashing process. > > Rationale: > > For zapped threads, PTRACE_EVENT_EXIT is triggered early during do_exit(), > before the point at which they sleep, waiting for > coredump to finish - in exit_mm(), and before a potential > coredump user mode helper process is launched. > > That makes it impossible for the coredump user mode helper process to > receive PTRACE_EVENT_EXIT events for all threads of the crashing process, > except for the thread handling the core-dump, which will trigger > the PTRACE_EVENT_EXIT after the coredump has been finished. Please test the latest kernel. The coredump now stops much earlier than exit_mm, and PTRACE_EVENT_EXIT is after the point the coredump stops. If you need this functionality on older kernels it should be possible to backport a subset of my changes without too much trouble Eric