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-next>] [day] [month] [year] [list]
Message-Id: <20230612220334.44177-1-andriy.shevchenko@linux.intel.com>
Date:   Tue, 13 Jun 2023 01:03:34 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     linux-kernel@...r.kernel.org
Cc:     Dave Hansen <dave.hansen@...ux.intel.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v1 1/1] signal: Use %*ph for printing hexdump of a small buffer

The kernel already has a helper to print a hexdump of a small
buffer via pointer extension. Use that instead of open coded
variant.

In long term it helps to kill pr_cont() or at least narrow down
its use.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 kernel/signal.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index b5370fe5c198..6be2df76f0b4 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1259,18 +1259,17 @@ static void print_fatal_signal(int signr)
 	pr_info("potentially unexpected fatal signal %d.\n", signr);
 
 #if defined(__i386__) && !defined(__arch_um__)
-	pr_info("code at %08lx: ", regs->ip);
 	{
+		unsigned char insn[16];
 		int i;
+
 		for (i = 0; i < 16; i++) {
-			unsigned char insn;
-
-			if (get_user(insn, (unsigned char *)(regs->ip + i)))
+			if (get_user(insn[i], (unsigned char __user *)(regs->ip + i)))
 				break;
-			pr_cont("%02x ", insn);
 		}
+
+		pr_info("code at %08lx: %*ph\n", regs->ip, i, insn);
 	}
-	pr_cont("\n");
 #endif
 	preempt_disable();
 	show_regs(regs);
-- 
2.40.0.1.gaa8946217a0b

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ