From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
Jessica Yu <jeyu@kernel.org>, Jiri Kosina <jikos@kernel.org>,
Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] livepatch: fix non-static warnings
Date: Fri, 14 Dec 2018 15:51:29 -0600 [thread overview]
Message-ID: <20181214215129.mshuswyuqlcx76wz@treble> (raw)
In-Reply-To: <72b8f2a4-9070-23d3-4e75-66e10b2d94b5@redhat.com>
On Fri, Dec 14, 2018 at 04:34:23PM -0500, Joe Lawrence wrote:
> On 12/14/2018 11:56 AM, 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
> > relocation table - to resolve this the __noclone attribute (as
> ^^^^^^^^^^
> nit: symbol table
>
> > suggested by Joe Lawrence <joe.lawrence@redhat.com>) is used
> > for the statically declared functions.
> >
> > Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> > Link: https://lkml.org/lkml/2018/12/13/827
Needs a:
Suggested-by: Joe Lawrence <joe.lawrence@redhat.com>
> >
> > diff --git a/samples/livepatch/livepatch-shadow-fix1.c b/samples/livepatch/livepatch-shadow-fix1.c
> > index 49b1355..eaab10f 100644
> > --- a/samples/livepatch/livepatch-shadow-fix1.c
> > +++ b/samples/livepatch/livepatch-shadow-fix1.c
> > @@ -71,7 +71,7 @@ static int shadow_leak_ctor(void *obj, void *shadow_data, void *ctor_data)
> > return 0;
> > }
> >
> > -struct dummy *livepatch_fix1_dummy_alloc(void)
> > +static __noclone struct dummy *livepatch_fix1_dummy_alloc(void)
> > {
> > struct dummy *d;
> > void *leak;
> > @@ -108,7 +108,7 @@ static void livepatch_fix1_dummy_leak_dtor(void *obj, void *shadow_data)
> > __func__, d, *shadow_leak);
> > }
> >
> > -void livepatch_fix1_dummy_free(struct dummy *d)
> > +static __noclone void livepatch_fix1_dummy_free(struct dummy *d)
> > {
> > void **shadow_leak;
> >
> > diff --git a/samples/livepatch/livepatch-shadow-mod.c b/samples/livepatch/livepatch-shadow-mod.c
> > index 4c54b25..0a72bc2 100644
> > --- a/samples/livepatch/livepatch-shadow-mod.c
> > +++ b/samples/livepatch/livepatch-shadow-mod.c
> > @@ -30,6 +30,11 @@
> > * memory leak, please load these modules at your own risk -- some
> > * amount of memory may leaked before the bug is patched.
> > *
> > + * NOTE - the __noclone attribute to those functions that are to be
> > + * shared with other modules while being declared static. As livepatch
> > + * needs the unmodified symbol names and the usual "static" would
> > + * invoke gccs cloning mechanism that renames the functions this
> > + * needs to be suppressed with the additional __noclone attribute.
>
> I like the idea of providing the sample code reader this information,
> but since the compiler might also optimize livepatch-callbacks-busymod.c
> :: busymod_work_func(), it too should be annotated __noclone. Would
> that file deserve a similar comment?
>
> I don't have a strong opinion, but would throw my vote at leaving this
> in the commit message only.
Agreed, IMO the comment isn't needed.
> BTW, Petr/Miroslav/Josh, should we be annotating the selftests in
> similar fashion?
Probably so.
--
Josh
next prev parent reply other threads:[~2018-12-14 21:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 16:56 Nicholas Mc Guire
2018-12-14 16:56 ` [PATCH 2/2] livepatch: check kzalloc return values Nicholas Mc Guire
2018-12-14 21:39 ` Joe Lawrence
2018-12-17 11:41 ` Petr Mladek
2018-12-17 11:43 ` Miroslav Benes
2018-12-18 9:23 ` Jiri Kosina
2018-12-14 21:34 ` [PATCH 1/2] livepatch: fix non-static warnings Joe Lawrence
2018-12-14 21:51 ` Josh Poimboeuf [this message]
2018-12-14 22:03 ` Joe Lawrence
2018-12-15 8:50 ` Nicholas Mc Guire
2018-12-15 16:23 ` Joe Lawrence
2018-12-17 11:49 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181214215129.mshuswyuqlcx76wz@treble \
--to=jpoimboe@redhat.com \
--cc=hofrat@osadl.org \
--cc=jeyu@kernel.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®