Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4239046imm; Mon, 15 Oct 2018 11:17:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV624jjGmv+vvvUYIjs3ui9OeHyLTEBkdl4lkBtGjgHiOV8NFbZVbLQM+f1e15IsXpFZ/XSvC X-Received: by 2002:a17:902:7c11:: with SMTP id x17-v6mr17290421pll.1.1539627442369; Mon, 15 Oct 2018 11:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539627442; cv=none; d=google.com; s=arc-20160816; b=k3vNgrQOUBZ0bUo3iw47tM1QE6aPXSc41l49OrlfJ1UUiM9U9hO25g8uO1uO8mDI8q Zn1ce2UEfS/b9kzXnIf3B3qgRiV2V16K3rReuanpo59uUGU8AFvn2x/H0ZZcOppUl8Hl qSxd9oHqmuFP/Mhye7vPVRRyJCXfMsHnowJLpltcPYDzfNC633mupu+01TIgXL0JA3Ah jWn/y3BC0UbmhnpTAZW6JUrtLa2MUaHYLfnD+YRLSsYXuO4mZMt4C9iAnBP4VyLbU9F6 Mk919bZsB25HB8uPuiTJpQoGITxdA0UG6xHXX65glAhZrJT1Z/IkA3ogjTLqAaOW3nIn IYCg== 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=3T5GY32JwfWoeZ+2yzMWKeiJ05fEuxuz97fvjjoiDwo=; b=jWwp/Ri7G3z4yNxL4ENAQ7oabDE9X43SpEJ5ATY9HP7YzwASy0MKxFLXRMZu+JEKha P/IVN7qgyvbNnvKXFm5OgybGOV6HdtUQCc/Qhwuyji1tKBnDDP3LIOscTAJJOKvM2aIi 5RkcZXWKZfsCinM+zEzSOfl1nWWrednpC1DzHznyObNmqKoMuN1Zy4hgd0GaZVEirWp0 h0Wfi+Pwty1rNd1mVirQERHhMk4P+W7AH+ZkVmHGa2ubWHdcoy2q+4oJPwZixa6IyIgu tGTnpe82eotfeaJFm+yfy9G2WU5WezV5HG2CeNhFxuqkj7S7z+T2Onao9O1K+iMhYdsH g7MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=Ys0cKFhr; 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 f1-v6si6129731pld.49.2018.10.15.11.17.04; Mon, 15 Oct 2018 11:17:22 -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=Ys0cKFhr; 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 S1726849AbeJPCDC (ORCPT + 99 others); Mon, 15 Oct 2018 22:03:02 -0400 Received: from alln-iport-5.cisco.com ([173.37.142.92]:9115 "EHLO alln-iport-5.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726704AbeJPCDC (ORCPT ); Mon, 15 Oct 2018 22:03:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3381; q=dns/txt; s=iport; t=1539627401; x=1540837001; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=3VyR/4dAXHv7RqKXiqhrTdYn7PXBE5hOvQG7GeJZHrI=; b=Ys0cKFhrjxYur9HuccFJbTRyKSVXTU1KMBe7pflU8JrI0UYE405v3eP9 drps2TBl1gJg46kaSoKPcnpGXP+NOpmuorWHf24dQOj4CZn3ao4QxDPJz xqOArjOL8kfLW3cX0jtGErmDCHn7GfcYFC2/6OjdKZC2OYJJ9NWrnTj6L M=; X-IronPort-AV: E=Sophos;i="5.54,385,1534809600"; d="scan'208";a="185684398" Received: from alln-core-10.cisco.com ([173.36.13.132]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2018 18:16:40 +0000 Received: from [10.154.208.167] ([10.154.208.167]) by alln-core-10.cisco.com (8.15.2/8.15.2) with ESMTP id w9FIGbt9018701; Mon, 15 Oct 2018 18:16:37 GMT Subject: Re: [PATCH] kernel/signal: Signal-based pre-coredump notification To: Greg Kroah-Hartman 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 , 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 , Oleg Nesterov , 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 , Enke Chen References: <20181013064023.GA28177@kroah.com> From: Enke Chen Message-ID: <37401cea-5a37-2cd9-8595-8b07dfc4de7d@cisco.com> Date: Mon, 15 Oct 2018 11:16:36 -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: <20181013064023.GA28177@kroah.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.167, [10.154.208.167] X-Outbound-Node: alln-core-10.cisco.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Greg: > Shouldn't there also be a manpage update, and a kselftest added for this > new user/kernel api that is being created? > I will submit a patch for manpage update once the code is accepted. Regarding the kselftest, I am not sure. Once the prctl() is limited to self (which I will do), the logic would be pretty straightforward. Not sure if the selftest would add much value. Thanks. -- Enke On 10/12/18 11:40 PM, Greg Kroah-Hartman wrote: > On Fri, Oct 12, 2018 at 05:33:35PM -0700, Enke Chen wrote: >> For simplicity and consistency, this patch provides an implementation >> for signal-based fault notification prior to the coredump of a child >> process. A new prctl command, PR_SET_PREDUMP_SIG, is defined that can >> be used by an application to express its interest and to specify the >> signal (SIGCHLD or SIGUSR1 or SIGUSR2) for such a notification. A new >> signal code (si_code), CLD_PREDUMP, is also defined for SIGCHLD. >> >> Background: >> >> As the coredump of a process may take time, in certain time-sensitive >> applications it is necessary for a parent process (e.g., a process >> manager) to be notified of a child's imminent death before the coredump >> so that the parent process can act sooner, such as re-spawning an >> application process, or initiating a control-plane fail-over. >> >> Currently there are two ways for a parent process to be notified of a >> child process's state change. One is to use the POSIX signal, and >> another is to use the kernel connector module. The specific events and >> actions are summarized as follows: >> >> Process Event POSIX Signal Connector-based >> ---------------------------------------------------------------------- >> ptrace_attach() do_notify_parent_cldstop() proc_ptrace_connector() >> SIGCHLD / CLD_STOPPED >> >> ptrace_detach() do_notify_parent_cldstop() proc_ptrace_connector() >> SIGCHLD / CLD_CONTINUED >> >> pre_coredump/ N/A proc_coredump_connector() >> get_signal() >> >> post_coredump/ do_notify_parent() proc_exit_connector() >> do_exit() SIGCHLD / exit_signal >> ---------------------------------------------------------------------- >> >> As shown in the table, the signal-based pre-coredump notification is not >> currently available. In some cases using a connector-based notification >> can be quite complicated (e.g., when a process manager is written in shell >> scripts and thus is subject to certain inherent limitations), and a >> signal-based notification would be simpler and better suited. >> >> Signed-off-by: Enke Chen >> --- >> arch/x86/kernel/signal_compat.c | 2 +- >> include/linux/sched.h | 4 ++ >> include/linux/signal.h | 5 +++ >> include/uapi/asm-generic/siginfo.h | 3 +- >> include/uapi/linux/prctl.h | 4 ++ >> kernel/fork.c | 1 + >> kernel/signal.c | 51 +++++++++++++++++++++++++ >> kernel/sys.c | 77 ++++++++++++++++++++++++++++++++++++++ >> 8 files changed, 145 insertions(+), 2 deletions(-) > > Shouldn't there also be a manpage update, and a kselftest added for this > new user/kernel api that is being created? > > thanks, > > greg k-h >