lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220401202300.12660-2-alejandro.j.jimenez@oracle.com>
Date:   Fri,  1 Apr 2022 16:23:00 -0400
From:   Alejandro Jimenez <alejandro.j.jimenez@...cle.com>
To:     corbet@....net, mcgrof@...nel.org, keescook@...omium.org,
        yzaikin@...gle.com, linux-fsdevel@...r.kernel.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     akpm@...ux-foundation.org, linux@...musvillemoes.dk,
        ebiggers@...gle.com, peterz@...radead.org, ying.huang@...el.com,
        gpiccoli@...lia.com, mchehab+huawei@...nel.org, Jason@...c4.com,
        daniel@...earbox.net, robh@...nel.org, wangqing@...o.com,
        prestwoj@...il.com, dsahern@...nel.org,
        stephen.s.brennan@...cle.com, alejandro.j.jimenez@...cle.com
Subject: [RFC 1/1] kernel/sysctl: Add sysctl entry for crash_kexec_post_notifiers

Introduce a new sysctl:

  /proc/sys/kernel/crash_kexec_post_notifiers

that allows the crash_kexec_post_notifiers tunable to be listed, read, and
modified via sysctl(8) at runtime.

crash_kexec_post_notifiers can now be set via sysctl:

  # sysctl -w kernel.crash_kexec_post_notifiers=1

or using the sysfs entry:

 #  echo 0 > /sys/module/kernel/parameters/crash_kexec_post_notifiers

which is also available for other core kernel parameters like panic,
panic_print, and panic_on_warn.

Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@...cle.com>
Reviewed-by: Stephen Brennan <stephen.s.brennan@...cle.com>
---
 Documentation/admin-guide/sysctl/kernel.rst | 8 ++++++++
 include/uapi/linux/sysctl.h                 | 1 +
 kernel/sysctl.c                             | 7 +++++++
 3 files changed, 16 insertions(+)

diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
index 1144ea3229a3..8e07121e2a58 100644
--- a/Documentation/admin-guide/sysctl/kernel.rst
+++ b/Documentation/admin-guide/sysctl/kernel.rst
@@ -213,6 +213,14 @@ If `core_pattern`_ does not include "%p" (default does not)
 and ``core_uses_pid`` is set, then .PID will be appended to
 the filename.
 
+crash_kexec_post_notifiers
+============
+
+Allow the callbacks in panic notifier list to be called before kdump and dumping
+kmsg.
+
+0 Do not call panic notifier list callbacks before kdump (default).
+1 Call panic notifier list callbacks before kdump.
 
 ctrl-alt-del
 ============
diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
index 6a3b194c50fe..921e3ea01881 100644
--- a/include/uapi/linux/sysctl.h
+++ b/include/uapi/linux/sysctl.h
@@ -154,6 +154,7 @@ enum
 	KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
 	KERN_PANIC_ON_WARN=77, /* int: call panic() in WARN() functions */
 	KERN_PANIC_PRINT=78, /* ulong: bitmask to print system info on panic */
+	KERN_CRASH_KEXEC_POST_NOTIFIERS=79, /* bool: call panic notifier list before kdump */
 };
 
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 830aaf8ca08e..8e0be72b5fba 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2339,6 +2339,13 @@ static struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_INT_MAX,
 	},
 #endif
+	{
+		.procname	= "crash_kexec_post_notifiers",
+		.data		= &crash_kexec_post_notifiers,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dobool,
+	},
 	{ }
 };
 
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ