lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240906224549.3et6ikhqi6vr2d3m@treble>
Date: Fri, 6 Sep 2024 15:45:49 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Joe Lawrence <joe.lawrence@...hat.com>
Cc: live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
	x86@...nel.org, Miroslav Benes <mbenes@...e.cz>,
	Petr Mladek <pmladek@...e.com>, Jiri Kosina <jikos@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Marcos Paulo de Souza <mpdesouza@...e.com>,
	Song Liu <song@...nel.org>
Subject: Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

On Fri, Sep 06, 2024 at 05:01:51PM -0400, Joe Lawrence wrote:
> 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 :)

Hm, did you get this fix?

https://lkml.kernel.org/lkml/20240904070952.kkafz2w5m7wnhblh@treble

-- 
Josh

Powered by blists - more mailing lists