All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] livepatch: klp-convert tool - Minimal version
@ 2024-05-16 13:30 Lukas Hruska
  2024-05-16 13:30 ` [PATCH v2 1/6] livepatch: Create and include UAPI headers Lukas Hruska
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Lukas Hruska @ 2024-05-16 13:30 UTC (permalink / raw)
  To: pmladek, mbenes, jpoimboe
  Cc: joe.lawrence, live-patching, linux-kernel, linux-kbuild,
	mpdesouza, lhruska

Summary
-------

This is a significantly simplified version of the original klp-convert tool.
The klp-convert code has never got a proper review and also clean ups
were not easy. The last version was v7, see
https://lore.kernel.org/r/20230306140824.3858543-1-joe.lawrence@redhat.com

The main change is that the tool does not longer search for the
symbols which would need the livepatch specific relocation entry.
Also klp.symbols file is not longer needed.

Instead, the needed information is appended to the symbol declaration
via a new macro KLP_RELOC_SYMBOL(). It creates symbol with all needed
metadata. For example:

  extern char *saved_command_line \
                 KLP_RELOC_SYMBOL(vmlinux, vmlinux, saved_command_line, 0);

would create symbol

$>readelf -r -W <compiled livepatch module>:
Relocation section '.rela.text' at offset 0x32e60 contains 10 entries:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
[...]
0000000000000068  0000003c00000002 R_X86_64_PC32          0000000000000000 .klp.sym.rela.vmlinux.vmlinux.saved_command_line,0 - 4
[...]


The simplified klp-convert tool just transforms symbols
created by KLP_RELOC_SYMBOL() to object specific rela sections
and rela entries which would later be proceed when the livepatch
or the livepatched object is loaded.

For example, klp-convert would replace the above symbols with:

$> readelf -r -W <livepatch_module_proceed_by_klp_convert>
Relocation section '.klp.rela.vmlinux.text' at offset 0x5cb60 contains 1 entry:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
0000000000000068  0000003c00000002 R_X86_64_PC32          0000000000000000 .klp.sym.vmlinux.saved_command_line,0 - 4


Note that similar macro was needed also in the original version
to handle more symbols of the same name (sympos).

Given the above, add klp-convert tool; integrate klp-convert tool into
kbuild; add data-structure and macros to enable users to annotate
livepatch source code; make modpost stage compatible with livepatches;
update livepatch-sample and update documentation.


Testing
-------

The patchset selftests build and execute on x86_64, s390x, and ppc64le
for both default config (with added livepatch dependencies) and a larger
SLE-15-ish config.


Summary of changes in this minimal version v2
------------------------

- rebase for v6.9
- cleaned-up SoB chains (suggested by pmladek)
- klp-convert: remove the symbol map auto-resolving solution
- klp-convert: add macro for flagging variables inside a LP src to be resolved by this tool
- klp-convert: code simplification
- selftests: add selftest livepatching function using an external symbol

Previous versions
-----------------

RFC:
  https://lore.kernel.org/r/cover.1477578530.git.jpoimboe@redhat.com/
v2:
  https://lore.kernel.org/r/f52d29f7-7d1b-ad3d-050b-a9fa8878faf2@redhat.com/
v3:
  https://lore.kernel.org/r/20190410155058.9437-1-joe.lawrence@redhat.com/
v4:
  https://lore.kernel.org/r/20190509143859.9050-1-joe.lawrence@redhat.com/
v5:
  (not posted)
  https://github.com/joe-lawrence/klp-convert-tree/tree/klp-convert-v5-devel
v6:
  https://lore.kernel.org/r/20220216163940.228309-1-joe.lawrence@redhat.com/
v7:
  https://lore.kernel.org/r/20230306140824.3858543-1-joe.lawrence@redhat.com/
v1 minimal:
  https://lore.kernel.org/r/20231106162513.17556-1-lhruska@suse.cz/

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH v2 6/6] selftests: livepatch: Test livepatching function using an external symbol
  2024-05-16 13:30 ` [PATCH v2 6/6] selftests: livepatch: Test livepatching function using an external symbol Lukas Hruska
@ 2024-05-23  7:21 ` kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2024-05-18 18:29 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20240516133009.20224-7-lhruska@suse.cz>
References: <20240516133009.20224-7-lhruska@suse.cz>
TO: Lukas Hruska <lhruska@suse.cz>
TO: pmladek@suse.com
TO: mbenes@suse.cz
TO: jpoimboe@kernel.org
CC: joe.lawrence@redhat.com
CC: live-patching@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-kbuild@vger.kernel.org
CC: mpdesouza@suse.com
CC: lhruska@suse.cz

Hi Lukas,

kernel test robot noticed the following build errors:

[auto build test ERROR on masahiroy-kbuild/fixes]
[also build test ERROR on shuah-kselftest/next shuah-kselftest/fixes linus/master v6.9]
[cannot apply to masahiroy-kbuild/for-next next-20240517]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lukas-Hruska/livepatch-Add-klp-convert-tool/20240516-223103
base:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git fixes
patch link:    https://lore.kernel.org/r/20240516133009.20224-7-lhruska%40suse.cz
patch subject: [PATCH v2 6/6] selftests: livepatch: Test livepatching function using an external symbol
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240519/202405190214.M93ZmZJb-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202405190214.M93ZmZJb-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "".klp.sym.rela.test_klp_extern_hello.test_klp_extern_hello.hello_msg,0"" [tools/testing/selftests/livepatch/test_modules/test_klp_extern.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-06-06 10:05 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-16 13:30 [PATCH v2 0/5] livepatch: klp-convert tool - Minimal version Lukas Hruska
2024-05-16 13:30 ` [PATCH v2 1/6] livepatch: Create and include UAPI headers Lukas Hruska
2024-05-16 13:30 ` [PATCH v2 2/6] livepatch: Add klp-convert tool Lukas Hruska
2024-05-22 10:05   ` Petr Mladek
2024-05-29 21:04   ` Joe Lawrence
2024-05-30 20:07   ` Joe Lawrence
2024-06-06 10:05     ` Lukas Hruska
2024-05-16 13:30 ` [PATCH v2 3/6] kbuild/modpost: integrate klp-convert Lukas Hruska
2024-05-16 13:30 ` [PATCH v2 4/6] livepatch: Add sample livepatch module Lukas Hruska
2024-05-22 11:37   ` Petr Mladek
2024-05-16 13:30 ` [PATCH v2 5/6] documentation: Update on livepatch elf format Lukas Hruska
2024-05-16 13:30 ` [PATCH v2 6/6] selftests: livepatch: Test livepatching function using an external symbol Lukas Hruska
2024-05-22 11:44   ` Petr Mladek
2024-05-29 14:05 ` [PATCH v2 0/5] livepatch: klp-convert tool - Minimal version Marcos Paulo de Souza
  -- strict thread matches above, loose matches on Subject: below --
2024-05-18 18:29 [PATCH v2 6/6] selftests: livepatch: Test livepatching function using an external symbol kernel test robot
2024-05-23  7:21 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.