From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Safonov <0x7f454c46@gmail.com> Subject: Re: [PATCHv5 01/37] ns: Introduce Time Namespace Date: Fri, 2 Aug 2019 00:46:39 +0100 Message-ID: <4d8d8489-28c8-259f-23a9-ed2b89699b73@gmail.com> References: <20190729215758.28405-1-dima@arista.com> <20190729215758.28405-2-dima@arista.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Andy Lutomirski , Dmitry Safonov Cc: LKML , Andrei Vagin , Adrian Reber , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , Vincenzo Frascino , Linux Containers , criu@openvz.org, Linux API , X86 ML List-Id: linux-api@vger.kernel.org Hi Andy, Thank you for the review, On 8/1/19 6:29 AM, Andy Lutomirski wrote: > On Mon, Jul 29, 2019 at 2:58 PM Dmitry Safonov wrote: >> >> From: Andrei Vagin >> >> Time Namespace isolates clock values. > >> +static int timens_install(struct nsproxy *nsproxy, struct ns_common *new) >> +{ >> + struct time_namespace *ns = to_time_ns(new); >> + >> + if (!thread_group_empty(current)) >> + return -EINVAL; > > You also need to check for other users of the mm. Oops. It seems like, if the check was if (!current_is_single_threaded()) return -EUSERS; instead of thread_group_empty(current), it would address the concerns from 23/37 and 25/37 patches, too? > >> + >> + if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || >> + !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) >> + return -EPERM; >> + >> + get_time_ns(ns); >> + get_time_ns(ns); >> + put_time_ns(nsproxy->time_ns); >> + put_time_ns(nsproxy->time_ns_for_children); >> + nsproxy->time_ns = ns; >> + nsproxy->time_ns_for_children = ns; >> + ns->initialized = true; > > I really really wish that setns() took an explicit flag for "change > now" or "change for children", since the semantics are different. Oh > well. > Thanks, Dmitry