Loading kernel/printk.c +12 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,9 @@ struct log { u8 facility; /* syslog facility */ u8 flags:5; /* internal record flags */ u8 level:3; /* syslog level */ #if defined(CONFIG_LOG_BUF_MAGIC) u32 magic; /* handle for ramdump analysis tools */ #endif }; /* Loading Loading @@ -276,6 +279,13 @@ static u32 syslog_oops_buf_idx; static const char log_oops_end[] = "---end of oops log buffer---"; #endif #if defined(CONFIG_LOG_BUF_MAGIC) static u32 __log_align __used = LOG_ALIGN; #define LOG_MAGIC(msg) ((msg)->magic = 0x5d7aefca) #else #define LOG_MAGIC(msg) #endif /* cpu currently holding logbuf_lock */ static volatile unsigned int logbuf_cpu = UINT_MAX; Loading Loading @@ -434,6 +444,7 @@ static void log_store(int facility, int level, * to signify a wrap around. */ memset(log_buf + log_next_idx, 0, sizeof(struct log)); LOG_MAGIC((struct log *)(log_buf + log_next_idx)); log_next_idx = 0; } Loading @@ -446,6 +457,7 @@ static void log_store(int facility, int level, msg->facility = facility; msg->level = level & 7; msg->flags = flags & 0x1f; LOG_MAGIC(msg); if (ts_nsec > 0) msg->ts_nsec = ts_nsec; else Loading lib/Kconfig.debug +9 −0 Original line number Diff line number Diff line Loading @@ -1509,6 +1509,15 @@ config OOPS_LOG_BUFFER allow wrap around but preserve the first oops and onward kernel messages until buffer becomes full. config LOG_BUF_MAGIC bool "Recovery of partially corrupted dmesg from ramdumps" depends on PRINTK help Select this option to add a magic number to the log buf record. In the event that a log buf record is corrupted, post-mortem crash analysis tools may use this magic number to search for the next noncorrupted log record. config OOPS_LOG_BUF_SHIFT int "Oops log buffer size (16 => 64KB, 17 => 128KB)" depends on OOPS_LOG_BUFFER Loading Loading
kernel/printk.c +12 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,9 @@ struct log { u8 facility; /* syslog facility */ u8 flags:5; /* internal record flags */ u8 level:3; /* syslog level */ #if defined(CONFIG_LOG_BUF_MAGIC) u32 magic; /* handle for ramdump analysis tools */ #endif }; /* Loading Loading @@ -276,6 +279,13 @@ static u32 syslog_oops_buf_idx; static const char log_oops_end[] = "---end of oops log buffer---"; #endif #if defined(CONFIG_LOG_BUF_MAGIC) static u32 __log_align __used = LOG_ALIGN; #define LOG_MAGIC(msg) ((msg)->magic = 0x5d7aefca) #else #define LOG_MAGIC(msg) #endif /* cpu currently holding logbuf_lock */ static volatile unsigned int logbuf_cpu = UINT_MAX; Loading Loading @@ -434,6 +444,7 @@ static void log_store(int facility, int level, * to signify a wrap around. */ memset(log_buf + log_next_idx, 0, sizeof(struct log)); LOG_MAGIC((struct log *)(log_buf + log_next_idx)); log_next_idx = 0; } Loading @@ -446,6 +457,7 @@ static void log_store(int facility, int level, msg->facility = facility; msg->level = level & 7; msg->flags = flags & 0x1f; LOG_MAGIC(msg); if (ts_nsec > 0) msg->ts_nsec = ts_nsec; else Loading
lib/Kconfig.debug +9 −0 Original line number Diff line number Diff line Loading @@ -1509,6 +1509,15 @@ config OOPS_LOG_BUFFER allow wrap around but preserve the first oops and onward kernel messages until buffer becomes full. config LOG_BUF_MAGIC bool "Recovery of partially corrupted dmesg from ramdumps" depends on PRINTK help Select this option to add a magic number to the log buf record. In the event that a log buf record is corrupted, post-mortem crash analysis tools may use this magic number to search for the next noncorrupted log record. config OOPS_LOG_BUF_SHIFT int "Oops log buffer size (16 => 64KB, 17 => 128KB)" depends on OOPS_LOG_BUFFER Loading