| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - * This program is free software; you can redistribute it and/or |
|---|
| 3 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 4 | | - * published by the Free Software Foundation, version 2 of the |
|---|
| 5 | | - * License. |
|---|
| 6 | | - */ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 7 | 2 | |
|---|
| 8 | 3 | #include <linux/stat.h> |
|---|
| 9 | 4 | #include <linux/sysctl.h> |
|---|
| .. | .. |
|---|
| 57 | 52 | .permissions = set_permissions, |
|---|
| 58 | 53 | }; |
|---|
| 59 | 54 | |
|---|
| 60 | | -static int zero = 0; |
|---|
| 61 | | -static int int_max = INT_MAX; |
|---|
| 62 | 55 | #define UCOUNT_ENTRY(name) \ |
|---|
| 63 | 56 | { \ |
|---|
| 64 | 57 | .procname = name, \ |
|---|
| 65 | 58 | .maxlen = sizeof(int), \ |
|---|
| 66 | 59 | .mode = 0644, \ |
|---|
| 67 | 60 | .proc_handler = proc_dointvec_minmax, \ |
|---|
| 68 | | - .extra1 = &zero, \ |
|---|
| 69 | | - .extra2 = &int_max, \ |
|---|
| 61 | + .extra1 = SYSCTL_ZERO, \ |
|---|
| 62 | + .extra2 = SYSCTL_INT_MAX, \ |
|---|
| 70 | 63 | } |
|---|
| 71 | 64 | static struct ctl_table user_table[] = { |
|---|
| 72 | 65 | UCOUNT_ENTRY("max_user_namespaces"), |
|---|
| .. | .. |
|---|
| 76 | 69 | UCOUNT_ENTRY("max_net_namespaces"), |
|---|
| 77 | 70 | UCOUNT_ENTRY("max_mnt_namespaces"), |
|---|
| 78 | 71 | UCOUNT_ENTRY("max_cgroup_namespaces"), |
|---|
| 72 | + UCOUNT_ENTRY("max_time_namespaces"), |
|---|
| 79 | 73 | #ifdef CONFIG_INOTIFY_USER |
|---|
| 80 | 74 | UCOUNT_ENTRY("max_inotify_instances"), |
|---|
| 81 | 75 | UCOUNT_ENTRY("max_inotify_watches"), |
|---|
| .. | .. |
|---|
| 88 | 82 | { |
|---|
| 89 | 83 | #ifdef CONFIG_SYSCTL |
|---|
| 90 | 84 | struct ctl_table *tbl; |
|---|
| 85 | + |
|---|
| 86 | + BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1); |
|---|
| 91 | 87 | setup_sysctl_set(&ns->set, &set_root, set_is_seen); |
|---|
| 92 | 88 | tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL); |
|---|
| 93 | 89 | if (tbl) { |
|---|