Skip to content

Commit 3524e68

Browse files
soleenkees
authored andcommitted
pstore/platform: Pass max_reason to kmesg dump
Add a new member to struct pstore_info for passing information about kmesg dump maximum reason. This allows a finer control of what kmesg dumps are sent to pstore storage backends. Those backends that do not explicitly set this field (keeping it equal to 0), get the default behavior: store only Oopses and Panics, or everything if the printk.always_kmsg_dump boot param is set. Signed-off-by: Pavel Tatashin <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Co-developed-by: Kees Cook <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent fb13cb8 commit 3524e68

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

fs/pstore/platform.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,10 @@ int pstore_register(struct pstore_info *psi)
595595

596596
pstore_get_records(0);
597597

598-
if (psi->flags & PSTORE_FLAGS_DMESG)
598+
if (psi->flags & PSTORE_FLAGS_DMESG) {
599+
pstore_dumper.max_reason = psinfo->max_reason;
599600
pstore_register_kmsg();
601+
}
600602
if (psi->flags & PSTORE_FLAGS_CONSOLE)
601603
pstore_register_console();
602604
if (psi->flags & PSTORE_FLAGS_FTRACE)

include/linux/pstore.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ struct pstore_record {
9696
*
9797
* @read_mutex: serializes @open, @read, @close, and @erase callbacks
9898
* @flags: bitfield of frontends the backend can accept writes for
99+
* @max_reason: Used when PSTORE_FLAGS_DMESG is set. Contains the
100+
* kmsg_dump_reason enum value. KMSG_DUMP_UNDEF means
101+
* "use existing kmsg_dump() filtering, based on the
102+
* printk.always_kmsg_dump boot param" (which is either
103+
* KMSG_DUMP_OOPS when false, or KMSG_DUMP_MAX when
104+
* true); see printk.always_kmsg_dump for more details.
99105
* @data: backend-private pointer passed back during callbacks
100106
*
101107
* Callbacks:
@@ -179,6 +185,7 @@ struct pstore_info {
179185
struct mutex read_mutex;
180186

181187
int flags;
188+
int max_reason;
182189
void *data;
183190

184191
int (*open)(struct pstore_info *psi);

0 commit comments

Comments
 (0)