linux/fs/proc
Thomas Weißschuh 559d4c6a9d sysctl: avoid spurious permanent empty tables
The test if a table is a permanently empty one, inspects the address of
the registered ctl_table argument.
However as sysctl_mount_point is an empty array and does not occupy and
space it can end up sharing an address with another object in memory.
If that other object itself is a "struct ctl_table" then registering
that table will fail as it's incorrectly recognized as permanently empty.

Avoid this issue by adding a dummy element to the array so that is not
empty anymore.
Explicitly register the table with zero elements as otherwise the dummy
element would be recognized as a sentinel element which would lead to a
runtime warning from the sysctl core.

While the issue seems not being encountered at this time, this seems
mostly to be due to luck.
Also a future change, constifying sysctl_mount_point and root_table, can
reliably trigger this issue on clang 18.

Given that empty arrays are non-standard in the first place it seems
prudent to avoid them if possible.

Fixes: 4a7b29f650 ("sysctl: move sysctl type to ctl_table_header")
Fixes: a35dd3a786 ("sysctl: drop now unnecessary out-of-bounds check")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Closes: https://lore.kernel.org/oe-lkp/202408051453.f638857e-lkp@intel.com
Signed-off-by: Joel Granados <j.granados@samsung.com>
2024-09-02 10:37:37 +02:00
..
array.c fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats 2024-02-07 21:20:33 -08:00
base.c mm/ksm: fix ksm_zero_pages accounting 2024-06-05 19:19:26 -07:00
bootconfig.c fs/proc: Skip bootloader comment if no embedded kernel parameters 2024-04-09 23:36:18 +09:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c Assorted commits that had missed the last merge window... 2024-05-21 13:11:44 -07:00
fd.h
generic.c proc: Remove usage of the deprecated ida_simple_xx() API 2024-06-25 11:15:47 +02:00
inode.c mm: switch mm->get_unmapped_area() to a flag 2024-04-25 20:56:25 -07:00
internal.h fs/proc: move page_mapcount() to fs/proc/internal.h 2024-07-03 19:30:06 -07:00
interrupts.c
Kconfig crash: split vmcoreinfo exporting code out from crash_core.c 2024-02-23 17:48:22 -08:00
kcore.c crash: split vmcoreinfo exporting code out from crash_core.c 2024-02-23 17:48:22 -08:00
kmsg.c
loadavg.c
Makefile kbuild: make -Woverride-init warnings more consistent 2024-03-31 11:32:26 +09:00
meminfo.c mm: zswap: optimize zswap pool size tracking 2024-04-25 20:55:47 -07:00
namespaces.c
nommu.c fs: create helper file_user_path() for user displayed mapped file path 2023-10-19 11:03:15 +02:00
page.c kpageflags: detect isolated KPF_THP folios 2024-07-12 15:52:21 -07:00
proc_net.c fs: Add kernel-doc comments to proc_create_net_data_write() 2024-03-26 09:01:18 +01:00
proc_sysctl.c sysctl: avoid spurious permanent empty tables 2024-09-02 10:37:37 +02:00
proc_tty.c
root.c procfs: make freeing proc_fs_info rcu-delayed 2024-02-25 02:10:32 -05:00
self.c proc: convert to new timestamp accessors 2023-10-18 14:08:26 +02:00
softirqs.c
stat.c proc/stat: remove arch_idle_time() 2023-04-18 16:39:33 -07:00
task_mmu.c Random number generator updates for Linux 6.11-rc1. 2024-07-24 10:29:50 -07:00
task_nommu.c vfs-6.7.misc 2023-10-30 09:14:19 -10:00
thread_self.c proc: convert to new timestamp accessors 2023-10-18 14:08:26 +02:00
uptime.c
util.c
version.c
vmcore.c fs/proc: fix softlockup in __read_vmcore 2024-05-11 15:51:44 -07:00