From mboxrd@z Thu Jan 1 00:00:00 1970 From: Enke Chen Subject: Re: [PATCH v4] kernel/signal: Signal-based pre-coredump notification Date: Mon, 29 Oct 2018 14:08:34 -0700 Message-ID: <634f9518-c742-16f0-84f4-90943af6aed2@cisco.com> References: <458c04d8-d189-4a26-729a-bb1d1d751534@cisco.com> <7741efa7-a3f8-62a1-ba52-613883164643@cisco.com> <84460a77-a111-404e-4bad-88104a6e246e@cisco.com> <20181026082812.GA10581@redhat.com> <21f678a8-4001-df36-c26e-e96cf203b1b1@cisco.com> <20181029111804.GA24820@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20181029111804.GA24820@redhat.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Oleg Nesterov Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , 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 List-Id: linux-arch.vger.kernel.org Hi, Oleg: Yes, it should be the "real_parent" that is more interested in the notification. Will revert back. +static void do_notify_parent_predump(void) +{ + struct task_struct *parent; + int sig; + + rcu_read_lock(); + parent = rcu_dereference(current->real_parent); + sig = parent->signal->predump_signal; + if (sig != 0) + do_send_sig_info(sig, SEND_SIG_NOINFO, parent, PIDTYPE_TGID); + rcu_read_unlock(); +} Thanks. -- Enke On 10/29/18 4:18 AM, Oleg Nesterov wrote: > Hi, > > On 10/26, Enke Chen wrote: >> >> This is really a good idea given that "parent" is declared as RCU-protected. >> Just a bit odd, though, that the "parent" has not been accessed this way in >> the code base. > > It is acccessed when possible, > >> So just to confirm: the revised code would look like the following: >> >> static void do_notify_parent_predump(void) >> { >> struct task_struct *parent; >> int sig; >> >> rcu_read_lock(); >> parent = rcu_dereference(current->parent); >> sig = parent->signal->predump_signal; >> if (sig != 0) >> do_send_sig_info(sig, SEND_SIG_NOINFO, parent, PIDTYPE_TGID); >> rcu_read_unlock(); >> } > > Yes, this is what I meant. > > But I still think do_notify_parent_predump() should notify ->real_parent, > not ->parent. > > Oleg. > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-8.cisco.com ([173.37.86.79]:34161 "EHLO rcdn-iport-8.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726016AbeJ3F7D (ORCPT ); Tue, 30 Oct 2018 01:59:03 -0400 Subject: Re: [PATCH v4] kernel/signal: Signal-based pre-coredump notification References: <458c04d8-d189-4a26-729a-bb1d1d751534@cisco.com> <7741efa7-a3f8-62a1-ba52-613883164643@cisco.com> <84460a77-a111-404e-4bad-88104a6e246e@cisco.com> <20181026082812.GA10581@redhat.com> <21f678a8-4001-df36-c26e-e96cf203b1b1@cisco.com> <20181029111804.GA24820@redhat.com> From: Enke Chen Message-ID: <634f9518-c742-16f0-84f4-90943af6aed2@cisco.com> Date: Mon, 29 Oct 2018 14:08:34 -0700 MIME-Version: 1.0 In-Reply-To: <20181029111804.GA24820@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Oleg Nesterov Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , 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 , x86@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, "Victor Kamensky (kamensky)" , xe-linux-external@cisco.com, Stefan Strogin , Enke Chen Message-ID: <20181029210834.CA7ziDplS1WS0bp0LZMjKuGFNXn9gh2PKIMQvXtIZbw@z> Hi, Oleg: Yes, it should be the "real_parent" that is more interested in the notification. Will revert back. +static void do_notify_parent_predump(void) +{ + struct task_struct *parent; + int sig; + + rcu_read_lock(); + parent = rcu_dereference(current->real_parent); + sig = parent->signal->predump_signal; + if (sig != 0) + do_send_sig_info(sig, SEND_SIG_NOINFO, parent, PIDTYPE_TGID); + rcu_read_unlock(); +} Thanks. -- Enke On 10/29/18 4:18 AM, Oleg Nesterov wrote: > Hi, > > On 10/26, Enke Chen wrote: >> >> This is really a good idea given that "parent" is declared as RCU-protected. >> Just a bit odd, though, that the "parent" has not been accessed this way in >> the code base. > > It is acccessed when possible, > >> So just to confirm: the revised code would look like the following: >> >> static void do_notify_parent_predump(void) >> { >> struct task_struct *parent; >> int sig; >> >> rcu_read_lock(); >> parent = rcu_dereference(current->parent); >> sig = parent->signal->predump_signal; >> if (sig != 0) >> do_send_sig_info(sig, SEND_SIG_NOINFO, parent, PIDTYPE_TGID); >> rcu_read_unlock(); >> } > > Yes, this is what I meant. > > But I still think do_notify_parent_predump() should notify ->real_parent, > not ->parent. > > Oleg. >