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] [day] [month] [year] [list]
Date:   Thu, 10 Feb 2022 17:37:19 -0800
From:   Luis Chamberlain <mcgrof@...nel.org>
To:     Maninder Singh <maninder1.s@...sung.com>
Cc:     Petr Mladek <pmladek@...e.com>, Vimal Agrawal <avimalin@...il.com>,
        "rostedt@...dmis.org" <rostedt@...dmis.org>,
        "senozhatsky@...omium.org" <senozhatsky@...omium.org>,
        "andriy.shevchenko@...ux.intel.com" 
        <andriy.shevchenko@...ux.intel.com>,
        "linux@...musvillemoes.dk" <linux@...musvillemoes.dk>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "wangkefeng.wang@...wei.com" <wangkefeng.wang@...wei.com>,
        "mbenes@...e.cz" <mbenes@...e.cz>,
        "swboyd@...omium.org" <swboyd@...omium.org>,
        "ojeda@...nel.org" <ojeda@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "will@...nel.org" <will@...nel.org>,
        "catalin.marinas@....com" <catalin.marinas@....com>,
        Vaneet Narang <v.narang@...sung.com>,
        Aaron Tomlin <atomlin@...hat.com>
Subject: Re: [PATCH 1/1] kallsyms: print module name in %ps/S case when
 KALLSYMS is disabled

On Thu, Feb 10, 2022 at 02:18:23PM +0530, Maninder Singh wrote:
> Hi All,
> 
> Thanks for your inputs.
> 
> > On Wed 2022-02-09 15:02:06, Luis Chamberlain wrote:
> > > 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@bombadil.infradead.org
> >  
> > Honestly, I am not sure what is the best practice. My understanding is
> > that inlined functions are used primary for speed up at runtime.
> >  
> 
> Main reason of making it inline was:
> (1) kallsysm.c was not getting compiled(with disabled config), so could not add defination there.
> (2) lib/vsnprintf.c was not correct place to define new function of kallsyms(fill_minimal_module_info)
> (3) I thought static int will be part of each .c file which includes kallsyms.h and compiler can make noise for unused functions,
> and also increase code size, where as static inline will be added only if some code is calling that function otherwise will be discarded.
> 
> But as peter said better version will be to make a new defination of __sprint_symbol (probably in kernel/module.c)
> to handle all cases of %ps/S/B/b when KALLSYSMS is disabled.
> 
> I will try to prepare changes and share V2 patch.

If you do please Cc me and Vimal, and Aaron.

  Luis

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ