Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3894022imd; Mon, 29 Oct 2018 14:09:36 -0700 (PDT) X-Google-Smtp-Source: AJdET5dk2iN7+UITLvddDI0H5a8YX1rbj1WFeGdC6eQA4JRRFroWp9ZDbNS6DukswXo9YvjYOYb5 X-Received: by 2002:a17:902:6b0a:: with SMTP id o10-v6mr15870214plk.208.1540847376834; Mon, 29 Oct 2018 14:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540847376; cv=none; d=google.com; s=arc-20160816; b=wNvhwl44N8RHqVX6HISIVt3OSbEHBt6fUc4trRJimmWguFKFgWpZttBWat7pvZPReM 3bbq6yGIAqeaG7f5DMLEN6Uh1WFD4uZ4Skv5litioKLWPczRmXKljY31AbcsFMP4VFrB ZuNGAjcKHKVSKcnJr5ryAXaw+b6jlTKqVdqSNS6yQaSOhn3j3UbFVGrfUK0hNQiI/mjp 3WLFRUnJ7jCpHlcm9g7b2JuRWwWy7NlAnN5vst/KXksatLFy/DnMg0LF2bkjbjcyBZgO NOi6O8Ku1cOYWzi+h+t+iQhhdmGSVFRVoh7N+xHPQkQz0IYNHodguFDCy/mx+PVb2dt3 SHHQ== 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=E5p7rhFdFVCsMBBLSrxRM7RdtAJje5RsP3i9vUMzYIc=; b=ohBX+i8mfon5MLhNZLcCmVrvS0fLGsxHGMjO1QSBHmiLoyShYWYaKb6O6jII+gRdRm EoWB8YiaCq3AEXy5+AxuSr35gK36T+X9l6iAEmNWaL90HzWsFeAgoYxdVb+GzyXYNkbi waSwmJ0lwGTupC1lcwQw6vd30besCdHFRE0u9udJ1jG9Xm1KEpB5FkI1Hd9l1GesAkik PIJQJ1RKqY2Acg/Z/SGihp4oKLftmQQa48flTybawHncflMAds434OPOFiaZ6Ow1wF5F uPVQSXvg1WqrDarptUpCFB2TeBfHMkko2gySb3ApcXlD9c8dXZ9CAPfLp3KtJAHZr2+6 C2rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=lQqP848S; 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 r75-v6si19005563pgr.429.2018.10.29.14.09.20; Mon, 29 Oct 2018 14:09:36 -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=lQqP848S; 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 S1727162AbeJ3F7D (ORCPT + 99 others); Tue, 30 Oct 2018 01:59:03 -0400 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1386; q=dns/txt; s=iport; t=1540847318; x=1542056918; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=P/xNm11nZw5q8XfeLANKDgWh2u4RRx89z45zxgwCwr0=; b=lQqP848SjkptHglgLK7E7VummqBioBpI+0zFA3YhTTL/wUHMTgej2ui8 Dqt5BRGUwoCqvrk3yGQEDQKO7Xvp0BgJ3r5ugXWFyIsQpDCdmWwGIkXYE +ZzkbTu98enAxhpXBScQLVOcKid++60YBK/NbSigHAEi7+gMxxfZTKYBp A=; X-IronPort-AV: E=Sophos;i="5.54,441,1534809600"; d="scan'208";a="471041775" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by rcdn-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2018 21:08:37 +0000 Received: from [10.154.208.144] ([10.154.208.144]) by rcdn-core-11.cisco.com (8.15.2/8.15.2) with ESMTP id w9TL8ZqX015061; Mon, 29 Oct 2018 21:08:36 GMT Subject: Re: [PATCH v4] kernel/signal: Signal-based pre-coredump notification 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 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 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: <20181029111804.GA24820@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.144, [10.154.208.144] X-Outbound-Node: rcdn-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: 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. >