Skip to content

Commit 0785249

Browse files
committed
Merge tag 'timers-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull time(keeping) updates from Thomas Gleixner: - Fix the time_for_children symlink in /proc/$PID/ so it properly reflects that it part of the 'time' namespace - Add the missing userns limit for the allowed number of time namespaces, which was half defined but the actual array member was not added. This went unnoticed as the array has an exessive empty member at the end but introduced a user visible regression as the output was corrupted. - Prevent further silent ucount corruption by adding a BUILD_BUG_ON() to catch half updated data. * tag 'timers-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: ucount: Make sure ucounts in /proc/sys/user don't regress again time/namespace: Add max_time_namespaces ucount time/namespace: Fix time_for_children symlink
2 parents 590680d + 0f538e3 commit 0785249

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-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/time/namespace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ const struct proc_ns_operations timens_operations = {
447447

448448
const struct proc_ns_operations timens_for_children_operations = {
449449
.name = "time_for_children",
450+
.real_ns_name = "time",
450451
.type = CLONE_NEWTIME,
451452
.get = timens_for_children_get,
452453
.put = timens_put,

kernel/ucount.c

Lines changed: 3 additions & 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"),
@@ -81,6 +82,8 @@ bool setup_userns_sysctls(struct user_namespace *ns)
8182
{
8283
#ifdef CONFIG_SYSCTL
8384
struct ctl_table *tbl;
85+
86+
BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1);
8487
setup_sysctl_set(&ns->set, &set_root, set_is_seen);
8588
tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL);
8689
if (tbl) {

0 commit comments

Comments
 (0)