linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Lawrence <joe.lawrence@redhat.com>
To: Nicholas Mc Guire <der.herr@hofr.at>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	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: Sat, 15 Dec 2018 11:23:39 -0500	[thread overview]
Message-ID: <20181215162339.rmjcyg5gqxjvp7pg@redhat.com> (raw)
In-Reply-To: <20181215085052.GA3426@osadl.at>

On Sat, Dec 15, 2018 at 09:50:52AM +0100, Nicholas Mc Guire wrote:
> 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
> 
> that should have been  relocation section  as described in
> Documentation/livepatch/module-elf-format.txt - atleast that is how
> I currently undderstand the livepatch mechanism and its seperate
> relocation section.
> 
Hi Nicholas,

Jessica can explain module-elf-format.txt in more detail, but the
highlight is that it outlines the format for _livepatch_ modules, in
this case livepatch-shadow-fix{1,2}.ko.  The special relocations
detailed in that file are needed when livepatch modules reference
symbols defined elsewhere (vmlinux, other modules) that may not
ordinarily be visible (non-exported, local, etc.) to the module loader.

When livepatch modules register themselves on load, the livepatching
core needs to find the address of the _target_ to-be-patched function
using a kallsyms lookup.  If that can't be found, the kernel will emit
an error, "livepatch: symbol 'dummy_free' not found in symbol table".
The call path is:

  klp_register_patch
    klp_init_object_loaded
      klp_find_object_symbol

if you want to trace the execution path.

> 
> thanks for your patience - so I did not yet understand how this really
> works together - will give it a rerun and repost a hopefully proper
> solution. 
>
> thx!
> hofrat

Thanks for sticking with it and learning some livepatching internals
along the way.

-- Joe

  reply	other threads:[~2018-12-15 16:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 16:56 [PATCH 1/2] livepatch: fix non-static warnings 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
2018-12-14 22:03     ` Joe Lawrence
2018-12-15  8:50   ` Nicholas Mc Guire
2018-12-15 16:23     ` Joe Lawrence [this message]
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=20181215162339.rmjcyg5gqxjvp7pg@redhat.com \
    --to=joe.lawrence@redhat.com \
    --cc=der.herr@hofr.at \
    --cc=hofrat@osadl.org \
    --cc=jeyu@kernel.org \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@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;
as well as URLs for NNTP newsgroup(s).