OSDN Git Service

time/namespace: Add max_time_namespaces ucount
authorDmitry Safonov <dima@arista.com>
Mon, 6 Apr 2020 17:13:42 +0000 (18:13 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 7 Apr 2020 10:37:21 +0000 (12:37 +0200)
commiteeec26d5da8248ea4e240b8795bb4364213d3247
tree2e1aef9815026c6d771813a7216a531c8cba33cd
parentb801f1e22c23c259d6a2c955efddd20370de19a6
time/namespace: Add max_time_namespaces ucount

Michael noticed that userns limit for number of time namespaces is missing.

Furthermore, time namespace introduced UCOUNT_TIME_NAMESPACES, but didn't
introduce an array member in user_table[]. It would make array's
initialisation OOB write, but by luck the user_table array has an excessive
empty member (all accesses to the array are limited with UCOUNT_COUNTS - so
it silently reuses the last free member.

Fixes user-visible regression: max_inotify_instances by reason of the
missing UCOUNT_ENTRY() has limited max number of namespaces instead of the
number of inotify instances.

Fixes: 769071ac9f20 ("ns: Introduce Time Namespace")
Reported-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andrei Vagin <avagin@gmail.com>
Acked-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: stable@kernel.org
Link: https://lkml.kernel.org/r/20200406171342.128733-1-dima@arista.com
Documentation/admin-guide/sysctl/user.rst
kernel/ucount.c