From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751329AbdAWQw2 (ORCPT ); Mon, 23 Jan 2017 11:52:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42464 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbdAWQw1 (ORCPT ); Mon, 23 Jan 2017 11:52:27 -0500 Date: Mon, 23 Jan 2017 17:44:20 +0100 From: Oleg Nesterov To: Pavel Tikhomirov , "Eric W. Biederman" , Lennart Poettering , Kay Sievers Cc: Ingo Molnar , Peter Zijlstra , Andrew Morton , Cyrill Gorcunov , John Stultz , Thomas Gleixner , Nicolas Pitre , Michal Hocko , Stanislav Kinsburskiy , Mateusz Guzik , linux-kernel@vger.kernel.org, Pavel Emelyanov , Konstantin Khorenko Subject: setns() && PR_SET_CHILD_SUBREAPER Message-ID: <20170123164420.GA2145@redhat.com> References: <20170119164346.4214-1-ptikhomirov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170119164346.4214-1-ptikhomirov@virtuozzo.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 23 Jan 2017 16:44:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org And this discussion reminds me again that I do not understand how setns() and PR_SET_CHILD_SUBREAPER should play together... Add cc's. Suppose we have a process P in the root namespace and another namespace X. P does setns() and enters the X namespace. P forks a child C. C forks a grandchild G. C exits. The question is, where should we reparent the grandchild G? In the normal case it will be reparented to X->child_reaper and this looks correct. But lets suppose that P runs with the ->has_child_subreaper bit set. In this case it will be reparented to P's sub-reaper or a global init, and given that P can't control its ->has_child_subreaper flag this does not look right to me. I can make a simple patch but perhaps I missed something or we actually want this (imo strange) behaviour? Oleg.