Linus Torvalds
67bfce0e01
Merge tag 'trace-v5.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
...
Pull ftrace fix from Steven Rostedt:
"Fix s390 breakage from sorting mcount tables.
The latest merge of the tracing tree sorts the mcount table at build
time. But s390 appears to do things differently (like always) and
replaces the sorted table back to the original unsorted one. As the
ftrace algorithm depends on it being sorted, bad things happen when it
is not, and s390 experienced those bad things.
Add a new config to tell the boot if the mcount table is sorted or
not, and allow s390 to opt out of it"
* tag 'trace-v5.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
ftrace: Fix assuming build time sort works for s390
2022-01-23 08:07:02 +02:00
Steven Rostedt (Google)
6b9b641370
ftrace: Fix assuming build time sort works for s390
...
To speed up the boot process, as mcount_loc needs to be sorted for ftrace
to work properly, sorting it at build time is more efficient than boot up
and can save milliseconds of time. Unfortunately, this change broke s390
as it will modify the mcount_loc location after the sorting takes place
and will put back the unsorted locations. Since the sorting is skipped at
boot up if it is believed that it was sorted at run time, ftrace can crash
as its algorithms are dependent on the list being sorted.
Add a new config BUILDTIME_MCOUNT_SORT that is set when
BUILDTIME_TABLE_SORT but not if S390 is set. Use this config to determine
if sorting should take place at boot up.
Link: https://lore.kernel.org/all/yt9dee51ctfn.fsf@linux.ibm.com/
Fixes: 72b3942a17 ("scripts: ftrace - move the sort-processing in ftrace_init")
Reported-by: Sven Schnelle <svens@linux.ibm.com >
Tested-by: Heiko Carstens <hca@linux.ibm.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2022-01-23 00:10:09 -05:00
Linus Torvalds
3689f9f8b0
Merge tag 'bitmap-5.17-rc1' of git://github.com/norov/linux
...
Pull bitmap updates from Yury Norov:
- introduce for_each_set_bitrange()
- use find_first_*_bit() instead of find_next_*_bit() where possible
- unify for_each_bit() macros
* tag 'bitmap-5.17-rc1' of git://github.com/norov/linux:
vsprintf: rework bitmap_list_string
lib: bitmap: add performance test for bitmap_print_to_pagebuf
bitmap: unify find_bit operations
mm/percpu: micro-optimize pcpu_is_populated()
Replace for_each_*_bit_from() with for_each_*_bit() where appropriate
find: micro-optimize for_each_{set,clear}_bit()
include/linux: move for_each_bit() macros from bitops.h to find.h
cpumask: replace cpumask_next_* with cpumask_first_* where appropriate
tools: sync tools/bitmap with mother linux
all: replace find_next{,_zero}_bit with find_first{,_zero}_bit where appropriate
cpumask: use find_first_and_bit()
lib: add find_first_and_bit()
arch: remove GENERIC_FIND_FIRST_BIT entirely
include: move find.h from asm_generic to linux
bitops: move find_bit_*_le functions from le.h to find.h
bitops: protect find_first_{,zero}_bit properly
2022-01-23 06:20:44 +02:00
Muchun Song
359745d783
proc: remove PDE_DATA() completely
...
Remove PDE_DATA() completely and replace it with pde_data().
[akpm@linux-foundation.org: fix naming clash in drivers/nubus/proc.c]
[akpm@linux-foundation.org: now fix it properly]
Link: https://lkml.kernel.org/r/20211124081956.87711-2-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com >
Acked-by: Christian Brauner <christian.brauner@ubuntu.com >
Cc: Alexey Dobriyan <adobriyan@gmail.com >
Cc: Alexey Gladkov <gladkov.alexey@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:37 +02:00
Minchan Kim
4a57d6bbae
locking/rwlocks: introduce write_lock_nested
...
In preparation for converting bit_spin_lock to rwlock in zsmalloc so
that multiple writers of zspages can run at the same time but those
zspages are supposed to be different zspage instance. Thus, it's not
deadlock. This patch adds write_lock_nested to support the case for
LOCKDEP.
[minchan@kernel.org: fix write_lock_nested for RT]
Link: https://lkml.kernel.org/r/YZfrMTAXV56HFWJY@google.com
[bigeasy@linutronix.de: fixup write_lock_nested() implementation]
Link: https://lkml.kernel.org/r/20211123170134.y6xb7pmpgdn4m3bn@linutronix.de
Link: https://lkml.kernel.org/r/20211115185909.3949505-8-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org >
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de >
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de >
Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de >
Cc: Mike Galbraith <umgwanakikbuti@gmail.com >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Naresh Kamboju <naresh.kamboju@linaro.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:37 +02:00
Baokun Li
1622ed7d07
sysctl: returns -EINVAL when a negative value is passed to proc_doulongvec_minmax
...
When we pass a negative value to the proc_doulongvec_minmax() function,
the function returns 0, but the corresponding interface value does not
change.
we can easily reproduce this problem with the following commands:
cd /proc/sys/fs/epoll
echo -1 > max_user_watches; echo $?; cat max_user_watches
This function requires a non-negative number to be passed in, so when a
negative number is passed in, -EINVAL is returned.
Link: https://lkml.kernel.org/r/20211220092627.3744624-1-libaokun1@huawei.com
Signed-off-by: Baokun Li <libaokun1@huawei.com >
Reported-by: Hulk Robot <hulkci@huawei.com >
Acked-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:37 +02:00
Colin Ian King
e565a8ed1e
kernel/sysctl.c: remove unused variable ten_thousand
...
The const variable ten_thousand is not used, it is redundant and can be
removed.
Cleans up clang warning:
kernel/sysctl.c:99:18: warning: unused variable 'ten_thousand' [-Wunused-const-variable]
static const int ten_thousand = 10000;
Link: https://lkml.kernel.org/r/20211221184501.574670-1-colin.i.king@gmail.com
Fixes: c26da54dc8ca ("printk: move printk sysctl to printk/sysctl.c")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Acked-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:37 +02:00
Xiaoming Ni
a737a3c674
kprobe: move sysctl_kprobes_optimization to kprobes.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
Move sysctl_kprobes_optimization from kernel/sysctl.c to
kernel/kprobes.c. Use register_sysctl() to register the sysctl
interface.
[mcgrof@kernel.org: fix compile issue when CONFIG_OPTPROBES is disabled]
Link: https://lkml.kernel.org/r/20211129211943.640266-7-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Xiaoming Ni
f0bc21b268
fs/coredump: move coredump sysctls into its own file
...
This moves the fs/coredump.c respective sysctls to its own file.
Link: https://lkml.kernel.org/r/20211129211943.640266-6-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Xiaoming Ni
fdcd4073fc
printk: fix build warning when CONFIG_PRINTK=n
...
build warning when CONFIG_PRINTK=n
kernel/printk/printk.c:175:5: warning: no previous prototype for
'devkmsg_sysctl_set_loglvl' [-Wmissing-prototypes]
devkmsg_sysctl_set_loglvl() is only used in sysctl.c when
CONFIG_PRINTK=y, but it participates in the build when CONFIG_PRINTK=n.
So add compile dependency CONFIG_PRINTK=y && CONFIG_SYSCTL=y to fix the
build warning.
Link: https://lkml.kernel.org/r/20211129211943.640266-5-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
d8c0418aac
kernel/sysctl.c: rename sysctl_init() to sysctl_init_bases()
...
Rename sysctl_init() to sysctl_init_bases() so to reflect exactly what
this is doing.
Link: https://lkml.kernel.org/r/20211129211943.640266-4-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
ab171b952c
fs: move namespace sysctls and declare fs base directory
...
This moves the namespace sysctls to its own file as part of the
kernel/sysctl.c spring cleaning
Since we have now removed all sysctls for "fs", we now have to declare
it on the filesystem code, we do that using the new helper, which
reduces boiler plate code.
We rename init_fs_shared_sysctls() to init_fs_sysctls() to reflect that
now fs/sysctls.c is taking on the burden of being the first to register
the base directory as well.
Lastly, since init code will load in the order in which we link it we
have to move the sysctl code to be linked in early, so that its early
init routine runs prior to other fs code. This way, other filesystem
code can register their own sysctls using the helpers after this:
* register_sysctl_init()
* register_sysctl()
Link: https://lkml.kernel.org/r/20211129211943.640266-3-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
51cb8dfc5a
sysctl: add and use base directory declarer and registration helper
...
Patch series "sysctl: add and use base directory declarer and
registration helper".
In this patch series we start addressing base directories, and so we
start with the "fs" sysctls. The end goal is we end up completely
moving all "fs" sysctl knobs out from kernel/sysctl.
This patch (of 6):
Add a set of helpers which can be used to declare and register base
directory sysctls on their own. We do this so we can later move each of
the base sysctl directories like "fs", "kernel", etc, to their own
respective files instead of shoving the declarations and registrations
all on kernel/sysctl.c. The lazy approach has caught up and with this,
we just end up extending the list of base directories / sysctls on one
file and this makes maintenance difficult due to merge conflicts from
many developers.
The declarations are used first by kernel/sysctl.c for registration its
own base which over time we'll try to clean up. It will be used in the
next patch to demonstrate how to cleanly deal with base sysctl
directories.
[mcgrof@kernel.org: null-terminate the ctl_table arrays]
Link: https://lkml.kernel.org/r/YafJY3rXDYnjK/gs@bombadil.infradead.org
Link: https://lkml.kernel.org/r/20211129211943.640266-1-mcgrof@kernel.org
Link: https://lkml.kernel.org/r/20211129211943.640266-2-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Kees Cook <keescook@chromium.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
1998f19324
fs: move pipe sysctls to is own file
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the pipe sysctls to its own file.
Link: https://lkml.kernel.org/r/20211129205548.605569-10-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
66ad398634
fs: move fs/exec.c sysctls into its own file
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the fs/exec.c respective sysctls to its own file.
Since checkpatch complains about style issues with the old code, this
move also fixes a few of those minor style issues:
* Use pr_warn() instead of prink(WARNING
* New empty lines are wanted at the beginning of routines
Link: https://lkml.kernel.org/r/20211129205548.605569-9-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
9c011be132
fs: move namei sysctls to its own file
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move namei's own sysctl knobs to its own file.
Other than the move we also avoid initializing two static variables to 0
as this is not needed:
* sysctl_protected_symlinks
* sysctl_protected_hardlinks
Link: https://lkml.kernel.org/r/20211129205548.605569-8-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
dd81faa883
fs: move locking sysctls where they are used
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
The locking fs sysctls are only used on fs/locks.c, so move them there.
Link: https://lkml.kernel.org/r/20211129205548.605569-7-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
d1d8ac9edf
fs: move shared sysctls to fs/sysctls.c
...
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move sysctls which are shared between filesystems into a common file
outside of kernel/sysctl.c.
Link: https://lkml.kernel.org/r/20211129205548.605569-6-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
54771613e8
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.
[akpm@linux-foundation.org: fix sysctl_vals[], per Mickaël]
Link: https://lkml.kernel.org/r/20211129205548.605569-5-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Mickaël Salaün <mic@digikod.net >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
c8c0c239d5
fs: move dcache sysctls to its own file
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the dcache sysctl clutter out of kernel/sysctl.c. This is a
small one-off entry, perhaps later we can simplify this representation,
but for now we use the helpers we have. We won't know how we can
simplify this further untl we're fully done with the cleanup.
[arnd@arndb.de: avoid unused-function warning]
Link: https://lkml.kernel.org/r/20211203190123.874239-2-arnd@kernel.org
Link: https://lkml.kernel.org/r/20211129205548.605569-4-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
204d5a24e1
fs: move fs stat sysctls to file_table.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
We can create the sysctl dynamically on early init for fs stat to help
with this clutter. This dusts off the fs stat syctls knobs and puts
them into where they are declared.
Link: https://lkml.kernel.org/r/20211129205548.605569-3-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
1d67fe5850
fs: move inode sysctls to its own file
...
Patch series "sysctl: 4th set of kernel/sysctl cleanups".
This is slimming down the fs uses of kernel/sysctl.c to the point that
the next step is to just get rid of the fs base directory for it and
move that elsehwere, so that next patch series starts dealing with that
to demo how we can end up cleaning up a full base directory from
kernel/sysctl.c, one at a time.
This patch (of 9):
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the inode sysctls to its own file. Since we are no longer using
this outside of fs/ remove the extern declaration of its respective proc
helper.
We use early_initcall() as it is the earliest we can use.
[arnd@arndb.de: avoid unused-variable warning]
Link: https://lkml.kernel.org/r/20211203190123.874239-1-arnd@kernel.org
Link: https://lkml.kernel.org/r/20211129205548.605569-1-mcgrof@kernel.org
Link: https://lkml.kernel.org/r/20211129205548.605569-2-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Kees Cook <keescook@chromium.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00
Luis Chamberlain
b1f2aff888
sysctl: share unsigned long const values
...
Provide a way to share unsigned long values. This will allow others to
not have to re-invent these values.
Link: https://lkml.kernel.org/r/20211124231435.1445213-9-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Amir Goldstein <amir73il@gmail.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Benjamin LaHaise <bcrl@kvack.org >
Cc: Clemens Ladisch <clemens@ladisch.de >
Cc: David Airlie <airlied@linux.ie >
Cc: Douglas Gilbert <dgilbert@interlog.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: James E.J. Bottomley <jejb@linux.ibm.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Jan Kara <jack@suse.cz >
Cc: Joel Becker <jlbec@evilplan.org >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Julia Lawall <julia.lawall@inria.fr >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Mark Fasheh <mark@fasheh.com >
Cc: Martin K. Petersen <martin.petersen@oracle.com >
Cc: Paul Turner <pjt@google.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Petr Mladek <pmladek@suse.com >
Cc: Phillip Potter <phil@philpotter.co.uk >
Cc: Qing Wang <wangqing@vivo.com >
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Sebastian Reichel <sre@kernel.org >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp >
Cc: "Theodore Ts'o" <tytso@mit.edu >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00
Xiaoming Ni
0df8bdd5e3
stackleak: move stack_erasing sysctl to stackleak.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the stack_erasing sysctl from kernel/sysctl.c to
kernel/stackleak.c and use register_sysctl() to register the sysctl
interface.
[mcgrof@kernel.org: commit log update]
Link: https://lkml.kernel.org/r/20211124231435.1445213-8-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Amir Goldstein <amir73il@gmail.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Benjamin LaHaise <bcrl@kvack.org >
Cc: Clemens Ladisch <clemens@ladisch.de >
Cc: David Airlie <airlied@linux.ie >
Cc: Douglas Gilbert <dgilbert@interlog.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: James E.J. Bottomley <jejb@linux.ibm.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Jan Kara <jack@suse.cz >
Cc: Joel Becker <jlbec@evilplan.org >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Julia Lawall <julia.lawall@inria.fr >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Mark Fasheh <mark@fasheh.com >
Cc: Martin K. Petersen <martin.petersen@oracle.com >
Cc: Paul Turner <pjt@google.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Petr Mladek <pmladek@suse.com >
Cc: Phillip Potter <phil@philpotter.co.uk >
Cc: Qing Wang <wangqing@vivo.com >
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Sebastian Reichel <sre@kernel.org >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp >
Cc: "Theodore Ts'o" <tytso@mit.edu >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00
Xiaoming Ni
26d1c80fd6
scsi/sg: move sg-big-buff sysctl to scsi/sg.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the sg-big-buff sysctl from kernel/sysctl.c to drivers/scsi/sg.c
and use register_sysctl() to register the sysctl interface.
[mcgrof@kernel.org: commit log update]
Link: https://lkml.kernel.org/r/20211124231435.1445213-7-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Amir Goldstein <amir73il@gmail.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Benjamin LaHaise <bcrl@kvack.org >
Cc: Clemens Ladisch <clemens@ladisch.de >
Cc: David Airlie <airlied@linux.ie >
Cc: Douglas Gilbert <dgilbert@interlog.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: James E.J. Bottomley <jejb@linux.ibm.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Jan Kara <jack@suse.cz >
Cc: Joel Becker <jlbec@evilplan.org >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Julia Lawall <julia.lawall@inria.fr >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Mark Fasheh <mark@fasheh.com >
Cc: Martin K. Petersen <martin.petersen@oracle.com >
Cc: Paul Turner <pjt@google.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Petr Mladek <pmladek@suse.com >
Cc: Phillip Potter <phil@philpotter.co.uk >
Cc: Qing Wang <wangqing@vivo.com >
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Sebastian Reichel <sre@kernel.org >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp >
Cc: "Theodore Ts'o" <tytso@mit.edu >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00