2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-19 16:34:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-12-08 08:49:22 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2020-02-21 17:55:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2014-12-12 16:58:17 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-12 16:58:17 -08:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2009-12-11 14:23:44 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2009-12-11 14:23:44 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2009-12-11 14:23:44 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2009-12-11 14:23:44 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2009-12-11 14:23:44 -08:00
|
|
|
|
|
|
|
|
|
2020-03-15 13:26:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-23 20:36:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2011-10-31 17:11:20 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2011-10-31 17:11:20 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-11 18:36:20 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
2006-10-11 01:21:57 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2009-09-23 15:56:56 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-23 15:56:56 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2010-11-11 14:05:18 -08:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-03 20:20:18 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2010-11-11 14:05:18 -08:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2010-11-11 14:05:18 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-04-29 22:57:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2020-04-29 22:57:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-29 22:57:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2020-04-29 22:57:56 +02:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2015-11-05 18:44:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2017-12-10 01:48:46 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-10 01:48:46 -06:00
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2017-12-10 01:48:46 -06:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2021-04-20 14:06:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-06-14 21:11:00 -07:00
|
|
|
|
|
|
|
|
|
kernel/hung_task.c: introduce sysctl to print all traces when a hung task is detected
Commit 401c636a0eeb ("kernel/hung_task.c: show all hung tasks before
panic") introduced a change in that we started to show all CPUs
backtraces when a hung task is detected _and_ the sysctl/kernel
parameter "hung_task_panic" is set. The idea is good, because usually
when observing deadlocks (that may lead to hung tasks), the culprit is
another task holding a lock and not necessarily the task detected as
hung.
The problem with this approach is that dumping backtraces is a slightly
expensive task, specially printing that on console (and specially in
many CPU machines, as servers commonly found nowadays). So, users that
plan to collect a kdump to investigate the hung tasks and narrow down
the deadlock definitely don't need the CPUs backtrace on dmesg/console,
which will delay the panic and pollute the log (crash tool would easily
grab all CPUs traces with 'bt -a' command).
Also, there's the reciprocal scenario: some users may be interested in
seeing the CPUs backtraces but not have the system panic when a hung
task is detected. The current approach hence is almost as embedding a
policy in the kernel, by forcing the CPUs backtraces' dump (only) on
hung_task_panic.
This patch decouples the panic event on hung task from the CPUs
backtraces dump, by creating (and documenting) a new sysctl called
"hung_task_all_cpu_backtrace", analog to the approach taken on soft/hard
lockups, that have both a panic and an "all_cpu_backtrace" sysctl to
allow individual control. The new mechanism for dumping the CPUs
backtraces on hung task detection respects "hung_task_warnings" by not
dumping the traces in case there's no warnings left.
Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Link: http://lkml.kernel.org/r/20200327223646.20779-1-gpiccoli@canonical.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-07 21:40:45 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
2018-08-21 21:55:52 -07:00
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2018-08-21 21:55:52 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-21 21:55:52 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-21 21:55:52 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
|
|
|
|
|
2014-01-27 09:00:57 +00:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2014-01-20 17:34:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2018-07-08 02:56:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-08 02:56:51 +00:00
|
|
|
|
|
|
|
|
|
2020-05-15 23:24:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
kexec: add sysctl to disable kexec_load
For general-purpose (i.e. distro) kernel builds it makes sense to build
with CONFIG_KEXEC to allow end users to choose what kind of things they
want to do with kexec. However, in the face of trying to lock down a
system with such a kernel, there needs to be a way to disable kexec_load
(much like module loading can be disabled). Without this, it is too easy
for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM
and modules_disabled are set. With this change, it is still possible to
load an image for use later, then disable kexec_load so the image (or lack
of image) can't be altered.
The intention is for using this in environments where "perfect"
enforcement is hard. Without a verified boot, along with verified
modules, and along with verified kexec, this is trying to give a system a
better chance to defend itself (or at least grow the window of
discoverability) against attack in the face of a privilege escalation.
In my mind, I consider several boot scenarios:
1) Verified boot of read-only verified root fs loading fd-based
verification of kexec images.
2) Secure boot of writable root fs loading signed kexec images.
3) Regular boot loading kexec (e.g. kcrash) image early and locking it.
4) Regular boot with no control of kexec image at all.
1 and 2 don't exist yet, but will soon once the verified kexec series has
landed. 4 is the state of things now. The gap between 2 and 4 is too
large, so this change creates scenario 3, a middle-ground above 4 when 2
and 1 are not possible for a system.
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-23 15:55:59 -08:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kexec: add sysctl to disable kexec_load
For general-purpose (i.e. distro) kernel builds it makes sense to build
with CONFIG_KEXEC to allow end users to choose what kind of things they
want to do with kexec. However, in the face of trying to lock down a
system with such a kernel, there needs to be a way to disable kexec_load
(much like module loading can be disabled). Without this, it is too easy
for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM
and modules_disabled are set. With this change, it is still possible to
load an image for use later, then disable kexec_load so the image (or lack
of image) can't be altered.
The intention is for using this in environments where "perfect"
enforcement is hard. Without a verified boot, along with verified
modules, and along with verified kexec, this is trying to give a system a
better chance to defend itself (or at least grow the window of
discoverability) against attack in the face of a privilege escalation.
In my mind, I consider several boot scenarios:
1) Verified boot of read-only verified root fs loading fd-based
verification of kexec images.
2) Secure boot of writable root fs loading signed kexec images.
3) Regular boot loading kexec (e.g. kcrash) image early and locking it.
4) Regular boot with no control of kexec image at all.
1 and 2 don't exist yet, but will soon once the verified kexec series has
landed. 4 is the state of things now. The gap between 2 and 4 is too
large, so this change creates scenario 3, a middle-ground above 4 when 2
and 1 are not possible for a system.
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-23 15:55:59 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
kptr_restrict for hiding kernel pointers from unprivileged users
Add the %pK printk format specifier and the /proc/sys/kernel/kptr_restrict
sysctl.
The %pK format specifier is designed to hide exposed kernel pointers,
specifically via /proc interfaces. Exposing these pointers provides an
easy target for kernel write vulnerabilities, since they reveal the
locations of writable structures containing easily triggerable function
pointers. The behavior of %pK depends on the kptr_restrict sysctl.
If kptr_restrict is set to 0, no deviation from the standard %p behavior
occurs. If kptr_restrict is set to 1, the default, if the current user
(intended to be a reader via seq_printf(), etc.) does not have CAP_SYSLOG
(currently in the LSM tree), kernel pointers using %pK are printed as 0's.
If kptr_restrict is set to 2, kernel pointers using %pK are printed as
0's regardless of privileges. Replacing with 0's was chosen over the
default "(null)", which cannot be parsed by userland %p, which expects
"(nil)".
[akpm@linux-foundation.org: check for IRQ context when !kptr_restrict, save an indent level, s/WARN/WARN_ONCE/]
[akpm@linux-foundation.org: coding-style fixup]
[randy.dunlap@oracle.com: fix kernel/sysctl.c warning]
Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: James Morris <jmorris@namei.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Thomas Graf <tgraf@infradead.org>
Cc: Eugene Teo <eugeneteo@kernel.org>
Cc: Kees Cook <kees.cook@canonical.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Eric Paris <eparis@parisplace.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-12 16:59:41 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2013-11-12 15:08:51 -08:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-12 15:08:51 -08:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-12 15:08:51 -08:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
kptr_restrict for hiding kernel pointers from unprivileged users
Add the %pK printk format specifier and the /proc/sys/kernel/kptr_restrict
sysctl.
The %pK format specifier is designed to hide exposed kernel pointers,
specifically via /proc interfaces. Exposing these pointers provides an
easy target for kernel write vulnerabilities, since they reveal the
locations of writable structures containing easily triggerable function
pointers. The behavior of %pK depends on the kptr_restrict sysctl.
If kptr_restrict is set to 0, no deviation from the standard %p behavior
occurs. If kptr_restrict is set to 1, the default, if the current user
(intended to be a reader via seq_printf(), etc.) does not have CAP_SYSLOG
(currently in the LSM tree), kernel pointers using %pK are printed as 0's.
If kptr_restrict is set to 2, kernel pointers using %pK are printed as
0's regardless of privileges. Replacing with 0's was chosen over the
default "(null)", which cannot be parsed by userland %p, which expects
"(nil)".
[akpm@linux-foundation.org: check for IRQ context when !kptr_restrict, save an indent level, s/WARN/WARN_ONCE/]
[akpm@linux-foundation.org: coding-style fixup]
[randy.dunlap@oracle.com: fix kernel/sysctl.c warning]
Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: James Morris <jmorris@namei.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Thomas Graf <tgraf@infradead.org>
Cc: Eugene Teo <eugeneteo@kernel.org>
Cc: Kees Cook <kees.cook@canonical.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Eric Paris <eparis@parisplace.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-12 16:59:41 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-14 10:24:30 -07:00
|
|
|
|
2021-05-14 17:27:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-14 10:24:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-14 10:24:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2020-04-14 10:24:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-02 15:49:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2009-04-02 15:49:29 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-04 15:34:50 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2013-01-04 15:34:50 -08:00
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-04 15:34:50 -08:00
|
|
|
|
2020-05-18 16:58:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2013-10-07 11:28:40 +01:00
|
|
|
|
NUMA balancing: optimize page placement for memory tiering system
With the advent of various new memory types, some machines will have
multiple types of memory, e.g. DRAM and PMEM (persistent memory). The
memory subsystem of these machines can be called memory tiering system,
because the performance of the different types of memory are usually
different.
In such system, because of the memory accessing pattern changing etc,
some pages in the slow memory may become hot globally. So in this
patch, the NUMA balancing mechanism is enhanced to optimize the page
placement among the different memory types according to hot/cold
dynamically.
In a typical memory tiering system, there are CPUs, fast memory and slow
memory in each physical NUMA node. The CPUs and the fast memory will be
put in one logical node (called fast memory node), while the slow memory
will be put in another (faked) logical node (called slow memory node).
That is, the fast memory is regarded as local while the slow memory is
regarded as remote. So it's possible for the recently accessed pages in
the slow memory node to be promoted to the fast memory node via the
existing NUMA balancing mechanism.
The original NUMA balancing mechanism will stop to migrate pages if the
free memory of the target node becomes below the high watermark. This
is a reasonable policy if there's only one memory type. But this makes
the original NUMA balancing mechanism almost do not work to optimize
page placement among different memory types. Details are as follows.
It's the common cases that the working-set size of the workload is
larger than the size of the fast memory nodes. Otherwise, it's
unnecessary to use the slow memory at all. So, there are almost always
no enough free pages in the fast memory nodes, so that the globally hot
pages in the slow memory node cannot be promoted to the fast memory
node. To solve the issue, we have 2 choices as follows,
a. Ignore the free pages watermark checking when promoting hot pages
from the slow memory node to the fast memory node. This will
create some memory pressure in the fast memory node, thus trigger
the memory reclaiming. So that, the cold pages in the fast memory
node will be demoted to the slow memory node.
b. Define a new watermark called wmark_promo which is higher than
wmark_high, and have kswapd reclaiming pages until free pages reach
such watermark. The scenario is as follows: when we want to promote
hot-pages from a slow memory to a fast memory, but fast memory's free
pages would go lower than high watermark with such promotion, we wake
up kswapd with wmark_promo watermark in order to demote cold pages and
free us up some space. So, next time we want to promote hot-pages we
might have a chance of doing so.
The choice "a" may create high memory pressure in the fast memory node.
If the memory pressure of the workload is high, the memory pressure
may become so high that the memory allocation latency of the workload
is influenced, e.g. the direct reclaiming may be triggered.
The choice "b" works much better at this aspect. If the memory
pressure of the workload is high, the hot pages promotion will stop
earlier because its allocation watermark is higher than that of the
normal memory allocation. So in this patch, choice "b" is implemented.
A new zone watermark (WMARK_PROMO) is added. Which is larger than the
high watermark and can be controlled via watermark_scale_factor.
In addition to the original page placement optimization among sockets,
the NUMA balancing mechanism is extended to be used to optimize page
placement according to hot/cold among different memory types. So the
sysctl user space interface (numa_balancing) is extended in a backward
compatible way as follow, so that the users can enable/disable these
functionality individually.
The sysctl is converted from a Boolean value to a bits field. The
definition of the flags is,
- 0: NUMA_BALANCING_DISABLED
- 1: NUMA_BALANCING_NORMAL
- 2: NUMA_BALANCING_MEMORY_TIERING
We have tested the patch with the pmbench memory accessing benchmark
with the 80:20 read/write ratio and the Gauss access address
distribution on a 2 socket Intel server with Optane DC Persistent
Memory Model. The test results shows that the pmbench score can
improve up to 95.9%.
Thanks Andrew Morton to help fix the document format error.
Link: https://lkml.kernel.org/r/20220221084529.1052339-3-ying.huang@intel.com
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Tested-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Wei Xu <weixugc@google.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: zhongjiang-ali <zhongjiang-ali@linux.alibaba.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Feng Tang <feng.tang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-03-22 14:46:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-07 11:28:40 +01:00
|
|
|
|
NUMA balancing: optimize page placement for memory tiering system
With the advent of various new memory types, some machines will have
multiple types of memory, e.g. DRAM and PMEM (persistent memory). The
memory subsystem of these machines can be called memory tiering system,
because the performance of the different types of memory are usually
different.
In such system, because of the memory accessing pattern changing etc,
some pages in the slow memory may become hot globally. So in this
patch, the NUMA balancing mechanism is enhanced to optimize the page
placement among the different memory types according to hot/cold
dynamically.
In a typical memory tiering system, there are CPUs, fast memory and slow
memory in each physical NUMA node. The CPUs and the fast memory will be
put in one logical node (called fast memory node), while the slow memory
will be put in another (faked) logical node (called slow memory node).
That is, the fast memory is regarded as local while the slow memory is
regarded as remote. So it's possible for the recently accessed pages in
the slow memory node to be promoted to the fast memory node via the
existing NUMA balancing mechanism.
The original NUMA balancing mechanism will stop to migrate pages if the
free memory of the target node becomes below the high watermark. This
is a reasonable policy if there's only one memory type. But this makes
the original NUMA balancing mechanism almost do not work to optimize
page placement among different memory types. Details are as follows.
It's the common cases that the working-set size of the workload is
larger than the size of the fast memory nodes. Otherwise, it's
unnecessary to use the slow memory at all. So, there are almost always
no enough free pages in the fast memory nodes, so that the globally hot
pages in the slow memory node cannot be promoted to the fast memory
node. To solve the issue, we have 2 choices as follows,
a. Ignore the free pages watermark checking when promoting hot pages
from the slow memory node to the fast memory node. This will
create some memory pressure in the fast memory node, thus trigger
the memory reclaiming. So that, the cold pages in the fast memory
node will be demoted to the slow memory node.
b. Define a new watermark called wmark_promo which is higher than
wmark_high, and have kswapd reclaiming pages until free pages reach
such watermark. The scenario is as follows: when we want to promote
hot-pages from a slow memory to a fast memory, but fast memory's free
pages would go lower than high watermark with such promotion, we wake
up kswapd with wmark_promo watermark in order to demote cold pages and
free us up some space. So, next time we want to promote hot-pages we
might have a chance of doing so.
The choice "a" may create high memory pressure in the fast memory node.
If the memory pressure of the workload is high, the memory pressure
may become so high that the memory allocation latency of the workload
is influenced, e.g. the direct reclaiming may be triggered.
The choice "b" works much better at this aspect. If the memory
pressure of the workload is high, the hot pages promotion will stop
earlier because its allocation watermark is higher than that of the
normal memory allocation. So in this patch, choice "b" is implemented.
A new zone watermark (WMARK_PROMO) is added. Which is larger than the
high watermark and can be controlled via watermark_scale_factor.
In addition to the original page placement optimization among sockets,
the NUMA balancing mechanism is extended to be used to optimize page
placement according to hot/cold among different memory types. So the
sysctl user space interface (numa_balancing) is extended in a backward
compatible way as follow, so that the users can enable/disable these
functionality individually.
The sysctl is converted from a Boolean value to a bits field. The
definition of the flags is,
- 0: NUMA_BALANCING_DISABLED
- 1: NUMA_BALANCING_NORMAL
- 2: NUMA_BALANCING_MEMORY_TIERING
We have tested the patch with the pmbench memory accessing benchmark
with the 80:20 read/write ratio and the Gauss access address
distribution on a 2 socket Intel server with Optane DC Persistent
Memory Model. The test results shows that the pmbench score can
improve up to 95.9%.
Thanks Andrew Morton to help fix the document format error.
Link: https://lkml.kernel.org/r/20220221084529.1052339-3-ying.huang@intel.com
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Tested-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Wei Xu <weixugc@google.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: zhongjiang-ali <zhongjiang-ali@linux.alibaba.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Feng Tang <feng.tang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-03-22 14:46:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-07 11:28:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-10 13:25:14 +08:00
|
|
|
|
2013-10-07 11:28:40 +01:00
|
|
|
|
NUMA balancing: optimize page placement for memory tiering system
With the advent of various new memory types, some machines will have
multiple types of memory, e.g. DRAM and PMEM (persistent memory). The
memory subsystem of these machines can be called memory tiering system,
because the performance of the different types of memory are usually
different.
In such system, because of the memory accessing pattern changing etc,
some pages in the slow memory may become hot globally. So in this
patch, the NUMA balancing mechanism is enhanced to optimize the page
placement among the different memory types according to hot/cold
dynamically.
In a typical memory tiering system, there are CPUs, fast memory and slow
memory in each physical NUMA node. The CPUs and the fast memory will be
put in one logical node (called fast memory node), while the slow memory
will be put in another (faked) logical node (called slow memory node).
That is, the fast memory is regarded as local while the slow memory is
regarded as remote. So it's possible for the recently accessed pages in
the slow memory node to be promoted to the fast memory node via the
existing NUMA balancing mechanism.
The original NUMA balancing mechanism will stop to migrate pages if the
free memory of the target node becomes below the high watermark. This
is a reasonable policy if there's only one memory type. But this makes
the original NUMA balancing mechanism almost do not work to optimize
page placement among different memory types. Details are as follows.
It's the common cases that the working-set size of the workload is
larger than the size of the fast memory nodes. Otherwise, it's
unnecessary to use the slow memory at all. So, there are almost always
no enough free pages in the fast memory nodes, so that the globally hot
pages in the slow memory node cannot be promoted to the fast memory
node. To solve the issue, we have 2 choices as follows,
a. Ignore the free pages watermark checking when promoting hot pages
from the slow memory node to the fast memory node. This will
create some memory pressure in the fast memory node, thus trigger
the memory reclaiming. So that, the cold pages in the fast memory
node will be demoted to the slow memory node.
b. Define a new watermark called wmark_promo which is higher than
wmark_high, and have kswapd reclaiming pages until free pages reach
such watermark. The scenario is as follows: when we want to promote
hot-pages from a slow memory to a fast memory, but fast memory's free
pages would go lower than high watermark with such promotion, we wake
up kswapd with wmark_promo watermark in order to demote cold pages and
free us up some space. So, next time we want to promote hot-pages we
might have a chance of doing so.
The choice "a" may create high memory pressure in the fast memory node.
If the memory pressure of the workload is high, the memory pressure
may become so high that the memory allocation latency of the workload
is influenced, e.g. the direct reclaiming may be triggered.
The choice "b" works much better at this aspect. If the memory
pressure of the workload is high, the hot pages promotion will stop
earlier because its allocation watermark is higher than that of the
normal memory allocation. So in this patch, choice "b" is implemented.
A new zone watermark (WMARK_PROMO) is added. Which is larger than the
high watermark and can be controlled via watermark_scale_factor.
In addition to the original page placement optimization among sockets,
the NUMA balancing mechanism is extended to be used to optimize page
placement according to hot/cold among different memory types. So the
sysctl user space interface (numa_balancing) is extended in a backward
compatible way as follow, so that the users can enable/disable these
functionality individually.
The sysctl is converted from a Boolean value to a bits field. The
definition of the flags is,
- 0: NUMA_BALANCING_DISABLED
- 1: NUMA_BALANCING_NORMAL
- 2: NUMA_BALANCING_MEMORY_TIERING
We have tested the patch with the pmbench memory accessing benchmark
with the 80:20 read/write ratio and the Gauss access address
distribution on a 2 socket Intel server with Optane DC Persistent
Memory Model. The test results shows that the pmbench score can
improve up to 95.9%.
Thanks Andrew Morton to help fix the document format error.
Link: https://lkml.kernel.org/r/20220221084529.1052339-3-ying.huang@intel.com
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Tested-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Wei Xu <weixugc@google.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: zhongjiang-ali <zhongjiang-ali@linux.alibaba.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Feng Tang <feng.tang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-03-22 14:46:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-07 11:28:40 +01:00
|
|
|
|
2020-06-14 21:11:00 -07:00
|
|
|
|
|
|
|
|
|
2020-06-07 21:40:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2015-12-14 11:19:14 +01:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2015-12-14 11:19:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-12-14 11:19:14 +01:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2011-11-29 15:08:36 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2011-11-29 15:08:36 +09:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-29 15:08:36 +09:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2014-12-10 15:45:50 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2014-12-10 15:45:50 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2014-12-10 15:45:50 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-10 15:45:50 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2019-01-03 15:28:20 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2022-03-23 16:07:03 -07:00
|
|
|
|
2022-03-23 16:07:06 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
2019-01-03 15:28:20 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2016-06-02 13:51:41 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-02 13:51:41 -03:00
|
|
|
|
2022-03-24 18:11:56 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-02 13:51:41 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2013-06-21 08:51:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:51:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 08:51:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2016-01-19 21:35:15 +00:00
|
|
|
|
|
|
|
|
|
2020-04-02 11:54:39 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-19 21:35:15 +00:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2020-04-02 11:54:39 +03:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-04-02 11:54:39 +03:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-04-02 11:54:39 +03:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-04-02 11:54:39 +03:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2016-01-19 21:35:15 +00:00
|
|
|
|
2011-11-29 15:08:36 +09:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2016-04-21 12:28:50 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-21 12:28:50 -03:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2016-04-21 12:28:50 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2017-08-20 14:39:20 +03:00
|
|
|
|
Documentation: fix multiple typos found in the admin-guide subdirectory
Fix thirty five typos in dm-integrity.rst, dm-raid.rst, dm-zoned.rst,
verity.rst, writecache.rst, tsx_async_abort.rst, md.rst, bttv.rst,
dvb_references.rst, frontend-cardlist.rst, gspca-cardlist.rst, ipu3.rst,
remote-controller.rst, mm/index.rst, numaperf.rst, userfaultfd.rst,
module-signing.rst, imx-ddr.rst, intel-speed-select.rst,
intel_pstate.rst, ramoops.rst, abi.rst, kernel.rst, vm.rst
Signed-off-by: Andrew Klychkov <andrew.a.klychkov@gmail.com>
Link: https://lore.kernel.org/r/20201204072848.GA49895@spblnx124.lan
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2020-12-04 10:28:48 +03:00
|
|
|
|
2017-08-20 14:39:20 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2016-05-12 13:06:21 -03:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2016-05-12 13:06:21 -03:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2016-05-12 13:06:21 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-08 14:11:22 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-05-09 07:14:03 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2012-01-12 17:20:27 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-10-02 13:46:10 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2019-10-02 13:46:10 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2016-08-02 14:04:07 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2016-08-02 14:04:07 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2016-08-02 14:04:07 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2016-08-02 14:04:07 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-27 23:17:02 +02:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2020-06-23 13:25:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-03 21:43:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-23 13:25:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-05 14:00:58 +01:00
|
|
|
|
|
|
|
|
|
2022-05-03 21:43:58 +02:00
|
|
|
|
2020-06-23 13:25:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-05 14:00:58 +01:00
|
|
|
|
|
|
|
|
|
2020-06-23 13:25:14 +02:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2008-02-09 23:24:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
2009-07-03 14:20:17 +02:00
|
|
|
|
|
|
|
|
|
2008-02-09 23:24:08 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2008-02-09 23:24:08 +01:00
|
|
|
|
2009-07-03 14:20:17 +02:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2008-02-09 23:24:08 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2009-07-03 14:20:17 +02:00
|
|
|
|
|
|
|
|
|
2008-02-09 23:24:08 +01:00
|
|
|
|
2009-07-03 14:20:17 +02:00
|
|
|
|
|
|
|
|
|
2008-02-09 23:24:08 +01:00
|
|
|
|
2009-07-03 14:20:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2009-07-03 14:20:17 +02:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2008-02-09 23:24:08 +01:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2018-12-03 09:56:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-12 12:40:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-16 12:11:21 +00:00
|
|
|
|
2021-05-12 12:40:35 +01:00
|
|
|
|
|
|
|
|
|
2018-12-03 09:56:23 +00:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2016-02-05 09:08:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-08 08:49:22 +01:00
|
|
|
|
|
|
|
|
|
2020-07-16 12:03:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-08 08:49:22 +01:00
|
|
|
|
|
|
|
|
|
2020-07-16 12:03:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-08 08:49:22 +01:00
|
|
|
|
|
|
|
|
|
2020-07-16 12:03:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-05 09:08:36 +00:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2013-01-04 15:35:05 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2013-01-04 15:35:05 -08:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2013-01-04 15:35:05 -08:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2013-01-04 15:35:05 -08:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-26 16:08:48 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2011-07-26 16:08:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2011-07-26 16:08:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2011-07-26 16:08:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
sysctl: allow for strict write position handling
When writing to a sysctl string, each write, regardless of VFS position,
begins writing the string from the start. This means the contents of
the last write to the sysctl controls the string contents instead of the
first:
open("/proc/sys/kernel/modprobe", O_WRONLY) = 1
write(1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"..., 4096) = 4096
write(1, "/bin/true", 9) = 9
close(1) = 0
$ cat /proc/sys/kernel/modprobe
/bin/true
Expected behaviour would be to have the sysctl be "AAAA..." capped at
maxlen (in this case KMOD_PATH_LEN: 256), instead of truncating to the
contents of the second write. Similarly, multiple short writes would
not append to the sysctl.
The old behavior is unlike regular POSIX files enough that doing audits
of software that interact with sysctls can end up in unexpected or
dangerous situations. For example, "as long as the input starts with a
trusted path" turns out to be an insufficient filter, as what must also
happen is for the input to be entirely contained in a single write
syscall -- not a common consideration, especially for high level tools.
This provides kernel.sysctl_writes_strict as a way to make this behavior
act in a less surprising manner for strings, and disallows non-zero file
position when writing numeric sysctls (similar to what is already done
when reading from non-zero file positions). For now, the default (0) is
to warn about non-zero file position use, but retain the legacy
behavior. Setting this to -1 disables the warning, and setting this to
1 enables the file position respecting behavior.
[akpm@linux-foundation.org: fix build]
[akpm@linux-foundation.org: move misplaced hunk, per Randy]
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-06 14:37:19 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
sysctl: allow for strict write position handling
When writing to a sysctl string, each write, regardless of VFS position,
begins writing the string from the start. This means the contents of
the last write to the sysctl controls the string contents instead of the
first:
open("/proc/sys/kernel/modprobe", O_WRONLY) = 1
write(1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"..., 4096) = 4096
write(1, "/bin/true", 9) = 9
close(1) = 0
$ cat /proc/sys/kernel/modprobe
/bin/true
Expected behaviour would be to have the sysctl be "AAAA..." capped at
maxlen (in this case KMOD_PATH_LEN: 256), instead of truncating to the
contents of the second write. Similarly, multiple short writes would
not append to the sysctl.
The old behavior is unlike regular POSIX files enough that doing audits
of software that interact with sysctls can end up in unexpected or
dangerous situations. For example, "as long as the input starts with a
trusted path" turns out to be an insufficient filter, as what must also
happen is for the input to be entirely contained in a single write
syscall -- not a common consideration, especially for high level tools.
This provides kernel.sysctl_writes_strict as a way to make this behavior
act in a less surprising manner for strings, and disallows non-zero file
position when writing numeric sysctls (similar to what is already done
when reading from non-zero file positions). For now, the default (0) is
to warn about non-zero file position use, but retain the legacy
behavior. Setting this to -1 disables the warning, and setting this to
1 enables the file position respecting behavior.
[akpm@linux-foundation.org: fix build]
[akpm@linux-foundation.org: move misplaced hunk, per Randy]
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-06 14:37:19 -07:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
sysctl: allow for strict write position handling
When writing to a sysctl string, each write, regardless of VFS position,
begins writing the string from the start. This means the contents of
the last write to the sysctl controls the string contents instead of the
first:
open("/proc/sys/kernel/modprobe", O_WRONLY) = 1
write(1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"..., 4096) = 4096
write(1, "/bin/true", 9) = 9
close(1) = 0
$ cat /proc/sys/kernel/modprobe
/bin/true
Expected behaviour would be to have the sysctl be "AAAA..." capped at
maxlen (in this case KMOD_PATH_LEN: 256), instead of truncating to the
contents of the second write. Similarly, multiple short writes would
not append to the sysctl.
The old behavior is unlike regular POSIX files enough that doing audits
of software that interact with sysctls can end up in unexpected or
dangerous situations. For example, "as long as the input starts with a
trusted path" turns out to be an insufficient filter, as what must also
happen is for the input to be entirely contained in a single write
syscall -- not a common consideration, especially for high level tools.
This provides kernel.sysctl_writes_strict as a way to make this behavior
act in a less surprising manner for strings, and disallows non-zero file
position when writing numeric sysctls (similar to what is already done
when reading from non-zero file positions). For now, the default (0) is
to warn about non-zero file position use, but retain the legacy
behavior. Setting this to -1 disables the warning, and setting this to
1 enables the file position respecting behavior.
[akpm@linux-foundation.org: fix build]
[akpm@linux-foundation.org: move misplaced hunk, per Randy]
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-06 14:37:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2016-01-20 15:00:45 -08:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2016-01-20 15:00:45 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
sysctl: allow for strict write position handling
When writing to a sysctl string, each write, regardless of VFS position,
begins writing the string from the start. This means the contents of
the last write to the sysctl controls the string contents instead of the
first:
open("/proc/sys/kernel/modprobe", O_WRONLY) = 1
write(1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"..., 4096) = 4096
write(1, "/bin/true", 9) = 9
close(1) = 0
$ cat /proc/sys/kernel/modprobe
/bin/true
Expected behaviour would be to have the sysctl be "AAAA..." capped at
maxlen (in this case KMOD_PATH_LEN: 256), instead of truncating to the
contents of the second write. Similarly, multiple short writes would
not append to the sysctl.
The old behavior is unlike regular POSIX files enough that doing audits
of software that interact with sysctls can end up in unexpected or
dangerous situations. For example, "as long as the input starts with a
trusted path" turns out to be an insufficient filter, as what must also
happen is for the input to be entirely contained in a single write
syscall -- not a common consideration, especially for high level tools.
This provides kernel.sysctl_writes_strict as a way to make this behavior
act in a less surprising manner for strings, and disallows non-zero file
position when writing numeric sysctls (similar to what is already done
when reading from non-zero file positions). For now, the default (0) is
to warn about non-zero file position use, but retain the legacy
behavior. Setting this to -1 disables the warning, and setting this to
1 enables the file position respecting behavior.
[akpm@linux-foundation.org: fix build]
[akpm@linux-foundation.org: move misplaced hunk, per Randy]
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-06 14:37:19 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2014-06-23 13:22:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-23 13:22:05 -07:00
|
|
|
|
|
|
|
|
|
2020-03-10 15:36:49 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
2021-06-28 19:34:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2018-08-17 01:17:03 +03:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2018-08-17 01:17:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-17 01:17:03 +03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2018-08-17 01:17:03 +03:00
|
|
|
|
2019-01-08 20:40:07 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-04-10 16:32:29 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-02 16:32:43 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-08 20:40:07 +01:00
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-06-07 21:40:17 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-02 16:57:20 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2015-04-16 12:47:53 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2015-04-16 12:47:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2015-04-16 12:47:53 -07:00
|
|
|
|
|
|
|
|
|
2020-04-29 22:57:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
2020-04-29 22:57:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 08:27:20 +02:00
|
|
|
|
|
|
|
|
|
2020-04-29 22:57:56 +02:00
|
|
|
|
|
|
|
|
|
2020-05-15 23:24:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2009-04-02 16:57:20 -07:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-02 16:57:20 -07:00
|
|
|
|
2011-07-23 10:39:29 -07:00
|
|
|
|
|
|
|
|
|
2013-05-17 10:31:20 +08:00
|
|
|
|
|
|
|
|
|
2020-03-15 13:26:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-11 22:35:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-03-15 13:26:48 +01:00
|
|
|
|
2021-05-11 22:35:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-03-15 13:26:48 +01:00
|
|
|
|
2021-05-11 22:35:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-03-15 13:26:48 +01:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2015-04-14 15:44:13 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2015-06-24 16:55:45 -07:00
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2015-06-24 16:55:45 -07:00
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2015-06-24 16:55:45 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2015-06-24 16:55:45 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 18:35:54 -03:00
|
|
|
|
2015-06-24 16:55:45 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
2013-05-17 10:31:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-18 13:59:16 +01:00
|
|
|
|
2013-05-17 10:31:20 +08:00
|
|
|
|