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]
Message-ID: <alpine.LSU.2.21.1812171256390.3087@pobox.suse.cz>
Date:   Mon, 17 Dec 2018 13:03:51 +0100 (CET)
From:   Miroslav Benes <mbenes@...e.cz>
To:     Nicholas Mc Guire <hofrat@...dl.org>
cc:     Josh Poimboeuf <jpoimboe@...hat.com>, Jessica Yu <jeyu@...nel.org>,
        Jiri Kosina <jikos@...nel.org>, Petr Mladek <pmladek@...e.com>,
        live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] livepatch: fix non-static warnings

Hi,

I'm sorry for being late to the party.

On Sun, 16 Dec 2018, Nicholas Mc Guire wrote:

> Sparse reported warnings about non-static symbols. For the variables
> a simple static attribute is fine - for those symbols referenced by
> livepatch via klp_func the symbol-names must be unmodified in the
> symbol table - to resolve this the __noclone attribute is used
> for the shared statically declared functions.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
> Suggested-by: Joe Lawrence <joe.lawrence@...hat.com>
> Link: https://lkml.org/lkml/2018/12/13/827

A nit, but I'd reorder the tags. Link, Suggested-by:, Signed-off-by:. Also 
it would be great if you used https://lkml.kernel.org/r/${Msg-ID} 
redirection.

> ---
> 
> V2: not all static functions shared need to carry the __noclone
>     attribute only those that need to be resolved at runtime by
>     livepatch - so drop the unnecessary __noclone attributes as
>     well as the Note on __noclone as suggested by Joe Lawrence
>     <joe.lawrence@...hat.com> - thanks !

I talked to Martin Jambor (GCC) and he suggested __attribute__((used)). It 
should be better than __noclone, which was reportedly implemented only for 
testing purposes (which is why it does not imply noinline, although 
inlining internally uses cloning). Newer gcc also has "noipa" attribute, 
but "used" would definitely be safe.

Sorry for not responding earlier.

Miroslav
 
> Sparse reported the following findings:
> 
> CHECK   samples/livepatch/livepatch-shadow-mod.c
> samples/livepatch/livepatch-shadow-mod.c:99:1: warning: symbol
>  'dummy_list' was not declared. Should it be static?
> samples/livepatch/livepatch-shadow-mod.c:100:1: warning: symbol
>  'dummy_list_mutex' was not declared. Should it be static?
> samples/livepatch/livepatch-shadow-mod.c:107:23: warning: symbol
>  'dummy_alloc' was not declared. Should it be static?
> samples/livepatch/livepatch-shadow-mod.c:128:15: warning: symbol
>  'dummy_free' was not declared. Should it be static?
> samples/livepatch/livepatch-shadow-mod.c:136:15: warning: symbol
>  'dummy_check' was not declared. Should it be static?
> 
> CHECK   samples/livepatch/livepatch-shadow-fix1.c
> samples/livepatch/livepatch-shadow-fix1.c:74:14: warning: symbol
>  'livepatch_fix1_dummy_alloc' was not declared. Should it be static?
> samples/livepatch/livepatch-shadow-fix1.c:111:6: warning: symbol
>  'livepatch_fix1_dummy_free' was not declared. Should it be static?
> 
> CHECK   samples/livepatch/livepatch-shadow-fix2.c
> samples/livepatch/livepatch-shadow-fix2.c:53:6: warning: symbol
>  'livepatch_fix2_dummy_check' was not declared. Should it be static?
> samples/livepatch/livepatch-shadow-fix2.c:81:6: warning: symbol
>  'livepatch_fix2_dummy_free' was not declared. Should it be static?
> 
> Patch was compile tested with: x86_64_defconfig + FTRACE=y
> FUNCTION_TRACER=y, EXPERT=y, LATENCYTOP=y, SAMPLES=y,
> SAMPLE_LIVEPATCH=y
> 
> Patch was runtested with:
>    insmod samples/livepatch/livepatch-shadow-mod.ko
>    insmod samples/livepatch/livepatch-shadow-fix1.ko
>    insmod samples/livepatch/livepatch-shadow-fix2.ko
>    echo 0 > /sys/kernel/livepatch/livepatch_shadow_fix2/enabled
>    echo 0 > /sys/kernel/livepatch/livepatch_shadow_fix1/enabled
>    rmmod livepatch-shadow-fix2
>    rmmod livepatch-shadow-fix1
>    rmmod livepatch-shadow-mod
> and dmesg output compared with the run before the patch was
> applied.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ