Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pstore: Move kmsg_bytes default into Kconfig

While kmsg_bytes can be set for pstore via mount, if a crash occurs
before the mount only partial console log will be stored as kmsg_bytes
defaults to a potentially different hardcoded value in the kernel
(PSTORE_DEFAULT_KMSG_BYTES). This makes it impossible to analyze valuable
post-mortem data especially on the embedded development or in the process
of bringing up new boards. Change this value to be a Kconfig option
with the default of old PSTORE_DEFAULT_KMSG_BYTES

Signed-off-by: Vasile-Laurentiu Stanimir <vasile-laurentiu.stanimir@windriver.com>
Signed-off-by: Kees Cook <keescook@chromium.org>

authored by

Vasile-Laurentiu Stanimir and committed by
Kees Cook
26fecbf7 b6f8ed33

+10 -3
+8
fs/pstore/Kconfig
··· 14 14 If you don't have a platform persistent store driver, 15 15 say N. 16 16 17 + config PSTORE_DEFAULT_KMSG_BYTES 18 + int "Default kernel log storage space" if EXPERT 19 + depends on PSTORE 20 + default "10240" 21 + help 22 + Defines default size of pstore kernel log storage. 23 + Can be enlarged if needed, not recommended to shrink it. 24 + 17 25 config PSTORE_DEFLATE_COMPRESS 18 26 tristate "DEFLATE (ZLIB) compression" 19 27 default y
+1 -1
fs/pstore/inode.c
··· 266 266 */ 267 267 static int pstore_show_options(struct seq_file *m, struct dentry *root) 268 268 { 269 - if (kmsg_bytes != PSTORE_DEFAULT_KMSG_BYTES) 269 + if (kmsg_bytes != CONFIG_PSTORE_DEFAULT_KMSG_BYTES) 270 270 seq_printf(m, ",kmsg_bytes=%lu", kmsg_bytes); 271 271 return 0; 272 272 }
-1
fs/pstore/internal.h
··· 6 6 #include <linux/time.h> 7 7 #include <linux/pstore.h> 8 8 9 - #define PSTORE_DEFAULT_KMSG_BYTES 10240 10 9 extern unsigned long kmsg_bytes; 11 10 12 11 #ifdef CONFIG_PSTORE_FTRACE
+1 -1
fs/pstore/platform.c
··· 101 101 static size_t big_oops_buf_sz; 102 102 103 103 /* How much of the console log to snapshot */ 104 - unsigned long kmsg_bytes = PSTORE_DEFAULT_KMSG_BYTES; 104 + unsigned long kmsg_bytes = CONFIG_PSTORE_DEFAULT_KMSG_BYTES; 105 105 106 106 void pstore_set_kmsg_bytes(int bytes) 107 107 {