Commit Graph

735 Commits

Author SHA1 Message Date
Rafael Aquini 17829a0682 mm: hugetlb: move hugeltb sysctls to its own file
JIRA: https://issues.redhat.com/browse/RHEL-48221
Conflicts:
    * kernel/sysctl.c: minor context diff due to out-of-order backport for
      commit e95d372c4cd4 ("mm: page_alloc: move sysctls into it own fils")
    * mm/hugetlb.c: minor context diff due to out-of-order backport for
      commit 263b899802fc ("hugetlb: make hugetlb_cma_check() static")

This patch is a backport of the following upstream commit:
commit 962de54828c5bb100eb8de881b79ed9c8b7468c0
Author: Kefeng Wang <wangkefeng.wang@huawei.com>
Date:   Thu Mar 9 20:20:11 2023 +0800

    mm: hugetlb: move hugeltb sysctls to its own file

    This moves all hugetlb sysctls to its own file, also kill an
    useless hugetlb_treat_movable_handler() defination.

    Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
    Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
2024-07-16 09:29:59 -04:00
Rafael Aquini f12a153efe mm: sysctl: fix missing numa_stat when !CONFIG_HUGETLB_PAGE
JIRA: https://issues.redhat.com/browse/RHEL-48221

This patch is a backport of the following upstream commit:
commit 43b5240ca6b33108998810593248186b1e3ae34a
Author: Muchun Song <songmuchun@bytedance.com>
Date:   Thu Jun 9 18:40:32 2022 +0800

    mm: sysctl: fix missing numa_stat when !CONFIG_HUGETLB_PAGE

    "numa_stat" should not be included in the scope of CONFIG_HUGETLB_PAGE, if
    CONFIG_HUGETLB_PAGE is not configured even if CONFIG_NUMA is configured,
    "numa_stat" is missed form /proc. Move it out of CONFIG_HUGETLB_PAGE to
    fix it.

    Fixes: 4518085e12 ("mm, sysctl: make NUMA stats configurable")
    Signed-off-by: Muchun Song <songmuchun@bytedance.com>
    Cc: <stable@vger.kernel.org>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Mel Gorman <mgorman@techsingularity.net>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
2024-07-16 09:29:58 -04:00
Chris von Recklinghausen 28429327ca mm: page_alloc: move sysctls into it own fils
JIRA: https://issues.redhat.com/browse/RHEL-20141

commit e95d372c4cd46b6ec4eeacc07adcb7260ab4cfa0
Author: Kefeng Wang <wangkefeng.wang@huawei.com>
Date:   Tue May 16 14:38:20 2023 +0800

    mm: page_alloc: move sysctls into it own fils

    This moves all page alloc related sysctls to its own file, as part of the
    kernel/sysctl.c spring cleaning, also move some functions declarations
    from mm.h into internal.h.

    Link: https://lkml.kernel.org/r/20230516063821.121844-13-wangkefeng.wang@huawei.com
    Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Len Brown <len.brown@intel.com>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Mike Rapoport (IBM) <rppt@kernel.org>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Pavel Machek <pavel@ucw.cz>
    Cc: Rafael J. Wysocki <rafael@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2024-06-07 13:14:12 -04:00
Lucas Zampieri b9f5553f44 Merge: printk: Update the printk series to 6.6-rt-stable
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3895

Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git/

JIRA: https://issues.redhat.com/browse/RHEL-3987

JIRA: https://issues.redhat.com/browse/RHEL-24205

This series updates the CentOS Stream 9 Kernels TTY Layer to 6.7, and updates printk to 6.6-stable-rt.

After a series of introduced regressions with the _older_ printk NOBKL atomic console implementation (circa LPC-dublin) [0][1][2], the KRTS team has been targeting the the newer NBCON atomic console printk rewrite, which aims to resolve the problems introduced from other implementations. Mainly, NBCON addresses the issue of deadlocks introduced from unsafe contexts, panics, nested NMIs, and other oddities caused by console lock contention.

However, as the newer upstream nbcon implementation is dependent on newer additions to the TTY subsystem, such as updates to UART port lock wrappers, 8250 changes, and additions to serial_core, the printk update requires a substantial update to the TTY layer.

This MR will also facilitate TTY, nbcon and printk updates for the foreseeable future, as newer changes will be based on the current UART Port lock wrappers present in 6.6+ kernels.

This MR effectively undoes the TTY/printk PREEMPT_RT bits responsible for the older printk implementation, pulls up the TTY layer to 6.7, and applies the 6.6-stable-rt (as 6.7.y-rt is now considered 'stale') printk changes (with some minor hunks brought in for panic.c, RCU, and lockdep).



[0] https://issues.redhat.com/browse/RHEL-9380

[1] https://issues.redhat.com/browse/RHEL-15897

[2] https://issues.redhat.com/browse/RHEL-17709


Signed-off-by: Andrew Halaney <ahalaney@redhat.com>

Signed-off-by: Derek Barbosa <debarbos@redhat.com>

Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Approved-by: Herton R. Krzesinski <herton@redhat.com>
Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: Jocelyn Falempe <jfalempe@redhat.com>
Approved-by: Eric Chanudet <echanude@redhat.com>
Approved-by: Juri Lelli <juri.lelli@redhat.com>

Merged-by: Lucas Zampieri <lzampier@redhat.com>
2024-05-14 14:09:16 +00:00
Andrew Halaney 16b2a9a32a sysctl: fix proc_dobool() usability
JIRA: https://issues.redhat.com/browse/RHEL-24205
Conflicts: Conflict due to missing cb55f27ac932
           ("fs/proc: Introduce list_for_each_table_entry for proc sysctl")

commit f1aa2eb5ea05ccd1fd92d235346e60e90a1ed949
Author: Ondrej Mosnacek <omosnace@redhat.com>
Date:   Fri Feb 10 15:58:23 2023 +0100

    sysctl: fix proc_dobool() usability

    Currently proc_dobool expects a (bool *) in table->data, but sizeof(int)
    in table->maxsize, because it uses do_proc_dointvec() directly.

    This is unsafe for at least two reasons:
    1. A sysctl table definition may use { .data = &variable, .maxsize =
       sizeof(variable) }, not realizing that this makes the sysctl unusable
       (see the Fixes: tag) and that they need to use the completely
       counterintuitive sizeof(int) instead.
    2. proc_dobool() will currently try to parse an array of values if given
       .maxsize >= 2*sizeof(int), but will try to write values of type bool
       by offsets of sizeof(int), so it will not work correctly with neither
       an (int *) nor a (bool *). There is no .maxsize validation to prevent
       this.

    Fix this by:
    1. Constraining proc_dobool() to allow only one value and .maxsize ==
       sizeof(bool).
    2. Wrapping the original struct ctl_table in a temporary one with .data
       pointing to a local int variable and .maxsize set to sizeof(int) and
       passing this one to proc_dointvec(), converting the value to/from
       bool as needed (using proc_dou8vec_minmax() as an example).
    3. Extending sysctl_check_table() to enforce proc_dobool() expectations.
    4. Fixing the proc_dobool() docstring (it was just copy-pasted from
       proc_douintvec, apparently...).
    5. Converting all existing proc_dobool() users to set .maxsize to
       sizeof(bool) instead of sizeof(int).

    Fixes: 83efeeeb3d04 ("tty: Allow TIOCSTI to be disabled")
    Fixes: a2071573d634 ("sysctl: introduce new proc handler proc_dobool")
    Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
    Acked-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
2024-05-09 11:25:32 -04:00
Chris von Recklinghausen 8f4c875305 mm: compaction: move compaction sysctl to its own file
JIRA: https://issues.redhat.com/browse/RHEL-27741

commit 48fe8ab8d5a39c7bc49cb41d0ad92c75f48a9550
Author: Minghao Chi <chi.minghao@zte.com.cn>
Date:   Tue Mar 28 14:46:28 2023 +0800

    mm: compaction: move compaction sysctl to its own file

    This moves all compaction sysctls to its own file.

    Move sysctl to where the functionality truly belongs to improve
    readability, reduce merge conflicts, and facilitate maintenance.

    I use x86_defconfig and linux-next-20230327 branch
    $ make defconfig;make all -jn
    CONFIG_COMPACTION=y

    add/remove: 1/0 grow/shrink: 1/1 up/down: 350/-256 (94)
    Function                                     old     new   delta
    vm_compaction                                  -     320    +320
    kcompactd_init                               180     210     +30
    vm_table                                    2112    1856    -256
    Total: Before=21119987, After=21120081, chg +0.00%

    Despite the addition of 94 bytes the patch still seems a worthwile
    cleanup.

    Link: https://lore.kernel.org/lkml/067f7347-ba10-5405-920c-0f5f985c84f4@suse.cz/
    Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2024-04-30 07:00:47 -04:00
Chris von Recklinghausen de9f16f4d7 mm: memory-failure: Move memory failure sysctls to its own file
JIRA: https://issues.redhat.com/browse/RHEL-27741

commit 8cbc82f3ec0d58961cf9c1e5d99e56741f4bf134
Author: Kefeng Wang <wangkefeng.wang@huawei.com>
Date:   Mon Mar 20 15:40:10 2023 +0800

    mm: memory-failure: Move memory failure sysctls to its own file

    The sysctl_memory_failure_early_kill and memory_failure_recovery
    are only used in memory-failure.c, move them to its own file.

    Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
    Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    [mcgrof: fix by adding empty ctl entry, this caused a crash]
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2024-04-30 07:00:47 -04:00
Chris von Recklinghausen afea487a5a sysctl: remove max_extfrag_threshold
JIRA: https://issues.redhat.com/browse/RHEL-27741

commit feb2bd010aec77a1cf981d2649183c64cd4870a0
Author: Liu Shixin <liushixin2@huawei.com>
Date:   Mon Sep 5 20:47:24 2022 +0800

    sysctl: remove max_extfrag_threshold

    Remove max_extfrag_threshold and replace by SYSCTL_ONE_THOUSAND.

    No functional change.

    Signed-off-by: Liu Shixin <liushixin2@huawei.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2024-04-30 07:00:01 -04:00
Lucas Zampieri 303e7fab6b Merge: perf: Sync with upstream v6.8
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3829

JIRA: https://issues.redhat.com/browse/RHEL-25824

Signed-off-by: Michael Petlan <mpetlan@redhat.com>

Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: David Arcari <darcari@redhat.com>
Approved-by: Steve Best <sbest@redhat.com>
Approved-by: Jan Stancek <jstancek@redhat.com>
Approved-by: Lucas Zampieri <lzampier@redhat.com>

Merged-by: Lucas Zampieri <lzampier@redhat.com>
2024-04-24 19:39:17 +00:00
Audra Mitchell 5523d221b3 kernel/panic: move panic sysctls to its own file
JIRA: https://issues.redhat.com/browse/RHEL-27739

This patch is a backport of the following upstream commit:
commit 9df918698408fd914493aba0b7858fef50eba63a
Author: tangmeng <tangmeng@uniontech.com>
Date:   Fri Feb 18 18:59:12 2022 +0800

    kernel/panic: move panic 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.

    All filesystem syctls now get reviewed by fs folks. This commit
    follows the commit of fs, move the oops_all_cpu_backtrace sysctl to
    its own file, kernel/panic.c.

    Signed-off-by: tangmeng <tangmeng@uniontech.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Audra Mitchell <audra@redhat.com>
2024-04-09 09:43:00 -04:00
Audra Mitchell 004f9c4e05 swap: add a limit for readahead page-cluster value
JIRA: https://issues.redhat.com/browse/RHEL-27739

This patch is a backport of the following upstream commit:
commit ea0ffd0c08d0fef1f6e93eb07badbeeabf6b43d6
Author: Kairui Song <kasong@tencent.com>
Date:   Mon Oct 24 00:25:33 2022 +0800

    swap: add a limit for readahead page-cluster value

    Currenty there is no upper limit for /proc/sys/vm/page-cluster, and it's a
    bit shift value, so it could result in overflow of the 32-bit integer.
    Add a reasonable upper limit for it, read-in at most 2**31 pages, which is
    a large enough value for readahead.

    Link: https://lkml.kernel.org/r/20221023162533.81561-1-ryncsn@gmail.com
    Signed-off-by: Kairui Song <kasong@tencent.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Audra Mitchell <audra@redhat.com>
2024-04-09 09:42:52 -04:00
Michael Petlan aeb0e5c009 perf/core: Rename perf_proc_update_handler() -> perf_event_max_sample_rate_handler(), for readability
JIRA: https://issues.redhat.com/browse/RHEL-25824

upstream
========
commit e6814ec3ba1994561db9b1c05a80227d30cc18fa
Author: Xiu Jianfeng <xiujianfeng@huawei.com>
Date: Fri Jul 21 09:06:07 2023 +0000

description
===========
Follow the naming pattern of the other sysctl handlers in perf.

    Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230721090607.172002-1-xiujianfeng@huawei.com

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
2024-04-03 19:36:46 +02:00
Chris von Recklinghausen 2010f45c9e memory tiering: rate limit NUMA migration throughput
JIRA: https://issues.redhat.com/browse/RHEL-1848

commit c6833e10008f976a173dd5abdf992e492cbc3bcf
Author: Huang Ying <ying.huang@intel.com>
Date:   Wed Jul 13 16:39:52 2022 +0800

    memory tiering: rate limit NUMA migration throughput

    In NUMA balancing memory tiering mode, if there are hot pages in slow
    memory node and cold pages in fast memory node, we need to promote/demote
    hot/cold pages between the fast and cold memory nodes.

    A choice is to promote/demote as fast as possible.  But the CPU cycles and
    memory bandwidth consumed by the high promoting/demoting throughput will
    hurt the latency of some workload because of accessing inflating and slow
    memory bandwidth contention.

    A way to resolve this issue is to restrict the max promoting/demoting
    throughput.  It will take longer to finish the promoting/demoting.  But
    the workload latency will be better.  This is implemented in this patch as
    the page promotion rate limit mechanism.

    The number of the candidate pages to be promoted to the fast memory node
    via NUMA balancing is counted, if the count exceeds the limit specified by
    the users, the NUMA balancing promotion will be stopped until the next
    second.

    A new sysctl knob kernel.numa_balancing_promote_rate_limit_MBps is added
    for the users to specify the limit.

    Link: https://lkml.kernel.org/r/20220713083954.34196-3-ying.huang@intel.com
    Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
    Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
    Tested-by: Baolin Wang <baolin.wang@linux.alibaba.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: osalvador <osalvador@suse.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: Shakeel Butt <shakeelb@google.com>
    Cc: Wei Xu <weixugc@google.com>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: Zhong Jiang <zhongjiang-ali@linux.alibaba.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-10-20 06:13:30 -04:00
Jan Stancek c3b7a93516 Merge: Update locking code to upstream 6.1 + follow up fixes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2146

```
Omitted-fix: 807ff7ed34d2 ("futex: add missing rtmutex.h include")
	part of patchset not being backported: https://patchwork.freedesktop.org/series/102340/
	tiny change to locking code is only incidental

Omitted-fix: f5d39b020809 ("freezer,sched: Rewrite core freezer logic")
	changes to futex subsystem are only incidental to larger rewrite of freezer logic

Omitted-fix: e67198cc05b8 ("context_tracking: Take idle eqs entrypoints over RCU")
	part of a larger patchset implementing RCU context tracking,
	http://kerneloscope.usersys.redhat.com/series/08ab707dfc83d6ab7829c1c0f39b0d4530fa42a8/

Omitted-fix: 79dbd006a6d6 ("kmsan: disable instrumentation of unsupported common kernel code")
	part of larget patchset implementing KMSAN
	http://kerneloscope.usersys.redhat.com/series/4ca8cc8d1bbe582bfc7a4d80bd72cfd8d3d0e2e8/

Omitted-fix: 81895a65ec63 ("treewide: use prandom_u32_max() when possible, part 1")
	treewide changes to random number generation
	part of patchset: http://kerneloscope.usersys.redhat.com/series/8b3ccbc1f1f91847160951aa15dd27c22dddcb49/

Arnd Bergmann (4):
  futex: Remove futex_cmpxchg detection
  futex: Ensure futex_atomic_cmpxchg_inatomic() is present
  futex: Fix sparc32/m68k/nds32 build regression
  futex: Fix additional regressions

Guo Jin (1):
  locking: Fix qspinlock/x86 inline asm error

Joel Savitz (1):
  Revert "locking/rwsem: Conditionally wake waiters in reader/writer
    slowpaths"

Mathieu Desnoyers (1):
  futex: Fix futex_waitv() hrtimer debug object leak on kcalloc error

Namhyung Kim (2):
  locking: Apply contention tracepoints in the slow path
  locking: Add __lockfunc to slow path functions

Peter Zijlstra (1):
  locking/mutex: Make contention tracepoints more consistent wrt
    adaptive spinning

Sebastian Andrzej Siewior (1):
  futex: Remove a PREEMPT_RT_FULL reference.

Tetsuo Handa (1):
  locking/lockdep: Print more debug information - report name and key
    when look_up_lock_class() got confused

Waiman Long (9):
  locking/rwsem: Make handoff bit handling more consistent
  locking/rwsem: Conditionally wake waiters in reader/writer slowpaths
  locking/rwsem: No need to check for handoff bit if wait queue empty
  locking/rwsem: Always try to wake waiters in out_nolock path
  locking/qrwlock: Change "queue rwlock" to "queued rwlock"
  locking/rwsem: Allow slowpath writer to ignore handoff bit if not set
    by first waiter
  locking/rwsem: Prevent non-first waiter from spinning in down_write()
    slowpath
  locking/rwsem: Disable preemption in all down_read*() and up_read()
    code paths
  locking/rwsem: Disable preemption in all down_write*() and up_write()
    code paths

Wander Lairson Costa (1):
  rtmutex: Ensure that the top waiter is always woken up

Xiu Jianfeng (1):
  lockdep: Use memset_startat() helper in reinit_class()

tangmeng (1):
  kernel/lockdep: move lockdep sysctls to its own file

 arch/arc/Kconfig                          |   1 -
 arch/arm64/Kconfig                        |   1 -
 arch/csky/Kconfig                         |   1 -
 arch/m68k/Kconfig                         |   1 -
 arch/mips/include/asm/futex.h             |  27 +-
 arch/riscv/Kconfig                        |   1 -
 arch/s390/Kconfig                         |   1 -
 arch/sh/Kconfig                           |   1 -
 arch/um/Kconfig                           |   1 -
 arch/um/kernel/skas/uaccess.c             |   1 -
 arch/x86/include/asm/qspinlock_paravirt.h |  13 +-
 arch/xtensa/Kconfig                       |   1 -
 arch/xtensa/include/asm/futex.h           |   8 +-
 include/asm-generic/futex.h               |  31 +--
 include/asm-generic/qrwlock.h             |  28 +-
 include/asm-generic/qrwlock_types.h       |   2 +-
 include/linux/lockdep.h                   |   4 -
 include/trace/events/lock.h               |   4 +-
 init/Kconfig                              |   9 +-
 kernel/futex/core.c                       |  35 ---
 kernel/futex/futex.h                      |   6 -
 kernel/futex/pi.c                         |   2 +-
 kernel/futex/syscalls.c                   |  33 +--
 kernel/locking/lockdep.c                  |  46 +++-
 kernel/locking/mutex.c                    |  15 +-
 kernel/locking/percpu-rwsem.c             |   5 +
 kernel/locking/qrwlock.c                  |  21 +-
 kernel/locking/qspinlock.c                |   7 +-
 kernel/locking/qspinlock_paravirt.h       |   4 +-
 kernel/locking/rtmutex.c                  |  16 +-
 kernel/locking/rwbase_rt.c                |   7 +
 kernel/locking/rwsem.c                    | 311 +++++++++++++---------
 kernel/locking/semaphore.c                |  15 +-
 kernel/sysctl.c                           |  21 --
 34 files changed, 366 insertions(+), 314 deletions(-)

--
2.31.1
```

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2176147
Signed-off-by: Joel Savitz <jsavitz@redhat.com>

Approved-by: Waiman Long <longman@redhat.com>
Approved-by: Artem Savkov <asavkov@redhat.com>
Approved-by: Phil Auld <pauld@redhat.com>
Approved-by: Prarit Bhargava <prarit@redhat.com>

Signed-off-by: Jan Stancek <jstancek@redhat.com>
2023-04-16 14:59:54 +02:00
Chris von Recklinghausen 2805839ca0 mm: move page-writeback sysctls to their own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit aa779e5102195e1d9ade95dcbc0bfbd8f916eb59
Author: zhanglianjie <zhanglianjie@uniontech.com>
Date:   Thu Feb 17 18:51:51 2022 -0800

    mm: move page-writeback sysctls to their 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 page-writeback sysctls to its own file.

    [akpm@linux-foundation.org: coding-style cleanups]

    akpm@linux-foundation.org: fix CONFIG_SYSCTL=n warnings]
    Link: https://lkml.kernel.org/r/20220129012955.26594-1-zhanglianjie@uniontech.com
    Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:50 -04:00
Chris von Recklinghausen 94b77ec848 mm: move oom_kill sysctls to their own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit 43fe219aa56a2fdd8f0623c9470a32b14b0617a5
Author: sujiaxun <sujiaxun@uniontech.com>
Date:   Thu Feb 17 18:51:48 2022 -0800

    mm: move oom_kill sysctls to their 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 oom_kill sysctls to their own file, mm/oom_kill.c

    [sfr@canb.auug.org.au: null-terminate the array]
      Link: https://lkml.kernel.org/r/20220216193202.28838626@canb.auug.org.au

    Link: https://lkml.kernel.org/r/20220215093203.31032-1-sujiaxun@uniontech.com
    Signed-off-by: sujiaxun <sujiaxun@uniontech.com>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:50 -04:00
Chris von Recklinghausen 97f7745102 fs/coredump: move coredump sysctls into its own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit f0bc21b268c1464603192a00851cdbbf7c2cdc36
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:13:38 2022 -0800

    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>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:33 -04:00
Chris von Recklinghausen f6ed5ea18b fs: move namespace sysctls and declare fs base directory
Bugzilla: https://bugzilla.redhat.com/2160210

commit ab171b952c6e065779687b44041038efdadb3915
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:13:27 2022 -0800

    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen 4c2757dce8 sysctl: add and use base directory declarer and registration helper
Bugzilla: https://bugzilla.redhat.com/2160210

commit 51cb8dfc5a5c39e6c70376b9dc9a14d624a9d271
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:13:24 2022 -0800

    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen aee7a5e0f1 fs: move pipe sysctls to is own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit 1998f19324d24df7de4e74d81503b4299eb99e7d
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:13:20 2022 -0800

    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen c47399a873 fs: move fs/exec.c sysctls into its own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit 66ad398634c21e0a42ce10002ae06c39352da0d1
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:13:17 2022 -0800

    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>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen 5468f76381 fs: move namei sysctls to its own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit 9c011be132972ff94bde2ae99064e29f94e85c68
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:13:13 2022 -0800

    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen c1f51256f0 fs: move locking sysctls where they are used
Bugzilla: https://bugzilla.redhat.com/2160210

commit dd81faa88340a1fe8cd81c8ecbadd8e95c58549c
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:13:10 2022 -0800

    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen 8dadc5b8dc fs: move shared sysctls to fs/sysctls.c
Bugzilla: https://bugzilla.redhat.com/2160210

commit d1d8ac9edf10e83f16d13f009439585a1f93ccb2
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:13:06 2022 -0800

    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen 23f773c5bd sysctl: move maxolduid as a sysctl specific const
Bugzilla: https://bugzilla.redhat.com/2160210

commit 54771613e8a7dbbba2a205ddf1b33e25a290b3fd
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:13:03 2022 -0800

    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen a2b4773b2f fs: move dcache sysctls to its own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit c8c0c239d5ab1e3e8d2bb0453ce642fe2c6357ec
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:12:59 2022 -0800

    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>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:32 -04:00
Chris von Recklinghausen 68e09dfc1f fs: move fs stat sysctls to file_table.c
Bugzilla: https://bugzilla.redhat.com/2160210

commit 204d5a24e15562b2816825c0f9b49d26814b77be
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:12:56 2022 -0800

    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen eecd85274e fs: move inode sysctls to its own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit 1d67fe585049d3e2448b997af78c68cbf90ada09
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:12:52 2022 -0800

    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>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen 884fc064e1 sysctl: share unsigned long const values
Conflicts:
    kernel/sysctl.c - We already have e565a8ed1ee4 ("kernel/sysctl.c:
    remove unused variable ten_thousand") so lines related to the
    variable ten_thousand are gone.

Bugzilla: https://bugzilla.redhat.com/2160210

commit b1f2aff888af54a057c2c3c0d88a13ef5d37b52a
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:12:48 2022 -0800

    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>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen 934213c76d fs: move binfmt_misc sysctl to its own file
Bugzilla: https://bugzilla.redhat.com/2160210

commit 3ba442d5331ff4d4339faf4986d0841386196f92
Author: Luis Chamberlain <mcgrof@kernel.org>
Date:   Fri Jan 21 22:12:28 2022 -0800

    fs: move binfmt_misc sysctl 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.

    This moves the binfmt_misc sysctl to its own file to help remove clutter
    from kernel/sysctl.c.

    Link: https://lkml.kernel.org/r/20211124231435.1445213-5-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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen 32c5ae57f3 eventpoll: simplify sysctl declaration with register_sysctl()
Bugzilla: https://bugzilla.redhat.com/2160210

commit a8f5de894f76f1c73f4a068d04897a5e2f873825
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:12:09 2022 -0800

    eventpoll: simplify sysctl declaration with register_sysctl()

    The 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 epoll_table sysctl to fs/eventpoll.c and use
    register_sysctl().

    Link: https://lkml.kernel.org/r/20211123202422.819032-9-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: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Joel Becker <jlbec@evilplan.org>
    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: 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: 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: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen b205423160 inotify: simplify subdirectory registration with register_sysctl()
Bugzilla: https://bugzilla.redhat.com/2160210

commit 7b9ad122b52c9839e1f68f16c907990a6ad6f793
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:11:59 2022 -0800

    inotify: simplify subdirectory registration with register_sysctl()

    There is no need to user boiler plate code to specify a set of base
    directories we're going to stuff sysctls under.  Simplify this by using
    register_sysctl() and specifying the directory path directly.

    Move inotify_user sysctl to inotify_user.c while at it to remove clutter
    from kernel/sysctl.c.

    [mcgrof@kernel.org: remember to register fanotify_table]
      Link: https://lkml.kernel.org/r/YZ5A6iWLb0h3N3RC@bombadil.infradead.org
    [mcgrof@kernel.org: update commit log to reflect new path we decided to take]

    Link: https://lkml.kernel.org/r/20211123202422.819032-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: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Joel Becker <jlbec@evilplan.org>
    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: 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: 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: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen 477fb8f64c dnotify: move dnotify sysctl to dnotify.c
Bugzilla: https://bugzilla.redhat.com/2160210

commit 49a4de75719b6c0f1f375df9908a95cef1e34945
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:11:29 2022 -0800

    dnotify: move dnotify sysctl to dnotify.c

    The 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 dnotify sysctls to dnotify.c and use the new
    register_sysctl_init() to register the sysctl interface.

    [mcgrof@kernel.org: adjust the commit log to justify the move]

    Link: https://lkml.kernel.org/r/20211123202347.818157-10-mcgrof@kernel.org
    Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    Acked-by: Jan Kara <jack@suse.cz>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Amir Goldstein <amir73il@gmail.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Benjamin LaHaise <bcrl@kvack.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Paul Turner <pjt@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Petr Mladek <pmladek@suse.com>
    Cc: Qing Wang <wangqing@vivo.com>
    Cc: Sebastian Reichel <sre@kernel.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Stephen Kitt <steve@sk2.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Clemens Ladisch <clemens@ladisch.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Julia Lawall <julia.lawall@inria.fr>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Phillip Potter <phil@philpotter.co.uk>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen dd8c52ca92 aio: move aio sysctl to aio.c
Bugzilla: https://bugzilla.redhat.com/2160210

commit 86b12b6c5d6b46e64bf2e8080528781032e4bd90
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:11:24 2022 -0800

    aio: move aio sysctl to aio.c

    The 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 aio sysctl to aio.c and use the new register_sysctl_init() to
    register the sysctl interface for aio.

    [mcgrof@kernel.org: adjust commit log to justify the move]

    Link: https://lkml.kernel.org/r/20211123202347.818157-9-mcgrof@kernel.org
    Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Amir Goldstein <amir73il@gmail.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Benjamin LaHaise <bcrl@kvack.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Paul Turner <pjt@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Petr Mladek <pmladek@suse.com>
    Cc: Qing Wang <wangqing@vivo.com>
    Cc: Sebastian Reichel <sre@kernel.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Stephen Kitt <steve@sk2.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Clemens Ladisch <clemens@ladisch.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Julia Lawall <julia.lawall@inria.fr>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Phillip Potter <phil@philpotter.co.uk>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen f4e01cb40d sysctl: use SYSCTL_ZERO to replace some static int zero uses
Bugzilla: https://bugzilla.redhat.com/2160210

commit 2452dcb9f7f2bab5b47344148bc23a732be9195c
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:11:19 2022 -0800

    sysctl: use SYSCTL_ZERO to replace some static int zero uses

    Use the variable SYSCTL_ZERO to replace some static int boundary
    variables with a value of 0 (minolduid, min_extfrag_threshold,
    min_wakeup_granularity_ns).

    Link: https://lkml.kernel.org/r/20211123202347.818157-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: Benjamin LaHaise <bcrl@kvack.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Paul Turner <pjt@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Petr Mladek <pmladek@suse.com>
    Cc: Qing Wang <wangqing@vivo.com>
    Cc: Sebastian Reichel <sre@kernel.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Stephen Kitt <steve@sk2.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Clemens Ladisch <clemens@ladisch.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Julia Lawall <julia.lawall@inria.fr>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Phillip Potter <phil@philpotter.co.uk>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen 0f96901951 sysctl: use const for typically used max/min proc sysctls
Conflicts:
    kernel/sysctl.c - We already have e565a8ed1ee4 ("kernel/sysctl.c:
    remove unused variable ten_thousand") so lines related to the
    variable ten_thousand are gone.

Bugzilla: https://bugzilla.redhat.com/2160210

commit d73840ec2f747b860331bbba53677d0ce38fb9c1
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:11:14 2022 -0800

    sysctl: use const for typically used max/min proc sysctls

    When proc_dointvec_minmax() or proc_doulongvec_minmax() are used we are
    using the extra1 and extra2 parameters on the sysctl table only for a
    min and max boundary, these extra1 and extra2 arguments are then used
    for read-only operations.  So make them const to reflect this.

    [mcgrof@kernel.org: commit log love]

    Link: https://lkml.kernel.org/r/20211123202347.818157-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: Benjamin LaHaise <bcrl@kvack.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Paul Turner <pjt@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Petr Mladek <pmladek@suse.com>
    Cc: Qing Wang <wangqing@vivo.com>
    Cc: Sebastian Reichel <sre@kernel.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Stephen Kitt <steve@sk2.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Clemens Ladisch <clemens@ladisch.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Julia Lawall <julia.lawall@inria.fr>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Phillip Potter <phil@philpotter.co.uk>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen fbb3ba22e3 sysctl: make ngroups_max const
Bugzilla: https://bugzilla.redhat.com/2160210

commit f628867da46f8867e1854e43d7200e42ec22eee2
Author: Stephen Kitt <steve@sk2.org>
Date:   Fri Jan 21 22:11:09 2022 -0800

    sysctl: make ngroups_max const

    ngroups_max is a read-only sysctl entry, reflecting NGROUPS_MAX.  Make
    it const, in the same way as cap_last_cap.

    Link: https://lkml.kernel.org/r/20211123202347.818157-6-mcgrof@kernel.org
    Signed-off-by: Stephen Kitt <steve@sk2.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: Benjamin LaHaise <bcrl@kvack.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Paul Turner <pjt@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Petr Mladek <pmladek@suse.com>
    Cc: Qing Wang <wangqing@vivo.com>
    Cc: Sebastian Reichel <sre@kernel.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Xiaoming Ni <nixiaoming@huawei.com>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Clemens Ladisch <clemens@ladisch.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Julia Lawall <julia.lawall@inria.fr>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Phillip Potter <phil@philpotter.co.uk>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen ecfab1a3ec watchdog: move watchdog sysctl interface to watchdog.c
Bugzilla: https://bugzilla.redhat.com/2160210

commit dd0693fdf054f2ed37202ed56649ae2cccd29474
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:11:05 2022 -0800

    watchdog: move watchdog sysctl interface to watchdog.c

    The 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 of proc sysctl.

    So, move the watchdog syscl interface to watchdog.c.  Use
    register_sysctl() to register the sysctl interface to avoid merge
    conflicts when different features modify sysctl.c at the same time.

    [mcgrof@kernel.org: justify the move on the commit log]

    Link: https://lkml.kernel.org/r/20211123202347.818157-5-mcgrof@kernel.org
    Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Petr Mladek <pmladek@suse.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Amir Goldstein <amir73il@gmail.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Benjamin LaHaise <bcrl@kvack.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Paul Turner <pjt@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Qing Wang <wangqing@vivo.com>
    Cc: Sebastian Reichel <sre@kernel.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Stephen Kitt <steve@sk2.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Clemens Ladisch <clemens@ladisch.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Julia Lawall <julia.lawall@inria.fr>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Phillip Potter <phil@philpotter.co.uk>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:31 -04:00
Chris von Recklinghausen 2433f171ab hung_task: move hung_task sysctl interface to hung_task.c
Bugzilla: https://bugzilla.redhat.com/2160210

commit bbe7a10ed83a5fa0b0ff6161ecdc4e65a0e9c993
Author: Xiaoming Ni <nixiaoming@huawei.com>
Date:   Fri Jan 21 22:11:00 2022 -0800

    hung_task: move hung_task sysctl interface to hung_task.c

    The 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 hung_task sysctl interface to hung_task.c and use
    register_sysctl() to register the sysctl interface.

    [mcgrof@kernel.org: commit log refresh and fixed 2-3 0day reported compile issues]

    Link: https://lkml.kernel.org/r/20211123202347.818157-4-mcgrof@kernel.org
    Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Petr Mladek <pmladek@suse.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Amir Goldstein <amir73il@gmail.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Benjamin LaHaise <bcrl@kvack.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Paul Turner <pjt@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Qing Wang <wangqing@vivo.com>
    Cc: Sebastian Reichel <sre@kernel.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Stephen Kitt <steve@sk2.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Clemens Ladisch <clemens@ladisch.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Julia Lawall <julia.lawall@inria.fr>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Phillip Potter <phil@philpotter.co.uk>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    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>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:30 -04:00
Joel Savitz 1ac1f27d39 kernel/lockdep: move lockdep sysctls to its own file
conflict in kernel/sysctl.c
	detail: some conditional includes remain in the context due to the commits
		removing them not being backported to c9s
	action: remove relevant section and maintain context

commit f79c9b8ae8bde10126586c1bb55b5fd027276d8e
Author: tangmeng <tangmeng@uniontech.com>
Date:   Fri Feb 18 18:58:57 2022 +0800

    kernel/lockdep: move lockdep 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.

    All filesystem syctls now get reviewed by fs folks. This commit
    follows the commit of fs, move the prove_locking and lock_stat sysctls
    to its own file, kernel/lockdep.c.

    Signed-off-by: tangmeng <tangmeng@uniontech.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2176147
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
2023-03-07 15:26:28 -05:00
Herton R. Krzesinski cf11ebbf3f Merge: Fix stack overflow in do_proc_dointvec and proc_skip_spaces
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1780

Bugzilla: https://bugzilla.redhat.com/2152581

CVE: CVE-2022-4378

Signed-off-by: Wander Lairson Costa <wander@redhat.com>

a664fa0ecf (Wander Lairson Costa)
   proc: proc_skip_spaces() shouldn't think it is working on C strings

ab93541c2e (Wander Lairson Costa)
   proc: avoid integer type confusion in get_proc_long

 kernel/sysctl.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

Approved-by: Rafael Aquini <aquini@redhat.com>
Approved-by: Prarit Bhargava <prarit@redhat.com>
Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: David Arcari <darcari@redhat.com>

Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2023-02-22 14:50:37 +00:00
Herton R. Krzesinski 0c207b7728 Merge: Attend warnings with gcc 11&12 when building kernel and modules
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1852

Bugzilla: https://bugzilla.redhat.com/2159468

Attend the warnings encountered when building CentOS Stream 9 kernel and module
for x86_64 and arm64 using GCC11 (cs9) and GCC12 (f37).

Some warnings end up being disabled usptream (-Wdangling-pointer,
-Warray-bounds for GCC12 and -Wdeprecated for the sign-file.c), so backport
these changes to align with this behavior.

A few configurations were introduced to deal with -Werror and specific warnings
depending on the toolchain and target architecture. This merge-request tries to
bring these relevant patches without breaking compilation (e.g, CONFIG_WERROR
is introduced, but not set).

https://bugzilla.redhat.com/2142659 was already opened separately to
attend the -Wstringop-overread in net/core/dev.c.

Signed-off-by: Eric Chanudet <echanude@redhat.com>

Approved-by: Vladis Dronov <vdronov@redhat.com>
Approved-by: Waiman Long <longman@redhat.com>
Approved-by: Lenny Szubowicz <lszubowi@redhat.com>
Approved-by: Prarit Bhargava <prarit@redhat.com>
Approved-by: Jonathan Toppins <jtoppins@redhat.com>
Approved-by: Jarod Wilson <jarod@redhat.com>

Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2023-02-15 18:54:57 +00:00
Eric Chanudet 2fc670eaee kernel/sysctl.c: remove unused variable ten_thousand
Bugzilla: https://bugzilla.redhat.com/2159468
Conflicts: context mismatch, change not backported:
    b1f2aff888af sysctl: share unsigned long const values

commit e565a8ed1ee4b481539b66cd6f54df9ecf1e9861
Author: Colin Ian King <colin.i.king@gmail.com>
Date:   Fri Jan 21 22:13:45 2022 -0800

    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>

Signed-off-by: Eric Chanudet <echanude@redhat.com>
2023-01-09 13:31:21 -05:00
Guillaume Nault 1a486afc33 sysctl: Fix data-races in proc_dointvec_ms_jiffies().
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149949
Upstream Status: linux.git

commit 7d1025e559782b58824b36cb8ad547a69f2e4b31
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Mon Jul 11 17:15:20 2022 -0700

    sysctl: Fix data-races in proc_dointvec_ms_jiffies().

    A sysctl variable is accessed concurrently, and there is always a chance
    of data-race.  So, all readers and writers need some basic protection to
    avoid load/store-tearing.

    This patch changes proc_dointvec_ms_jiffies() to use READ_ONCE() and
    WRITE_ONCE() internally to fix data-races on the sysctl side.  For now,
    proc_dointvec_ms_jiffies() itself is tolerant to a data-race, but we still
    need to add annotations on the other subsystem's side.

    Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
2022-12-22 11:37:50 +01:00
Guillaume Nault 81801e5d8a sysctl: Fix data-races in proc_dou8vec_minmax().
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149949
Upstream Status: linux.git

commit 7dee5d7747a69aa2be41f04c6a7ecfe3ac8cdf18
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Mon Jul 11 17:15:19 2022 -0700

    sysctl: Fix data-races in proc_dou8vec_minmax().

    A sysctl variable is accessed concurrently, and there is always a chance
    of data-race.  So, all readers and writers need some basic protection to
    avoid load/store-tearing.

    This patch changes proc_dou8vec_minmax() to use READ_ONCE() and
    WRITE_ONCE() internally to fix data-races on the sysctl side.  For now,
    proc_dou8vec_minmax() itself is tolerant to a data-race, but we still
    need to add annotations on the other subsystem's side.

    Fixes: cb94441306 ("sysctl: add proc_dou8vec_minmax()")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
2022-12-22 11:37:50 +01:00
Guillaume Nault 24a3760e9d sysctl: Fix data races in proc_dointvec_jiffies().
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149949
Upstream Status: linux.git

commit e877820877663fbae8cb9582ea597a7230b94df3
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Wed Jul 6 16:39:57 2022 -0700

    sysctl: Fix data races in proc_dointvec_jiffies().

    A sysctl variable is accessed concurrently, and there is always a chance
    of data-race.  So, all readers and writers need some basic protection to
    avoid load/store-tearing.

    This patch changes proc_dointvec_jiffies() to use READ_ONCE() and
    WRITE_ONCE() internally to fix data-races on the sysctl side.  For now,
    proc_dointvec_jiffies() itself is tolerant to a data-race, but we still
    need to add annotations on the other subsystem's side.

    Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
2022-12-22 11:37:49 +01:00
Guillaume Nault 89dbc7e5bc sysctl: Fix data races in proc_doulongvec_minmax().
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149949
Upstream Status: linux.git

commit c31bcc8fb89fc2812663900589c6325ba35d9a65
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Wed Jul 6 16:39:56 2022 -0700

    sysctl: Fix data races in proc_doulongvec_minmax().

    A sysctl variable is accessed concurrently, and there is always a chance
    of data-race.  So, all readers and writers need some basic protection to
    avoid load/store-tearing.

    This patch changes proc_doulongvec_minmax() to use READ_ONCE() and
    WRITE_ONCE() internally to fix data-races on the sysctl side.  For now,
    proc_doulongvec_minmax() itself is tolerant to a data-race, but we still
    need to add annotations on the other subsystem's side.

    Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
2022-12-22 11:37:48 +01:00
Guillaume Nault 5f25b872ce sysctl: Fix data races in proc_douintvec_minmax().
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149949
Upstream Status: linux.git

commit 2d3b559df3ed39258737789aae2ae7973d205bc1
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Wed Jul 6 16:39:55 2022 -0700

    sysctl: Fix data races in proc_douintvec_minmax().

    A sysctl variable is accessed concurrently, and there is always a chance
    of data-race.  So, all readers and writers need some basic protection to
    avoid load/store-tearing.

    This patch changes proc_douintvec_minmax() to use READ_ONCE() and
    WRITE_ONCE() internally to fix data-races on the sysctl side.  For now,
    proc_douintvec_minmax() itself is tolerant to a data-race, but we still
    need to add annotations on the other subsystem's side.

    Fixes: 61d9b56a89 ("sysctl: add unsigned int range support")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
2022-12-22 11:37:48 +01:00
Guillaume Nault 2abc1a19f8 sysctl: Fix data races in proc_dointvec_minmax().
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149949
Upstream Status: linux.git

commit f613d86d014b6375a4085901de39406598121e35
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Wed Jul 6 16:39:54 2022 -0700

    sysctl: Fix data races in proc_dointvec_minmax().

    A sysctl variable is accessed concurrently, and there is always a chance
    of data-race.  So, all readers and writers need some basic protection to
    avoid load/store-tearing.

    This patch changes proc_dointvec_minmax() to use READ_ONCE() and
    WRITE_ONCE() internally to fix data-races on the sysctl side.  For now,
    proc_dointvec_minmax() itself is tolerant to a data-race, but we still
    need to add annotations on the other subsystem's side.

    Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
2022-12-22 11:37:48 +01:00
Guillaume Nault b5db46ad20 sysctl: Fix data races in proc_douintvec().
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2149949
Upstream Status: linux.git

commit 4762b532ec9539755aab61445d5da6e1926ccb99
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Wed Jul 6 16:39:53 2022 -0700

    sysctl: Fix data races in proc_douintvec().

    A sysctl variable is accessed concurrently, and there is always a chance
    of data-race.  So, all readers and writers need some basic protection to
    avoid load/store-tearing.

    This patch changes proc_douintvec() to use READ_ONCE() and WRITE_ONCE()
    internally to fix data-races on the sysctl side.  For now, proc_douintvec()
    itself is tolerant to a data-race, but we still need to add annotations on
    the other subsystem's side.

    Fixes: e7d316a02f ("sysctl: handle error writing UINT_MAX to u32 fields")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
2022-12-22 11:37:48 +01:00