From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751280AbdEBR3D (ORCPT ); Tue, 2 May 2017 13:29:03 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:56550 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbdEBR3B (ORCPT ); Tue, 2 May 2017 13:29:01 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov Cc: Kirill Tkhai , serge@hallyn.com, agruenba@redhat.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, paul@paul-moore.com, viro@zeniv.linux.org.uk, avagin@openvz.org, linux-fsdevel@vger.kernel.org, mtk.manpages@gmail.com, akpm@linux-foundation.org, luto@amacapital.net, gorcunov@openvz.org, mingo@kernel.org, keescook@chromium.org References: <149245014695.17600.12640895883798122726.stgit@localhost.localdomain> <149245057248.17600.1341652606136269734.stgit@localhost.localdomain> <20170426155352.GA12131@redhat.com> <785e1986-da03-72aa-06c0-234ed2dbc0fd@virtuozzo.com> <20170427161255.GA19350@redhat.com> <20170427162254.GB19579@redhat.com> <43249645-f621-511e-dfa8-7bd78c547d2c@virtuozzo.com> <20170502163324.GA25036@redhat.com> Date: Tue, 02 May 2017 12:22:39 -0500 In-Reply-To: <20170502163324.GA25036@redhat.com> (Oleg Nesterov's message of "Tue, 2 May 2017 18:33:25 +0200") Message-ID: <87inljjhr4.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1d5bba-0004g4-IL;;;mid=<87inljjhr4.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.233.227;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18UcBvemKMQba55gfqfDJ3GTePfXL4IreA= X-SA-Exim-Connect-IP: 67.3.233.227 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa02 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 691 ms - load_scoreonly_sql: 3.0 (0.4%), signal_user_changed: 4.9 (0.7%), b_tie_ro: 2.8 (0.4%), parse: 1.99 (0.3%), extract_message_metadata: 6 (0.9%), get_uri_detail_list: 2.2 (0.3%), tests_pri_-1000: 10 (1.5%), tests_pri_-950: 2.9 (0.4%), tests_pri_-900: 2.3 (0.3%), tests_pri_-400: 37 (5.4%), check_bayes: 34 (5.0%), b_tokenize: 12 (1.7%), b_tok_get_all: 8 (1.2%), b_comp_prob: 4.4 (0.6%), b_tok_touch_all: 2.6 (0.4%), b_finish: 0.85 (0.1%), tests_pri_0: 550 (79.7%), check_dkim_signature: 1.50 (0.2%), check_dkim_adsp: 5 (0.7%), tests_pri_500: 44 (6.4%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 2/2] pid_ns: Introduce ioctl to set vector of ns_last_pid's on ns hierarhy X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov writes: > sorry for delay, vacation... > > On 04/28, Kirill Tkhai wrote: >> >> On 27.04.2017 19:22, Oleg Nesterov wrote: >> > >> > Ah, OK, I didn't notice the ns->child_reaper check in pidns_for_children_get(). >> > >> > But note that it doesn't need tasklist_lock too. >> >> Hm, are there possible strange situations with memory ordering, when we see >> ns->child_reaper of already died ns, which was placed in the same memory? >> Do we have to use some memory barriers here? > > Could you spell please? I don't understand your concerns... > > I don't see how, say, > > static struct ns_common *pidns_for_children_get(struct task_struct *task) > { > struct ns_common *ns = NULL; > struct pid_namespace *pid_ns; > > task_lock(task); > if (task->nsproxy) { > pid_ns = task->nsproxy->pid_ns_for_children; > if (pid_ns->child_reaper) { > ns = &pid_ns->ns; > get_pid_ns(ns); > } > } > task_unlock(task); > > return ns; > } > > can be wrong. It also looks more clean to me. > > ->child_reaper is not stable without tasklist, it can be dead/etc, but > we do not care? It breaks a number of assumptions if you can join a pid namespace before an init process is created in that pid namespace. Checking for child_reaper is a bit heavy handed but appears to ensure all of the assumptions of initial pid namespace creation have been met. Which means your simplified pidns_for_children_get is a bit insufficient. Eric