Skip to content

Commit eeec26d

Browse files
0x7f454c46KAGA-KOKO
authored andcommitted
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: 769071a ("ns: Introduce Time Namespace") Reported-by: Michael Kerrisk (man-pages) <[email protected]> Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Andrei Vagin <[email protected]> Acked-by: Vincenzo Frascino <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent b801f1e commit eeec26d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Documentation/admin-guide/sysctl/user.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ max_pid_namespaces
6565
The maximum number of pid namespaces that any user in the current
6666
user namespace may create.
6767

68+
max_time_namespaces
69+
===================
70+
71+
The maximum number of time namespaces that any user in the current
72+
user namespace may create.
73+
6874
max_user_namespaces
6975
===================
7076

kernel/ucount.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static struct ctl_table user_table[] = {
6969
UCOUNT_ENTRY("max_net_namespaces"),
7070
UCOUNT_ENTRY("max_mnt_namespaces"),
7171
UCOUNT_ENTRY("max_cgroup_namespaces"),
72+
UCOUNT_ENTRY("max_time_namespaces"),
7273
#ifdef CONFIG_INOTIFY_USER
7374
UCOUNT_ENTRY("max_inotify_instances"),
7475
UCOUNT_ENTRY("max_inotify_watches"),

0 commit comments

Comments
 (0)