Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d5438f4 authored by Mark Salyzyn's avatar Mark Salyzyn Committed by Tony Luck
Browse files

pstore: Add pmsg - user-space accessible pstore object



A secured user-space accessible pstore object. Writes
to /dev/pmsg0 are appended to the buffer, on reboot
the persistent contents are available in
/sys/fs/pstore/pmsg-ramoops-[ID].

One possible use is syslogd, or other daemon, can
write messages, then on reboot provides a means to
triage user-space activities leading up to a panic
as a companion to the pstore dmesg or console logs.

Signed-off-by: default avatarMark Salyzyn <salyzyn@android.com>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent f44f9652
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -21,6 +21,16 @@ config PSTORE_CONSOLE
	  When the option is enabled, pstore will log all kernel
	  messages, even if no oops or panic happened.

config PSTORE_PMSG
	bool "Log user space messages"
	depends on PSTORE
	help
	  When the option is enabled, pstore will export a character
	  interface /dev/pmsg0 to log user space messages. On reboot
	  data can be retrieved from /sys/fs/pstore/pmsg-ramoops-[ID].

	  If unsure, say N.

config PSTORE_FTRACE
	bool "Persistent function tracer"
	depends on PSTORE
+2 −0
Original line number Diff line number Diff line
@@ -7,5 +7,7 @@ obj-y += pstore.o
pstore-objs += inode.o platform.o
obj-$(CONFIG_PSTORE_FTRACE)	+= ftrace.o

obj-$(CONFIG_PSTORE_PMSG)	+= pmsg.o

ramoops-objs += ram.o ram_core.o
obj-$(CONFIG_PSTORE_RAM)	+= ramoops.o
+3 −0
Original line number Diff line number Diff line
@@ -361,6 +361,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
		scnprintf(name, sizeof(name), "powerpc-common-%s-%lld",
			  psname, id);
		break;
	case PSTORE_TYPE_PMSG:
		scnprintf(name, sizeof(name), "pmsg-%s-%lld", psname, id);
		break;
	case PSTORE_TYPE_UNKNOWN:
		scnprintf(name, sizeof(name), "unknown-%s-%lld", psname, id);
		break;
+6 −0
Original line number Diff line number Diff line
@@ -45,6 +45,12 @@ extern void pstore_register_ftrace(void);
static inline void pstore_register_ftrace(void) {}
#endif

#ifdef CONFIG_PSTORE_PMSG
extern void pstore_register_pmsg(void);
#else
static inline void pstore_register_pmsg(void) {}
#endif

extern struct pstore_info *psinfo;

extern void	pstore_set_kmsg_bytes(int);
+1 −0
Original line number Diff line number Diff line
@@ -447,6 +447,7 @@ int pstore_register(struct pstore_info *psi)
	if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) {
		pstore_register_console();
		pstore_register_ftrace();
		pstore_register_pmsg();
	}

	if (pstore_update_ms >= 0) {
Loading