2019-05-29 07:17:56 -07:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-14 16:51:56 -08:00
|
|
|
|
2020-10-02 10:38:15 -07:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2020-06-20 09:16:41 +02:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-27 08:35:25 -07:00
|
|
|
|
|
|
|
|
|
2023-09-12 13:56:46 -07:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
2022-09-06 18:18:12 -07:00
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-09-24 14:43:59 -07:00
|
|
|
|
2019-05-30 12:22:08 -07:00
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2022-06-27 08:35:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
2025-12-05 09:43:11 +01:00
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
2025-12-05 09:43:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
2018-09-24 14:43:59 -07:00
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2025-12-05 09:43:11 +01:00
|
|
|
|
|
|
|
|
|
proc/sysctl: add shared variables for range check
In the sysctl code the proc_dointvec_minmax() function is often used to
validate the user supplied value between an allowed range. This
function uses the extra1 and extra2 members from struct ctl_table as
minimum and maximum allowed value.
On sysctl handler declaration, in every source file there are some
readonly variables containing just an integer which address is assigned
to the extra1 and extra2 members, so the sysctl range is enforced.
The special values 0, 1 and INT_MAX are very often used as range
boundary, leading duplication of variables like zero=0, one=1,
int_max=INT_MAX in different source files:
$ git grep -E '\.extra[12].*&(zero|one|int_max)' |wc -l
248
Add a const int array containing the most commonly used values, some
macros to refer more easily to the correct array member, and use them
instead of creating a local one for every object file.
This is the bloat-o-meter output comparing the old and new binary
compiled with the default Fedora config:
# scripts/bloat-o-meter -d vmlinux.o.old vmlinux.o
add/remove: 2/2 grow/shrink: 0/2 up/down: 24/-188 (-164)
Data old new delta
sysctl_vals - 12 +12
__kstrtab_sysctl_vals - 12 +12
max 14 10 -4
int_max 16 - -16
one 68 - -68
zero 128 28 -100
Total: Before=20583249, After=20583085, chg -0.00%
[mcroce@redhat.com: tipc: remove two unused variables]
Link: http://lkml.kernel.org/r/20190530091952.4108-1-mcroce@redhat.com
[akpm@linux-foundation.org: fix net/ipv6/sysctl_net_ipv6.c]
[arnd@arndb.de: proc/sysctl: make firmware loader table conditional]
Link: http://lkml.kernel.org/r/20190617130014.1713870-1-arnd@arndb.de
[akpm@linux-foundation.org: fix fs/eventpoll.c]
Link: http://lkml.kernel.org/r/20190430180111.10688-1-mcroce@redhat.com
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-07-18 15:58:50 -07:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:43 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
2022-05-12 08:20:14 +02:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:42 -08:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:43 -08:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:42 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:45 -08:00
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:45 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-09 11:54:57 -08:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:44 -08:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
2019-05-30 12:22:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2018-09-24 14:43:59 -07:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:45 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-09 11:57:44 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-05 09:43:11 +01:00
|
|
|
|
|
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-27 08:35:25 -07:00
|
|
|
|
|
|
|
|
|
2018-09-24 14:43:59 -07:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-09 11:54:57 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 10:38:20 -07:00
|
|
|
|
2018-07-13 14:06:02 -04:00
|
|
|
|
2022-12-09 11:54:57 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-13 14:06:02 -04:00
|
|
|
|
|
|
|
|
|
2023-11-10 12:09:33 -05:00
|
|
|
|
2023-09-12 13:56:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selinux: remove the runtime disable functionality
After working with the larger SELinux-based distros for several
years, we're finally at a place where we can disable the SELinux
runtime disable functionality. The existing kernel deprecation
notice explains the functionality and why we want to remove it:
The selinuxfs "disable" node allows SELinux to be disabled at
runtime prior to a policy being loaded into the kernel. If
disabled via this mechanism, SELinux will remain disabled until
the system is rebooted.
The preferred method of disabling SELinux is via the "selinux=0"
boot parameter, but the selinuxfs "disable" node was created to
make it easier for systems with primitive bootloaders that did not
allow for easy modification of the kernel command line.
Unfortunately, allowing for SELinux to be disabled at runtime makes
it difficult to secure the kernel's LSM hooks using the
"__ro_after_init" feature.
It is that last sentence, mentioning the '__ro_after_init' hardening,
which is the real motivation for this change, and if you look at the
diffstat you'll see that the impact of this patch reaches across all
the different LSMs, helping prevent tampering at the LSM hook level.
From a SELinux perspective, it is important to note that if you
continue to disable SELinux via "/etc/selinux/config" it may appear
that SELinux is disabled, but it is simply in an uninitialized state.
If you load a policy with `load_policy -i`, you will see SELinux
come alive just as if you had loaded the policy during early-boot.
It is also worth noting that the "/sys/fs/selinux/disable" file is
always writable now, regardless of the Kconfig settings, but writing
to the file has no effect on the system, other than to display an
error on the console if a non-zero/true value is written.
Finally, in the several years where we have been working on
deprecating this functionality, there has only been one instance of
someone mentioning any user visible breakage. In this particular
case it was an individual's kernel test system, and the workaround
documented in the deprecation notice ("selinux=0" on the kernel
command line) resolved the issue without problem.
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
2023-03-17 12:43:07 -04:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2018-07-13 14:06:02 -04:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2019-05-30 12:22:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-09-14 15:26:37 -07:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
2018-09-24 14:43:59 -07:00
|
|
|
|
|
|
|
|
|
2019-05-30 12:22:08 -07:00
|
|
|
|
2022-12-09 11:57:43 -08:00
|
|
|
|
2023-03-02 12:28:20 -08:00
|
|
|
|
2022-12-09 11:57:43 -08:00
|
|
|
|
|
|
|
|
|
2023-09-12 13:56:46 -07:00
|
|
|
|
|
|
|
|
|
2022-06-27 08:35:25 -07:00
|
|
|
|
2018-09-14 15:26:37 -07:00
|
|
|
|
2016-04-20 15:46:28 -07:00
|
|
|
|
|
|
|
|
|
2022-06-27 08:35:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-19 21:19:02 -04:00
|
|
|
|
|
|
|
|
|
2022-06-27 08:35:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-31 14:12:01 -04:00
|
|
|
|
2022-06-27 08:35:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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