The patch titled Subject: sysctl: move maxolduid as a sysctl specific const has been added to the -mm tree. Its filename is sysctl-move-maxolduid-as-a-sysctl-specific-const.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/sysctl-move-maxolduid-as-a-sysctl-specific-const.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/sysctl-move-maxolduid-as-a-sysctl-specific-const.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Luis Chamberlain <mcgrof@xxxxxxxxxx> Subject: sysctl: move maxolduid as a sysctl specific const The maxolduid value is only shared for sysctl purposes for use on a max range. Just stuff this into our shared const array. Link: https://lkml.kernel.org/r/20211129205548.605569-5-mcgrof@xxxxxxxxxx Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: Antti Palosaari <crope@xxxxxx> Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx> Cc: Iurii Zaikin <yzaikin@xxxxxxxxxx> Cc: "J. Bruce Fields" <bfields@xxxxxxxxxxxx> Cc: Jeff Layton <jlayton@xxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Lukas Middendorf <kernel@xxxxxxxxxxx> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> Cc: Stephen Kitt <steve@xxxxxxx> Cc: Xiaoming Ni <nixiaoming@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/proc_sysctl.c | 2 +- include/linux/sysctl.h | 3 +++ kernel/sysctl.c | 12 ++++-------- 3 files changed, 8 insertions(+), 9 deletions(-) --- a/fs/proc/proc_sysctl.c~sysctl-move-maxolduid-as-a-sysctl-specific-const +++ a/fs/proc/proc_sysctl.c @@ -26,7 +26,7 @@ static const struct file_operations proc static const struct inode_operations proc_sys_dir_operations; /* shared constants to be used in various sysctls */ -const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX }; +const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 65535, INT_MAX }; EXPORT_SYMBOL(sysctl_vals); const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX }; --- a/include/linux/sysctl.h~sysctl-move-maxolduid-as-a-sysctl-specific-const +++ a/include/linux/sysctl.h @@ -49,6 +49,9 @@ struct ctl_dir; #define SYSCTL_THREE_THOUSAND ((void *)&sysctl_vals[8]) #define SYSCTL_INT_MAX ((void *)&sysctl_vals[9]) +/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ +#define SYSCTL_MAXOLDUID ((void *)&sysctl_vals[10]) + extern const int sysctl_vals[]; #define SYSCTL_LONG_ZERO ((void *)&sysctl_long_vals[0]) --- a/kernel/sysctl.c~sysctl-move-maxolduid-as-a-sysctl-specific-const +++ a/kernel/sysctl.c @@ -109,10 +109,6 @@ static const int six_hundred_forty_kb = /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ static const unsigned long dirty_bytes_min = 2 * PAGE_SIZE; -/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ -static const int maxolduid = 65535; -/* minolduid is SYSCTL_ZERO */ - static const int ngroups_max = NGROUPS_MAX; static const int cap_last_cap = CAP_LAST_CAP; @@ -2126,7 +2122,7 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&maxolduid, + .extra2 = SYSCTL_MAXOLDUID, }, { .procname = "overflowgid", @@ -2135,7 +2131,7 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&maxolduid, + .extra2 = SYSCTL_MAXOLDUID, }, #ifdef CONFIG_S390 { @@ -2907,7 +2903,7 @@ static struct ctl_table fs_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&maxolduid, + .extra2 = SYSCTL_MAXOLDUID, }, { .procname = "overflowgid", @@ -2916,7 +2912,7 @@ static struct ctl_table fs_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&maxolduid, + .extra2 = SYSCTL_MAXOLDUID, }, #ifdef CONFIG_FILE_LOCKING { _ Patches currently in -mm which might be from mcgrof@xxxxxxxxxx are zram-use-attribute_groups.patch hpet-simplify-subdirectory-registration-with-register_sysctl.patch i915-simplify-subdirectory-registration-with-register_sysctl.patch macintosh-mac_hidc-simplify-subdirectory-registration-with-register_sysctl.patch ocfs2-simplify-subdirectory-registration-with-register_sysctl.patch test_sysctl-simplify-subdirectory-registration-with-register_sysctl.patch inotify-simplify-subdirectory-registration-with-register_sysctl-fix.patch cdrom-simplify-subdirectory-registration-with-register_sysctl.patch sysctl-add-helper-to-register-a-sysctl-mount-point.patch fs-move-binfmt_misc-sysctl-to-its-own-file.patch sysctl-share-unsigned-long-const-values.patch fs-move-inode-sysctls-to-its-own-file.patch fs-move-fs-stat-sysctls-to-file_tablec.patch fs-move-dcache-sysctls-to-its-own-file.patch sysctl-move-maxolduid-as-a-sysctl-specific-const.patch fs-move-shared-sysctls-to-fs-sysctlsc.patch fs-move-locking-sysctls-where-they-are-used.patch fs-move-namei-sysctls-to-its-own-file.patch fs-move-fs-execc-sysctls-into-its-own-file.patch fs-move-pipe-sysctls-to-is-own-file.patch sysctl-add-and-use-base-directory-declarer-and-registration-helper.patch fs-move-namespace-sysctls-and-declare-fs-base-directory.patch kernel-sysctlc-rename-sysctl_init-to-sysctl_init_bases.patch