RE: [PATCH 00/14] Fix wrong %pF and %pS printk format specifier usages

From: Yu, Fenghua
Date: Fri Sep 08 2017 - 18:24:05 EST


> From: Sergey Senozhatsky [mailto:sergey.senozhatsky.work@xxxxxxxxx]
> On (09/07/17 16:05), Luck, Tony wrote:
> +static inline bool __mod_text_address(struct module *mod,
> + unsigned long addr) {
> + /* Make sure it's within the text section. */
> + if (!within(addr, mod->init_layout.base, mod->init_layout.text_size)
> + && !within(addr, mod->core_layout.base, mod-
> >core_layout.text_size))
> + return false;
> + return true;
> +}

The __mod_text_address() may be defined only on IA64, PPC64 and PARISC since it's only called in those cases.

> +
> #ifdef CONFIG_KALLSYMS
> /*
> * This ignores the intensely annoying "mapping symbols" found @@ -3942,6
> +3952,14 @@ const char *module_address_lookup(unsigned long addr,
> preempt_disable();
> mod = __module_address(addr);
> if (mod) {
> +#if defined(CONFIG_IA64) || defined(CONFIG_PPC64) ||
> defined(CONFIG_PARISC)
> + unsigned long deref_addr;
> +
> + if (!__mod_text_address(mod, addr))
> + deref_addr = dereference_function_descriptor(addr);
> + if (__mod_text_address(mod, deref_addr))
> + addr = deref_addr; #endif

Thanks.

-Fenghua