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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.21.1811221706570.19197@pobox.suse.cz>
Date:   Thu, 22 Nov 2018 17:15:57 +0100 (CET)
From:   Miroslav Benes <mbenes@...e.cz>
To:     Jessica Yu <jeyu@...nel.org>
cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] module: make it clearer when we're handling kallsyms
 symbols vs exported symbols

On Thu, 22 Nov 2018, Jessica Yu wrote:

> +++ Miroslav Benes [22/11/18 11:19 +0100]:
> >On Wed, 21 Nov 2018, Jessica Yu wrote:
> >
> >> The module loader internally works with both exported symbols
> >> represented as struct kernel_symbol, as well as Elf symbols from a
> >> module's symbol table. It's hard to distinguish sometimes which type of
> >> symbol we're handling given that some helper function names are not
> >> consistent or helpful. Take get_ksymbol() for instance - are we
> >> looking for an exported symbol or a kallsyms symbol here? Or symname()
> >> and kernel_symbol_name() - which function handles an exported symbol and
> >> which one an Elf symbol?
> >>
> >> Clean up and unify the function naming scheme a bit to make it clear
> >> which kind of symbol we're handling. This change only affects static
> >> functions internal to the module loader.
> >>
> >> Signed-off-by: Jessica Yu <jeyu@...nel.org>
> >
> >Great. It should help a lot. Pity we cannot rename find_symbol() as well.
> >
> >I have only a naming nit. I think it is nice to have
> ><verb>_exported_<noun> convention. New kallsyms_ names don't hold it
> >though. Wouldn't it be better to be consistent and have
> >find_kallsyms_symbol() instead of kallsyms_find_symbol()? Or we could do
> >the opposite and have a "namespace" prefix first. That is,
> >exported_<verb>_<noun>. However, I don't like it that much.
> >
> >To be honest, your approach may be the best in the end.
> >
> >What do you think?
> 
> Hi Miroslav, thank you for the comment!
> 
> Yeah, that bothered me partially too. And a lot of existing helper
> functions in the module loader already have a <verb>_ type prefix.
> 
> Hm, how about we use <symbol_type>_* prefixes if we are just extracting a
> value, and <verb>_* prefixes for functions actually performing an
> action? 
> Kallsyms:
> 
>   kallsyms_symbol_name()
>   kallsyms_symbol_value()
>   
>   find_kallsyms_symbol()
>   find_kallsyms_symbol_value()
> 
>   etc.
> 
> Exported syms:
> 
>   kernel_symbol_name()
>   kernel_symbol_value()
>   
>   lookup_exported_symbol()
>   check_exported_symbol()
> 
>   etc.

Looks good to me.
 
> I had left the kernel_symbol_* functions alone since I guess they do
> describe what they're handling, they're handling struct kernel_symbol's.
> But maybe I will change that to exported_symbol_name() and
> exported_symbol_value() to be consistent with the naming scheme..

I don't have any preference here. Reasons for both options are valid.

Miroslav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ