lkml.org 
[lkml]   [2018]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] kernel/signal: Signal-based pre-coredump notification
From
Date
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 <enkechen@cisco.com>
>> ---
>> 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
>

\
 
 \ /
  Last update: 2018-10-15 20:16    [W:0.283 / U:2.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site