2022-02-08 16:55:29

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH v2 0/5] Update doc and fix some issues about kdump

Tiezhu Yang (5):
docs: kdump: update description about sysfs file system support
docs: kdump: add scp example to write out the dump file
panic: unset panic_on_warn inside panic()
ubsan: no need to unset panic_on_warn in ubsan_epilogue()
kasan: no need to unset panic_on_warn in end_report()

Documentation/admin-guide/kdump/kdump.rst | 10 +++++++---
kernel/panic.c | 20 +++++++++++---------
lib/ubsan.c | 10 +---------
mm/kasan/report.c | 10 +---------
4 files changed, 20 insertions(+), 30 deletions(-)

--
2.1.0



2022-02-08 17:27:58

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH v2 2/5] docs: kdump: add scp example to write out the dump file

Except cp and makedumpfile, add scp example to write out the dump file.

Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Baoquan He <[email protected]>
---
Documentation/admin-guide/kdump/kdump.rst | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Documentation/admin-guide/kdump/kdump.rst b/Documentation/admin-guide/kdump/kdump.rst
index d187df2..a748e7e 100644
--- a/Documentation/admin-guide/kdump/kdump.rst
+++ b/Documentation/admin-guide/kdump/kdump.rst
@@ -533,6 +533,10 @@ the following command::

cp /proc/vmcore <dump-file>

+or use scp to write out the dump file between hosts on a network, e.g::
+
+ scp /proc/vmcore remote_username@remote_ip:<dump-file>
+
You can also use makedumpfile utility to write out the dump file
with specified options to filter out unwanted contents, e.g::

--
2.1.0


2022-02-09 06:16:55

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH v2 1/5] docs: kdump: update description about sysfs file system support

After commit 6a108a14fa35 ("kconfig: rename CONFIG_EMBEDDED to
CONFIG_EXPERT"), "Configure standard kernel features (for small
systems)" is not exist, we should use "Configure standard kernel
features (expert users)" now.

Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Baoquan He <[email protected]>
---
Documentation/admin-guide/kdump/kdump.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/kdump/kdump.rst b/Documentation/admin-guide/kdump/kdump.rst
index cb30ca3d..d187df2 100644
--- a/Documentation/admin-guide/kdump/kdump.rst
+++ b/Documentation/admin-guide/kdump/kdump.rst
@@ -146,9 +146,9 @@ System kernel config options
CONFIG_SYSFS=y

Note that "sysfs file system support" might not appear in the "Pseudo
- filesystems" menu if "Configure standard kernel features (for small
- systems)" is not enabled in "General Setup." In this case, check the
- .config file itself to ensure that sysfs is turned on, as follows::
+ filesystems" menu if "Configure standard kernel features (expert users)"
+ is not enabled in "General Setup." In this case, check the .config file
+ itself to ensure that sysfs is turned on, as follows::

grep 'CONFIG_SYSFS' .config

--
2.1.0


2022-02-09 07:25:39

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH v2 3/5] panic: unset panic_on_warn inside panic()

In the current code, the following three places need to unset
panic_on_warn before calling panic() to avoid recursive panics:

kernel/kcsan/report.c: print_report()
kernel/sched/core.c: __schedule_bug()
mm/kfence/report.c: kfence_report_error()

In order to avoid copy-pasting "panic_on_warn = 0" all over the
places, it is better to move it inside panic() and then remove
it from the other places.

Signed-off-by: Tiezhu Yang <[email protected]>
---
kernel/panic.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 55b50e0..95ba825 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -185,6 +185,16 @@ void panic(const char *fmt, ...)
int old_cpu, this_cpu;
bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers;

+ if (panic_on_warn) {
+ /*
+ * This thread may hit another WARN() in the panic path.
+ * Resetting this prevents additional WARN() from panicking the
+ * system on this thread. Other threads are blocked by the
+ * panic_mutex in panic().
+ */
+ panic_on_warn = 0;
+ }
+
/*
* Disable local interrupts. This will prevent panic_smp_self_stop
* from deadlocking the first cpu that invokes the panic, since
@@ -576,16 +586,8 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
if (regs)
show_regs(regs);

- if (panic_on_warn) {
- /*
- * This thread may hit another WARN() in the panic path.
- * Resetting this prevents additional WARN() from panicking the
- * system on this thread. Other threads are blocked by the
- * panic_mutex in panic().
- */
- panic_on_warn = 0;
+ if (panic_on_warn)
panic("panic_on_warn set ...\n");
- }

if (!regs)
dump_stack();
--
2.1.0


2022-02-09 08:42:18

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH v2 4/5] ubsan: no need to unset panic_on_warn in ubsan_epilogue()

panic_on_warn is unset inside panic(), so no need to unset it
before calling panic() in ubsan_epilogue().

Signed-off-by: Tiezhu Yang <[email protected]>
---
lib/ubsan.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/lib/ubsan.c b/lib/ubsan.c
index bdc380f..36bd75e 100644
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -154,16 +154,8 @@ static void ubsan_epilogue(void)

current->in_ubsan--;

- if (panic_on_warn) {
- /*
- * This thread may hit another WARN() in the panic path.
- * Resetting this prevents additional WARN() from panicking the
- * system on this thread. Other threads are blocked by the
- * panic_mutex in panic().
- */
- panic_on_warn = 0;
+ if (panic_on_warn)
panic("panic_on_warn set ...\n");
- }
}

void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs)
--
2.1.0