Re: [PATCHv5 01/37] ns: Introduce Time Namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 29, 2019 at 2:58 PM Dmitry Safonov <dima@xxxxxxxxxx> wrote:
>
> From: Andrei Vagin <avagin@xxxxxxxxxx>
>
> 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.

> +
> +       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.
_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/containers



[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux