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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080625030456.cab9ec3e.pj@sgi.com>
Date:	Wed, 25 Jun 2008 03:04:56 -0500
From:	Paul Jackson <pj@....com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	hpa@...or.com, yhlu.kernel@...il.com, akpm@...ux-foundation.org,
	mingo@...e.hu, tglx@...utronix.de, steiner@....com, travis@....com,
	linux-kernel@...r.kernel.org, ying.huang@...el.com,
	andi@...stfloor.org
Subject: Re: [PATCH 4/5 v2] x86 boot: show pfn addresses in hex not decimal
 in some kernel info printks

Linux, replying to pj:
> > I'd be inclined instead to use "%P" for symbolic addrs.
> 
> That doesn't work - gcc warns about it.
> 
> That turns out to be a problem with %#p too. 

Ah so.

How about the following "sym(addr, buf)" macro?  This could make it
more practical to include kernel symbols within ordinary printk's.

On a silly little test with:

	{
		char b1[32], b2[32], b3[32];
		printk(">>>>>> Testing sym(): A. %s, B. %s, C. %s\n",
			sym(&pid_max, b1),
			sym(0xffffffff80615750, b2),		/* an addr in my System.map */
			sym(0, b3));
	}

the kernel printed:

	>>>>>> Testing sym(): A. pid_max+0x0/0x4, B. trampoline_base+0x0/0x10, C. 0x0

===========================================================================

--- linux.orig/include/linux/kallsyms.h	2008-06-23 15:16:49.885666712 -0700
+++ linux/include/linux/kallsyms.h	2008-06-25 00:48:09.446807842 -0700
@@ -32,6 +32,12 @@ extern int sprint_symbol(char *buffer, u
 /* Look up a kernel symbol and print it to the kernel messages. */
 extern void __print_symbol(const char *fmt, unsigned long address);
 
+/* Convert address to kernel symbol; can printk result with "%s" format */
+#define sym(address, namebuf) ({				\
+	sprint_symbol((namebuf), (unsigned long)(address));	\
+	(namebuf);						\
+})
+
 int lookup_symbol_name(unsigned long addr, char *symname);
 int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
 

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@....com> 1.940.382.4214
--
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