Skip to content

Commit 25ebbce

Browse files
committed
kernel/sys.c: Move overflow{uid,gid} sysctl into kernel/sys.c
Moved ctl_tables elements for overflowuid and overflowgid into in kernel/sys.c. Create a register function that keeps them under "kernel" and run it after core with postcore_initcall. This is part of a greater effort to move ctl tables into their respective subsystems which will reduce the merge conflicts in kernel/sysctl.c. Signed-off-by: Joel Granados <[email protected]>
1 parent 88eddb0 commit 25ebbce

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

kernel/sys.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,36 @@ int fs_overflowgid = DEFAULT_FS_OVERFLOWGID;
181181
EXPORT_SYMBOL(fs_overflowuid);
182182
EXPORT_SYMBOL(fs_overflowgid);
183183

184+
static const struct ctl_table overflow_sysctl_table[] = {
185+
{
186+
.procname = "overflowuid",
187+
.data = &overflowuid,
188+
.maxlen = sizeof(int),
189+
.mode = 0644,
190+
.proc_handler = proc_dointvec_minmax,
191+
.extra1 = SYSCTL_ZERO,
192+
.extra2 = SYSCTL_MAXOLDUID,
193+
},
194+
{
195+
.procname = "overflowgid",
196+
.data = &overflowgid,
197+
.maxlen = sizeof(int),
198+
.mode = 0644,
199+
.proc_handler = proc_dointvec_minmax,
200+
.extra1 = SYSCTL_ZERO,
201+
.extra2 = SYSCTL_MAXOLDUID,
202+
},
203+
};
204+
205+
static int __init init_overflow_sysctl(void)
206+
{
207+
register_sysctl_init("kernel", overflow_sysctl_table);
208+
return 0;
209+
}
210+
211+
postcore_initcall(init_overflow_sysctl);
212+
213+
184214
/*
185215
* Returns true if current's euid is same as p's uid or euid,
186216
* or has CAP_SYS_NICE to p's user_ns.

kernel/sysctl.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,24 +1475,6 @@ static const struct ctl_table kern_table[] = {
14751475
.proc_handler = proc_dointvec,
14761476
},
14771477
#endif
1478-
{
1479-
.procname = "overflowuid",
1480-
.data = &overflowuid,
1481-
.maxlen = sizeof(int),
1482-
.mode = 0644,
1483-
.proc_handler = proc_dointvec_minmax,
1484-
.extra1 = SYSCTL_ZERO,
1485-
.extra2 = SYSCTL_MAXOLDUID,
1486-
},
1487-
{
1488-
.procname = "overflowgid",
1489-
.data = &overflowgid,
1490-
.maxlen = sizeof(int),
1491-
.mode = 0644,
1492-
.proc_handler = proc_dointvec_minmax,
1493-
.extra1 = SYSCTL_ZERO,
1494-
.extra2 = SYSCTL_MAXOLDUID,
1495-
},
14961478
{
14971479
.procname = "ngroups_max",
14981480
.data = (void *)&ngroups_max,

0 commit comments

Comments
 (0)