Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp48704imm; Tue, 16 Oct 2018 17:40:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV622VcDuwe1fwFTsCgRkJlWGYoNo5m1+bVJc+Bm2pDtPPulsmOTpneM/AOeTe+XlZE6TEDCL X-Received: by 2002:a62:1f03:: with SMTP id f3-v6mr24322550pff.168.1539736846769; Tue, 16 Oct 2018 17:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539736846; cv=none; d=google.com; s=arc-20160816; b=b8qXQcKdiitCaeiCciHCtQ8GyrMdPCxLmSAgKQUolAueAFsa3Izc58Fs8C5wng+nZx iDqQKW3J4mX+WScz8VvkfuepnnDBNtVTEZ80g1rlhERJO6I8b/lgZ3D5k9xkxl0DvgOP e+oAwWZWTC/sJbpxRt+UpQp10if31O6ogRNPc3wnvId1yx+p57daAHyM23q9b0QY52VP RHKw/4KhJo5yiVaUPxxXGcWEnNIJ8oOYMB7Jv+GQv59JAitoFr4QsDkysDfaztdbHd/g DqeKgr72IANdMo/mMcTPIE3y1e1iPiahvOAh8CFdzSC9BtZ7m5fyvaUrI8S+H4Jf9cZr Wq7w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=CzOKQ4vYBLII54A9goONIWn2l3H3JdA+2A8Hv38ZVyU=; b=fqQJP9OUiZXkxVoH+SSPghyUDsGVxi6DWzsPp3AOURC4tp+dvTfpR7QpD6n7TjT25k XJ6kuY8mbbMjX2xaRwk1KbJnXdc9Y4tgocxIjGlTLTfhE/M6vCXHdmGDOfouLOLqQunY P+v2wV7fccOGuwWA4wOGjhqh4W1zv0OPp6GWrNRXdvk6qO2K7WCPP75giXxJDPGKxXrk IZjw6XCXhwfHxoffeQD/+19F6USk4iVA1vW8FRNmybKXDjPgM8PuQTfhLOfOmgjPYQfz uFjbSMlRZ1p17B3DVU/zvZ0dLShlCpGyNRSJNoqmNSDQEza8HLYQtk38PGX6U4WCi9Zi TX8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=eVZfxckQ; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15-v6si15678058pgi.552.2018.10.16.17.40.29; Tue, 16 Oct 2018 17:40:46 -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=@cisco.com header.s=iport header.b=eVZfxckQ; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727449AbeJQIcz (ORCPT + 99 others); Wed, 17 Oct 2018 04:32:55 -0400 Received: from alln-iport-2.cisco.com ([173.37.142.89]:46104 "EHLO alln-iport-2.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727171AbeJQIcy (ORCPT ); Wed, 17 Oct 2018 04:32:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1480; q=dns/txt; s=iport; t=1539736792; x=1540946392; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=k+wpnzYASk9ONwkxPvmO8mxqNuCZGjxaCVVWWtG4COs=; b=eVZfxckQr1EnrYg9bLgixJTnRFPJQDlpy7hPwQ7qD/x0WVxHBTmqiRa2 4hSrO1pUNkjdMvFKMJQq1g3YWOKpSpoXeNoJwapgK5ZqBPTAjRUnk4PUa nnG12v/Ys9kmFaMpgJNcUwB3pNWB7Tk+UN0jITuc8iAdDyx/u/UnCBTjy 0=; X-IronPort-AV: E=Sophos;i="5.54,389,1534809600"; d="scan'208";a="187078699" Received: from alln-core-11.cisco.com ([173.36.13.133]) by alln-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2018 00:39:52 +0000 Received: from [10.154.208.185] ([10.154.208.185]) by alln-core-11.cisco.com (8.15.2/8.15.2) with ESMTP id w9H0dmJu004726; Wed, 17 Oct 2018 00:39:48 GMT Subject: Re: [PATCH] kernel/signal: Signal-based pre-coredump notification To: Oleg Nesterov Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Peter Zijlstra , Arnd Bergmann , "Eric W. Biederman" , Khalid Aziz , Kate Stewart , Helge Deller , Greg Kroah-Hartman , Al Viro , Andrew Morton , Christian Brauner , Catalin Marinas , Will Deacon , Dave Martin , Mauro Carvalho Chehab , Michal Hocko , Rik van Riel , "Kirill A. Shutemov" , Roman Gushchin , Marcos Paulo de Souza , Dominik Brodowski , Cyrill Gorcunov , Yang Shi , Jann Horn , Kees Cook , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, "Victor Kamensky (kamensky)" , xe-linux-external@cisco.com, Stefan Strogin , Eugene Syromiatnikov , Enke Chen References: <20181015120521.GA10146@redhat.com> <20398328-4ee1-96b2-5723-4b7eed55f0a2@cisco.com> <20181016141405.GA22045@redhat.com> From: Enke Chen Message-ID: Date: Tue, 16 Oct 2018 17:39:48 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181016141405.GA22045@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-SMTP-Client: 10.154.208.185, [10.154.208.185] X-Outbound-Node: alln-core-11.cisco.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Oleg: On 10/16/18 7:14 AM, Oleg Nesterov wrote: > On 10/15, Enke Chen wrote: >> >>> I don't understand why we need valid_predump_signal() at all. >> >> Most of the signals have well-defined semantics, and would not be appropriate >> for this purpose. > > you are going to change the rules anyway. > >> That is why it is limited to only SIGCHLD, SIGUSR1, SIGUSR2. > > Which do not queue. So the parent won't get the 2nd signal if 2 children > crash at the same time. > >>>> if (sig_kernel_coredump(signr)) { >>>> + /* >>>> + * Notify the parent prior to the coredump if the >>>> + * parent is interested in such a notificaiton. >>>> + */ >>>> + int p_sig = current->real_parent->predump_signal; >>>> + >>>> + if (valid_predump_signal(p_sig)) { >>>> + read_lock(&tasklist_lock); >>>> + do_notify_parent_predump(current); >>>> + read_unlock(&tasklist_lock); >>>> + cond_resched(); >>> >>> perhaps this should be called by do_coredump() after coredump_wait() kills >>> all the sub-threads? >> >> proc_coredump_connector(current) is located here, they should stay together. > > Why? > > Once again, other threads are still alive. So if the parent restarts the service > after it recieves -predump_signal, the new process can "race" with the old thread. Yes, it is a good idea to do the signal notification in do_coredump() after coredump_wait(). Will make the change as suggested. Thanks. -- Enke