[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ffhirghzkgoah3fjh6mk4kwi5ygeb5ajt52uop3lvl5ruftojk@eccsgjesmqiw>
Date: Thu, 26 Jun 2025 16:19:00 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: x86@...nel.org
Cc: linux-kernel@...r.kernel.org, Petr Mladek <pmladek@...e.com>,
Miroslav Benes <mbenes@...e.cz>, Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org, Song Liu <song@...nel.org>, laokz <laokz@...mail.com>,
Jiri Kosina <jikos@...nel.org>, Marcos Paulo de Souza <mpdesouza@...e.com>,
Weinan Liu <wnliu@...gle.com>, Fazla Mehrab <a.mehrab@...edance.com>,
Chen Zhongjin <chenzhongjin@...wei.com>, Puranjay Mohan <puranjay@...nel.org>
Subject: Re: [PATCH v2 54/62] objtool/klp: Add post-link subcommand to
finalize livepatch modules
On Fri, May 09, 2025 at 01:17:18PM -0700, Josh Poimboeuf wrote:
> Livepatch needs some ELF magic which linkers don't like:
>
> - Two relocation sections (.rela*, .klp.rela*) for the same text
> section.
>
> - Use of SHN_LIVEPATCH to mark livepatch symbols.
>
> Unfortunately linkers tend to mangle such things. To work around that,
> klp diff generates a linker-compliant intermediate binary which encodes
> the relevant KLP section/reloc/symbol metadata.
>
> After module linking, the .ko then needs to be converted to an actual
> livepatch module. Introduce a new klp post-link subcommand to do so.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
FWIW, I have plans to get rid of this post-link step by saying goodbye
to "klp relocs" altogether.
I have a working PoC which implements livepatch "submodules" which are
specific to their target object (vmlinux or module). The top-level
livepatch module keeps its submodule .ko binaries in memory (embedded in
its private data) and loads/unloads them on demand.
The end result looks a lot cleaner. It also removes the restrictions we
have today which don't allow references to static call/branch keys which
live in modules.
That will have to be another patch set though, 63 patches is plenty long
enough already.
--
Josh
Powered by blists - more mailing lists