lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200707181756.44074.rgetz@blackfin.uclinux.org>
Date:	Wed, 18 Jul 2007 17:56:43 -0400
From:	Robin Getz <rgetz@...ckfin.uclinux.org>
To:	"Andrew Morton" <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org
Subject: early_printk accessing __log_buf

Quick question:

I am currently setting up an early_printk for the Blackfin - & I'm populating
an early fault interrupt handler at the same time. This allows things like
catching interrupts, or faults before the kernel has had a chance to
enable it's standard interrupt/fault handlers which happen midway 
through the boot process.

I would like to be able to print out the standard __log_buf from my early
fault handler - so everyone can see where things are when they died. In
most situations - printk has dumped some info to the log_buf, and it is
normally handy to see figure out what is going on.

However - __log_buf & associated pointers are declared as static in
kernel/printk.c - so they can't be accessed by external files.

I would normally use do_syslog([23],...) to read from the buffer - 
but these crashes happens before the kernel is fully initialized,
so spin_lock_irq, cond_resched, or wait_event_interruptible
will cause problems...

Although there are other solutions - I would prefer to just don't declare them
as static when EARLY_PRINTK is defined. This way if something bad happens - 
everyone can dump out the standard buffers to assist in debugging...

===================================================================
--- linux-2.6.x/kernel/printk.c (revision 3400)
+++ linux-2.6.x/kernel/printk.c (working copy)
@@ -117,7 +117,12 @@

 #ifdef CONFIG_PRINTK

+#ifdef CONFIG_EARLY_PRINTK
+char __log_buf[__LOG_BUF_LEN];
+#else
 static char __log_buf[__LOG_BUF_LEN];
+#endif
+
 static char *log_buf = __log_buf;
 static int log_buf_len = __LOG_BUF_LEN;
 static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */

Thoughts?

-Robin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ