Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial

Pull fixup for trivial branch from Jiri Kosina:
 "Unfortunately I made a mistake when merging into for-linus branch, and
  omitted one pre-requisity patch for a few other patches (which have
  been Acked by the appropriate maintainers) in the series.  Mea culpa
  maxima, sorry for that."

The trivial branch added %pSR usage before actually teaching vsnprintf()
about the 'R' part of %pSR.  The 'R' causes the symbol translation to do
a "__builtin_extract_return_addr()" before symbol lookup.

That said, on most architectures __builtin_extract_return_addr() isn't
likely to do anything special, so it probably is not normally
noticeable.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  vsprintf: Add extension %pSR - print_symbol replacement
This commit is contained in:
Linus Torvalds 2013-04-30 13:47:37 -07:00
commit 3094566959
2 changed files with 15 additions and 5 deletions

View File

@ -17,6 +17,8 @@ Symbols/Function Pointers:
%pF versatile_init+0x0/0x110 %pF versatile_init+0x0/0x110
%pf versatile_init %pf versatile_init
%pS versatile_init+0x0/0x110 %pS versatile_init+0x0/0x110
%pSR versatile_init+0x9/0x110
(with __builtin_extract_return_addr() translation)
%ps versatile_init %ps versatile_init
%pB prev_fn_of_versatile_init+0x88/0x88 %pB prev_fn_of_versatile_init+0x88/0x88

View File

@ -534,14 +534,21 @@ char *string(char *buf, char *end, const char *s, struct printf_spec spec)
static noinline_for_stack static noinline_for_stack
char *symbol_string(char *buf, char *end, void *ptr, char *symbol_string(char *buf, char *end, void *ptr,
struct printf_spec spec, char ext) struct printf_spec spec, const char *fmt)
{ {
unsigned long value = (unsigned long) ptr; unsigned long value;
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
char sym[KSYM_SYMBOL_LEN]; char sym[KSYM_SYMBOL_LEN];
if (ext == 'B') #endif
if (fmt[1] == 'R')
ptr = __builtin_extract_return_addr(ptr);
value = (unsigned long)ptr;
#ifdef CONFIG_KALLSYMS
if (*fmt == 'B')
sprint_backtrace(sym, value); sprint_backtrace(sym, value);
else if (ext != 'f' && ext != 's') else if (*fmt != 'f' && *fmt != 's')
sprint_symbol(sym, value); sprint_symbol(sym, value);
else else
sprint_symbol_no_offset(sym, value); sprint_symbol_no_offset(sym, value);
@ -987,6 +994,7 @@ int kptr_restrict __read_mostly;
* - 'f' For simple symbolic function names without offset * - 'f' For simple symbolic function names without offset
* - 'S' For symbolic direct pointers with offset * - 'S' For symbolic direct pointers with offset
* - 's' For symbolic direct pointers without offset * - 's' For symbolic direct pointers without offset
* - '[FfSs]R' as above with __builtin_extract_return_addr() translation
* - 'B' For backtraced symbolic direct pointers with offset * - 'B' For backtraced symbolic direct pointers with offset
* - 'R' For decoded struct resource, e.g., [mem 0x0-0x1f 64bit pref] * - 'R' For decoded struct resource, e.g., [mem 0x0-0x1f 64bit pref]
* - 'r' For raw struct resource, e.g., [mem 0x0-0x1f flags 0x201] * - 'r' For raw struct resource, e.g., [mem 0x0-0x1f flags 0x201]
@ -1060,7 +1068,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
case 'S': case 'S':
case 's': case 's':
case 'B': case 'B':
return symbol_string(buf, end, ptr, spec, *fmt); return symbol_string(buf, end, ptr, spec, fmt);
case 'R': case 'R':
case 'r': case 'r':
return resource_string(buf, end, ptr, spec, fmt); return resource_string(buf, end, ptr, spec, fmt);