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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 02 May 2024 10:59:30 +0100
From: Jiaxun Yang <jiaxun.yang@...goat.com>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org, 
 Jiaxun Yang <jiaxun.yang@...goat.com>, 
 Philippe Mathieu-Daudé <philmd@...aro.org>
Subject: [PATCH v3 3/9] MIPS: debug: Hook up DEBUG_LL with early printk

Output earlyprintk to low-level debug functions when it's
available.

DEBUG_LL takes priority over platform earlyprintk because
people must know what are they doing when they are trying
to enable DEBUG_LL.

Reviewed-by: Philippe Mathieu-Daudé <philmd@...aro.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
---
 arch/mips/Kconfig.debug         |  2 +-
 arch/mips/kernel/early_printk.c | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 892e31804982..6ef42edc7d67 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -2,7 +2,7 @@
 
 config EARLY_PRINTK
 	bool "Early printk" if EXPERT
-	depends on SYS_HAS_EARLY_PRINTK
+	depends on SYS_HAS_EARLY_PRINTK || DEBUG_LL
 	default y
 	help
 	  This option enables special console drivers which allow the kernel
diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c
index 4a1647ddfbd9..c3f3b0a930f0 100644
--- a/arch/mips/kernel/early_printk.c
+++ b/arch/mips/kernel/early_printk.c
@@ -14,6 +14,24 @@
 
 #include <asm/setup.h>
 
+#ifdef CONFIG_DEBUG_LL
+extern void printascii(const char *);
+
+static void early_console_write(struct console *con, const char *s, unsigned n)
+{
+	char buf[128];
+
+	while (n) {
+		unsigned int l = min(n, sizeof(buf)-1);
+
+		memcpy(buf, s, l);
+		buf[l] = 0;
+		s += l;
+		n -= l;
+		printascii(buf);
+	}
+}
+#else
 static void early_console_write(struct console *con, const char *s, unsigned n)
 {
 	while (n-- && *s) {
@@ -23,6 +41,7 @@ static void early_console_write(struct console *con, const char *s, unsigned n)
 		s++;
 	}
 }
+#endif
 
 static struct console early_console_prom = {
 	.name	= "early",

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ