Commit 25ebbce1 authored by Joel Granados's avatar Joel Granados
Browse files

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: default avatarJoel Granados <joel.granados@kernel.org>
parent 88eddb05
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -181,6 +181,36 @@ int fs_overflowgid = DEFAULT_FS_OVERFLOWGID;
EXPORT_SYMBOL(fs_overflowuid);
EXPORT_SYMBOL(fs_overflowgid);

static const struct ctl_table overflow_sysctl_table[] = {
	{
		.procname	= "overflowuid",
		.data		= &overflowuid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= SYSCTL_ZERO,
		.extra2		= SYSCTL_MAXOLDUID,
	},
	{
		.procname	= "overflowgid",
		.data		= &overflowgid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= SYSCTL_ZERO,
		.extra2		= SYSCTL_MAXOLDUID,
	},
};

static int __init init_overflow_sysctl(void)
{
	register_sysctl_init("kernel", overflow_sysctl_table);
	return 0;
}

postcore_initcall(init_overflow_sysctl);


/*
 * Returns true if current's euid is same as p's uid or euid,
 * or has CAP_SYS_NICE to p's user_ns.
+0 −18
Original line number Diff line number Diff line
@@ -1475,24 +1475,6 @@ static const struct ctl_table kern_table[] = {
		.proc_handler	= proc_dointvec,
	},
#endif
	{
		.procname	= "overflowuid",
		.data		= &overflowuid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= SYSCTL_ZERO,
		.extra2		= SYSCTL_MAXOLDUID,
	},
	{
		.procname	= "overflowgid",
		.data		= &overflowgid,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= SYSCTL_ZERO,
		.extra2		= SYSCTL_MAXOLDUID,
	},
	{
		.procname	= "ngroups_max",
		.data		= (void *)&ngroups_max,