[lkml]   [2020]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[tip: timers/urgent] time/namespace: Add max_time_namespaces ucount
The following commit has been merged into the timers/urgent branch of tip:

Commit-ID: eeec26d5da8248ea4e240b8795bb4364213d3247
Author: Dmitry Safonov <>
AuthorDate: Mon, 06 Apr 2020 18:13:42 +01:00
Committer: Thomas Gleixner <>
CommitterDate: Tue, 07 Apr 2020 12:37:21 +02:00

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) <>
Signed-off-by: Dmitry Safonov <>
Signed-off-by: Thomas Gleixner <>
Acked-by: Andrei Vagin <>
Acked-by: Vincenzo Frascino <>

Documentation/admin-guide/sysctl/user.rst | 6 ++++++
kernel/ucount.c | 1 +
2 files changed, 7 insertions(+)

diff --git a/Documentation/admin-guide/sysctl/user.rst b/Documentation/admin-guide/sysctl/user.rst
index 650eaa0..c458245 100644
--- a/Documentation/admin-guide/sysctl/user.rst
+++ b/Documentation/admin-guide/sysctl/user.rst
@@ -65,6 +65,12 @@ max_pid_namespaces
The maximum number of pid namespaces that any user in the current
user namespace may create.

+ The maximum number of time namespaces that any user in the current
+ user namespace may create.

diff --git a/kernel/ucount.c b/kernel/ucount.c
index a53cc2b..29c60eb 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -69,6 +69,7 @@ static struct ctl_table user_table[] = {
+ UCOUNT_ENTRY("max_time_namespaces"),
 \ /
  Last update: 2020-04-07 12:42    [W:0.045 / U:30.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site