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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 12 Apr 2019 11:14:28 +0200 (CEST)
From:   Miroslav Benes <mbenes@...e.cz>
To:     Joe Lawrence <joe.lawrence@...hat.com>
cc:     linux-kernel@...r.kernel.org, live-patching@...r.kernel.org,
        linux-kbuild@...r.kernel.org, Jessica Yu <jeyu@...nel.org>,
        Jiri Kosina <jikos@...nel.org>,
        Joao Moreira <jmoreira@...e.de>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Konstantin Khlebnikov <khlebnikov@...dex-team.ru>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michael Matz <matz@...e.de>, Nicolai Stange <nstange@...e.de>,
        Petr Mladek <pmladek@...e.com>
Subject: Re: [PATCH v3 4/9] livepatch: Add klp-convert annotation helpers

On Wed, 10 Apr 2019, Joe Lawrence wrote:

> On Wed, Apr 10, 2019 at 11:50:53AM -0400, Joe Lawrence wrote:
> > From: Josh Poimboeuf <jpoimboe@...hat.com>
> > 
> > Define macros KLP_MODULE_RELOC and KLP_SYMPOS in
> > include/linux/livepatch.h to improve user-friendliness of the
> > livepatch annotation process.
> > 
> > Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> > Signed-off-by: Joao Moreira <jmoreira@...e.de>
> > Signed-off-by: Joe Lawrence <joe.lawrence@...hat.com>
> > ---
> >  include/linux/livepatch.h | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
> > index 16b48e8b29a2..947cfc2d1980 100644
> > --- a/include/linux/livepatch.h
> > +++ b/include/linux/livepatch.h
> > @@ -236,6 +236,18 @@ void *klp_shadow_get_or_alloc(void *obj, unsigned long id,
> >  void klp_shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor);
> >  void klp_shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor);
> >  
> > +/* Used to annotate symbol relocations in livepatches */
> > +#define KLP_MODULE_RELOC(obj)						\
> > +	struct klp_module_reloc						\
> > +	__attribute__((__section__(".klp.module_relocs." #obj)))	\
> > +	__attribute__((aligned (4)))
> > +
> > +#define KLP_SYMPOS(symbol, pos)						\
> > +	{								\
> > +		.sym = &symbol,						\
> > +		.sympos = pos,						\
> > +	},
>         ^^
> nit: if we dropped the trailing array comma delimiter from KLP_SYMPOS
> macro, the invocations would look more intuitively like an array.  For
> example:
> 
>   KLP_MODULE_RELOC(test_klp_convert_mod) test_klp_convert_mod_relocs_a[] = {
>   	KLP_SYMPOS(driver_name, 0),
>   	KLP_SYMPOS(homonym_string, 2),
>   	KLP_SYMPOS(get_homonym_string, 2),
>   };
> 
> But I could not figure out a good regex to reference if other such
> kernel preprocessor macros include or exclude the delimiter.  Are there
> reasons to include it?

No, I don't think so. We should change it. Good catch.

Miroslav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ