All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Lawrence <joe.lawrence@redhat.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
	x86@kernel.org, Miroslav Benes <mbenes@suse.cz>,
	Petr Mladek <pmladek@suse.com>, Jiri Kosina <jikos@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Marcos Paulo de Souza <mpdesouza@suse.com>,
	Song Liu <song@kernel.org>
Subject: Re: [RFC 00/31] objtool, livepatch: Livepatch module generation
Date: Fri, 6 Sep 2024 17:01:51 -0400	[thread overview]
Message-ID: <Ztttv0Eo/FHyxo78@redhat.com> (raw)
In-Reply-To: <20240906170008.fc7h3vqdpwnkok3b@treble>

On Fri, Sep 06, 2024 at 10:00:08AM -0700, Josh Poimboeuf wrote:
> On Fri, Sep 06, 2024 at 09:56:06AM -0400, Joe Lawrence wrote:
> > In the case of klp-diff.c, adding #include <string.h> will provide the
> > memmem prototype.  For both files, I needed to #define _GNU_SOURCE for
> > that prototype though.
> > 
> > For the other complaint, I just set struct instruction *dest_insn = NULL
> > at the top of the for loop, but perhaps the code could be refactored to
> > clarify the situation to the compiler if you prefer not to do that.
> 
> Thanks!  I'll get these fixed up.
> 

Also, with the workarounds mentioned above, the two you sent to Song,
and the same .config I attached in the first email, I get the following
error when trying to build the canonical /proc/cmdline example:

  $ cat cmdline-string.patch 
  diff --git a/fs/proc/cmdline.c b/fs/proc/cmdline.c
  index a6f76121955f..2bcaf9ec6f78 100644
  --- a/fs/proc/cmdline.c
  +++ b/fs/proc/cmdline.c
  @@ -7,8 +7,7 @@
   
   static int cmdline_proc_show(struct seq_file *m, void *v)
   {
  -       seq_puts(m, saved_command_line);
  -       seq_putc(m, '\n');
  +       seq_printf(m, "%s kpatch=1", saved_command_line);
          return 0;
   }


  $ ./scripts/livepatch/klp-build ./cmdline-string.patch 2>&1 | tee build2.out
  - klp-build: building original kernel
  vmlinux.o: warning: objtool: init_espfix_bsp+0xab: unreachable instruction
  vmlinux.o: warning: objtool: init_espfix_ap+0x50: unreachable instruction
  vmlinux.o: warning: objtool: syscall_init+0xca: unreachable instruction
  vmlinux.o: warning: objtool: sync_core_before_usermode+0xf: unreachable instruction
  vmlinux.o: warning: objtool: sync_core_before_usermode+0xf: unreachable instruction
  vmlinux.o: warning: objtool: tc_wrapper_init+0x16: unreachable instruction
  vmlinux.o: warning: objtool: pvh_start_xen+0x50: relocation to !ENDBR: pvh_start_xen+0x57
  - klp-build: building patched kernel
  vmlinux.o: warning: objtool: init_espfix_bsp+0xab: unreachable instruction
  vmlinux.o: warning: objtool: init_espfix_ap+0x50: unreachable instruction
  vmlinux.o: warning: objtool: syscall_init+0xca: unreachable instruction
  vmlinux.o: warning: objtool: sync_core_before_usermode+0xf: unreachable instruction
  vmlinux.o: warning: objtool: sync_core_before_usermode+0xf: unreachable instruction
  vmlinux.o: warning: objtool: tc_wrapper_init+0x16: unreachable instruction
  vmlinux.o: warning: objtool: pvh_start_xen+0x50: relocation to !ENDBR: pvh_start_xen+0x57
  - klp-build: diffing objects
  kvm.o: added: __UNIQUE_ID_nop_644
  kvm.o: added: __UNIQUE_ID_nop_645
  kvm.o: added: __UNIQUE_ID_nop_646
  kvm.o: added: __UNIQUE_ID_nop_647
  kvm.o: added: __UNIQUE_ID_nop_648
  kvm.o: added: __UNIQUE_ID_nop_649
  kvm.o: added: __UNIQUE_ID_nop_650
  kvm.o: added: __UNIQUE_ID_nop_651
  kvm.o: added: __UNIQUE_ID_nop_652
  vmlinux.o: changed: cmdline_proc_show
  - klp-build: building patch module
  make[2]: /bin/sh: Argument list too long
  make[2]: *** [scripts/Makefile.build:253: /home/jolawren/src/linux/klp-tmp/out/livepatch.mod] Error 127
  make[1]: *** [/home/jolawren/src/linux/Makefile:1943: /home/jolawren/src/linux/klp-tmp/out] Error 2
  make: *** [Makefile:240: __sub-make] Error 2
  klp-build: error: module build failed

I'm guessing that this happens because of the huge dependency line in
klp-tmp/out/Kbuild for livepatch-y, it includes over 2000 object files
(that I'm pretty sure didn't change :)

I can set this up on a live machine next week if you want to investigate
further.

--
Joe


  reply	other threads:[~2024-09-06 21:02 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03  3:59 [RFC 00/31] objtool, livepatch: Livepatch module generation Josh Poimboeuf
2024-09-03  3:59 ` [RFC 01/31] x86/alternative: Refactor INT3 call emulation selftest Josh Poimboeuf
2024-09-03  3:59 ` [RFC 02/31] x86/module: Improve relocation error messages Josh Poimboeuf
2024-09-03  3:59 ` [RFC 03/31] x86/kprobes: Remove STACK_FRAME_NON_STANDARD annotation Josh Poimboeuf
2024-09-03  3:59 ` [RFC 04/31] kernel/sys: Don't reference UTS_RELEASE directly Josh Poimboeuf
2024-09-03  3:59 ` [RFC 05/31] x86/compiler: Tweak __UNIQUE_ID naming Josh Poimboeuf
2024-09-03  7:56   ` Peter Zijlstra
2024-09-04  2:01     ` Josh Poimboeuf
2024-09-08 19:43     ` David Laight
2024-09-03  3:59 ` [RFC 06/31] elfnote: Use __UNIQUE_ID() for note symbols Josh Poimboeuf
2024-09-03  3:59 ` [RFC 07/31] kbuild: Remove "kmod" prefix from __KBUILD_MODNAME Josh Poimboeuf
2024-09-03  7:58   ` Peter Zijlstra
2024-09-04  2:11     ` Josh Poimboeuf
2024-09-04  7:53       ` Peter Zijlstra
2024-09-03  3:59 ` [RFC 08/31] objtool: Remove .parainstructions reference Josh Poimboeuf
2024-09-03  3:59 ` [RFC 09/31] objtool: Const string cleanup Josh Poimboeuf
2024-09-03  3:59 ` [RFC 10/31] objtool: Use 'struct elf' in elf macros Josh Poimboeuf
2024-09-03  3:59 ` [RFC 11/31] objtool: Add section/symbol type helpers Josh Poimboeuf
2024-09-03  3:59 ` [RFC 12/31] objtool: 'objname' refactoring Josh Poimboeuf
2024-09-03  3:59 ` [RFC 13/31] objtool: Support references to all symbol types in special sections Josh Poimboeuf
2024-09-03  3:59 ` [RFC 14/31] objtool: Refactor add_jump_destinations() Josh Poimboeuf
2024-09-03  3:59 ` [RFC 15/31] objtool: Interval tree cleanups Josh Poimboeuf
2024-09-03  3:59 ` [RFC 16/31] objtool: Simplify fatal error handling Josh Poimboeuf
2024-09-03  4:00 ` [RFC 17/31] objtool: Open up the elf API Josh Poimboeuf
2024-09-03  4:00 ` [RFC 18/31] objtool: Disallow duplicate prefix symbols Josh Poimboeuf
2024-09-03  4:00 ` [RFC 19/31] objtool: Add elf_create_file() Josh Poimboeuf
2024-09-03  4:00 ` [RFC 20/31] objtool: Add UD1 detection Josh Poimboeuf
2024-09-03  8:17   ` Peter Zijlstra
2024-09-04  2:25     ` Josh Poimboeuf
2024-09-03  4:00 ` [RFC 21/31] objtool: Fix x86 addend calcuation Josh Poimboeuf
2024-09-04  9:24   ` laokz
2024-09-04 16:15     ` Josh Poimboeuf
2024-09-03  4:00 ` [RFC 22/31] objtool: Make find_symbol_containing() less arbitrary Josh Poimboeuf
2024-09-03  4:00 ` [RFC 23/31] objtool: Handle __pa_symbol() relocations Josh Poimboeuf
2024-09-03  4:00 ` [RFC 24/31] objtool: Make STACK_FRAME_NON_STANDARD consistent Josh Poimboeuf
2024-09-03  4:00 ` [RFC 25/31] objtool: Fix interval tree insertion for zero-length symbols Josh Poimboeuf
2024-09-03  4:00 ` [RFC 26/31] objtool: Make interval tree functions "static inline" Josh Poimboeuf
2024-09-03  4:00 ` [RFC 27/31] objtool: Fix weak symbol detection Josh Poimboeuf
2024-09-03  8:26   ` Peter Zijlstra
2024-09-04  3:55     ` Josh Poimboeuf
2024-09-04  7:42       ` Peter Zijlstra
2024-09-04 16:03         ` Josh Poimboeuf
2024-09-03  4:00 ` [RFC 28/31] x86/alternative: Create symbols for special section entries Josh Poimboeuf
2024-09-03  8:29   ` Peter Zijlstra
2024-09-04  4:28     ` Josh Poimboeuf
2024-09-04  8:08       ` Peter Zijlstra
2024-09-04 16:13         ` Josh Poimboeuf
2024-09-04 12:39       ` Borislav Petkov
2024-09-04 16:44         ` Josh Poimboeuf
2024-09-06 10:19           ` Borislav Petkov
2024-09-06 16:53             ` Josh Poimboeuf
2024-09-06  6:51   ` [RFC 28/31] x86/alternative: Create symbols for special section entrie Weinan Liu
2024-09-07  6:28     ` Josh Poimboeuf
2024-09-03  4:00 ` [RFC 29/31] objtool: Calculate function checksums Josh Poimboeuf
2024-09-04  7:54   ` Peter Zijlstra
2024-09-04 16:11     ` Josh Poimboeuf
2024-09-03  4:00 ` [RFC 30/31] livepatch: Enable -ffunction-sections -fdata-sections Josh Poimboeuf
2024-09-03  4:00 ` [RFC 31/31] objtool, livepatch: Livepatch module generation Josh Poimboeuf
2024-09-04 21:38   ` Jeff Johnson
2024-09-05  4:15     ` Josh Poimboeuf
2024-09-12  2:39   ` laokz
2024-09-03 17:32 ` [RFC 00/31] " Song Liu
2024-09-04  4:30   ` Josh Poimboeuf
2024-09-04  5:26     ` Song Liu
2024-09-04  6:37       ` Josh Poimboeuf
2024-09-04  7:09         ` Josh Poimboeuf
2024-09-04 20:23           ` Song Liu
2024-09-04 20:59             ` Josh Poimboeuf
2024-09-04 21:32               ` Song Liu
2024-09-05  4:13               ` Josh Poimboeuf
2024-09-05  7:13                 ` Josh Poimboeuf
2024-09-05 21:34                   ` Song Liu
2024-09-07  6:46   ` Josh Poimboeuf
2024-09-07 17:43     ` Song Liu
2024-09-07 20:14       ` Josh Poimboeuf
2024-09-08  5:04         ` Song Liu
2024-09-09 21:19           ` Josh Poimboeuf
2024-09-09 21:43             ` Song Liu
2024-09-06 13:56 ` Joe Lawrence
2024-09-06 17:00   ` Josh Poimboeuf
2024-09-06 21:01     ` Joe Lawrence [this message]
2024-09-06 22:45       ` Josh Poimboeuf
2024-09-07  1:47   ` Josh Poimboeuf
2024-09-07 14:17     ` Joe Lawrence
2024-09-11  7:39 ` Josh Poimboeuf
2024-09-12 13:44   ` Joe Lawrence
2024-09-13 14:39     ` Joe Lawrence
2024-09-13 23:09       ` Josh Poimboeuf
2024-09-11 13:27 ` Petr Mladek
2024-09-11 16:20   ` Josh Poimboeuf
2024-09-12 16:05     ` Song Liu
2024-09-13 18:16       ` [External] " A K M Fazla Mehrab .
2024-09-17  7:12     ` Petr Mladek
2024-09-23  2:29     ` Chen Zhongjin

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=Ztttv0Eo/FHyxo78@redhat.com \
    --to=joe.lawrence@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mpdesouza@suse.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=song@kernel.org \
    --cc=x86@kernel.org \
    /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 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.