Re: [PATCH 1/1] kallsyms: print module name in %ps/S case when KALLSYMS is disabled

From: Luis Chamberlain
Date: Wed Feb 09 2022 - 18:02:37 EST


On Wed, Feb 09, 2022 at 12:40:38PM +0100, Petr Mladek wrote:
> > --- a/include/linux/kallsyms.h
> > +++ b/include/linux/kallsyms.h
> > @@ -163,6 +163,33 @@ static inline bool kallsyms_show_value(const struct cred *cred)
> > return false;
> > }
> >
> > +#ifdef CONFIG_MODULES
> > +static inline int fill_minimal_module_info(char *sym, int size, unsigned long value)
> > +{
> > + struct module *mod;
> > + unsigned long offset;
> > + int ret = 0;
> > +
> > + preempt_disable();
> > + mod = __module_address(value);
> > + if (mod) {
> > + offset = value - (unsigned long)mod->core_layout.base;
> > + snprintf(sym, size - 1, "0x%lx+0x%lx [%s]",
> > + (unsigned long)mod->core_layout.base, offset, mod->name);
> > +
> > + sym[size - 1] = '\0';
> > + ret = 1;
> > + }
> > +
> > + preempt_enable();
> > + return ret;
> > +}
>
> It looks too big for an inlined function. Anyway, we will need
> something even more complex, see below.

Interesting, these observations might apply to Vimal's work as well [0].

[0] https://lkml.kernel.org/r/YgKyC4ZRud0JW1PF@xxxxxxxxxxxxxxxxxxxxxx

Luis