Hi, Oleg: On 10/24/18 7:02 AM, Oleg Nesterov wrote: > On 10/23, Enke Chen wrote: >> >> --- a/fs/coredump.c >> +++ b/fs/coredump.c >> @@ -590,6 +590,12 @@ void do_coredump(const kernel_siginfo_t *siginfo) >> if (retval < 0) >> goto fail_creds; >> >> + /* >> + * Send the pre-coredump signal to the parent if requested. >> + */ >> + do_notify_parent_predump(); >> + cond_resched(); > > I am still not sure cond_resched() makes any sense here... > >> @@ -1553,6 +1553,9 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) >> tty_audit_fork(sig); >> sched_autogroup_fork(sig); >> >> + /* Clear the pre-coredump signal for the child */ >> + sig->predump_signal = 0; > > No need, copy_signal() does zalloc(). > Removed. > >> +void do_notify_parent_predump(void) >> +{ >> + struct sighand_struct *sighand; >> + struct kernel_siginfo info; >> + struct task_struct *parent; >> + unsigned long flags; >> + int sig; >> + >> + read_lock(&tasklist_lock); >> + parent = current->parent; >> + sig = parent->signal->predump_signal; >> + if (sig != 0) { >> + clear_siginfo(&info); >> + info.si_pid = task_tgid_vnr(current); >> + info.si_signo = sig; >> + if (sig == SIGCHLD) >> + info.si_code = CLD_PREDUMP; >> + >> + sighand = parent->sighand; >> + spin_lock_irqsave(&sighand->siglock, flags); >> + __group_send_sig_info(sig, &info, parent); >> + spin_unlock_irqrestore(&sighand->siglock, flags); > > You can just use do_send_sig_info() and remove sighand/flags/spin_lock_irqsave. Ok. > > Perhaps the "likely" predump_signal==0 check at the start makes sense to avoid > read_lock(tasklist). I am not sure if we should/need to deviate from the convention (locking before access the parent). In any case it may not matter as the coredump is in the exceptional code flow. > > And I'd suggest to move it into coredump.c and make it static. It won't have > another user. Ok. Thanks. -- Enke