Re: [PATCH v3 0/6] livepatch: klp-convert tool - Minimal version

2024-09-13 Thread Josh Poimboeuf
s/cons to various approaches? We > don't have a microconference this year, but perhaps over lunch or beers? Sure... or maybe at one of the evening events. -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-13 Thread Josh Poimboeuf
g's 0001-test-klp.patch does seem to build w/o odd > relocations and it loads fine. Grr, I'm guessing more toolchain issues. A lot of tools don't seem to like klp relocs. Do you happen to have BTF enabled? I saw something similar with BTF and had a fix in mind but I haven't had a chance to do it. -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-11 Thread Josh Poimboeuf
le. Then there will be an intermediate period where both kpatch-build and klp-build are used and supported, until the other arches get ported over. So I think this should be merged once the x86 support is complete, as it will have users immediately for those who are running on x86 with IBT and/or LTO. -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-11 Thread Josh Poimboeuf
On Mon, Sep 02, 2024 at 08:59:43PM -0700, Josh Poimboeuf wrote: > Hi, > > Here's a new way to build livepatch modules called klp-build. > > I started working on it when I realized that objtool already does 99% of > the work needed for detecting function changes. > &g

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-09 Thread Josh Poimboeuf
On Sat, Sep 07, 2024 at 10:04:25PM -0700, Song Liu wrote: > I think gcc doesn't complain, but clang does: > > $ cat ttt.c > static inline void ret(void) > { > return; > } > > int main(void) > { > return 0; > } Ah... That's probably why the kernel adds "__maybe_unused" to its inline macro (w

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-07 Thread Josh Poimboeuf
sym_start, __sym_last, static inline, __sym) ITSTATIC is 'static inline' so it shouldn't be complaining about it being unused, right? If you add -E to the cflags to get preprocessed output, can you confirm __sym_remove() is 'static inline'? -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-06 Thread Josh Poimboeuf
ing used? Not sure how that would be possible since it should be static inline: INTERVAL_TREE_DEFINE(struct symbol, node, unsigned long, __subtree_last, __sym_start, __sym_last, static inline, __sym) ^ -- Josh

Re: [RFC 28/31] x86/alternative: Create symbols for special section entrie

2024-09-06 Thread Josh Poimboeuf
: Thanks for the report. So far my tests have only been with gcc but I will try clang soon. -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-06 Thread Josh Poimboeuf
the extra kernel flags. How do you normally build objtool? Regardless, I should probably enable a lot of those extra warnings in the objtool Makefile. -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-06 Thread Josh Poimboeuf
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 will provide the > > >

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-06 Thread Josh Poimboeuf
tion *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. -- Josh

Re: [RFC 28/31] x86/alternative: Create symbols for special section entries

2024-09-06 Thread Josh Poimboeuf
. .popsection That's definitely possible, but it's much less cleaner for objtool diff, which works by cloning symbols and their dependencies. If the symbols are your concern, they could easily be stripped with a trivial change to scripts/kallsyms.c:is_ignored_symbol() as Peter suggested. -- Josh

Re: [PATCH v4 2/2] livepatch: Add using attribute to klp_func for using function show

2024-09-05 Thread Josh Poimboeuf
On Thu, Sep 05, 2024 at 12:23:20PM +0200, Miroslav Benes wrote: > I am not a fan. Josh wrote most of my objections already so I will not > repeat them. I understand that the attribute might be useful but the > amount of code it adds to sensitive functions like > klp_complete_transi

Re: [PATCH v4 2/2] livepatch: Add using attribute to klp_func for using function show

2024-09-05 Thread Josh Poimboeuf
able mainly from > dmesg, which is easily flush away or being cleaned. journalctl -b ? > If we use an user space program to maintain the information of patch order, > once the program is killed, the information is loss either. Store the state in a file in /var/run? -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-05 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 09:14:00PM -0700, Josh Poimboeuf wrote: > + if (!!nr_objs) { ^^ oops Fixed version: diff --git a/scripts/livepatch/module.c b/scripts/livepatch/module.c index 101cabf6b2f1..2908999efa21 100644 --- a/scripts/livepatch/module.c +++ b/scri

Re: [RFC 31/31] objtool, livepatch: Livepatch module generation

2024-09-04 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 02:38:14PM -0700, Jeff Johnson wrote: > On 9/2/24 21:00, Josh Poimboeuf wrote: > ... > > diff --git a/scripts/livepatch/module.c b/scripts/livepatch/module.c > > new file mode 100644 > > index ..101cabf6b2f1 > > --- /dev/null > &

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-04 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 01:59:51PM -0700, Josh Poimboeuf wrote: > On Wed, Sep 04, 2024 at 01:23:55PM -0700, Song Liu wrote: > > [ 7285.260195] livepatch: nothing to patch! This seems to be tripping up on an awful hack I had for silencing modpost warnings. Apparently it doesn't

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-04 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 01:23:55PM -0700, Song Liu wrote: > Hi Josh, > > Thanks for the fix! The gcc kernel now compiles. > > I am now testing with the attached config file (where I disabled > CONFIG_DEBUG_INFO_BTF), with the attached patch. Probably a good idea to disable B

Re: [PATCH v4 2/2] livepatch: Add using attribute to klp_func for using function show

2024-09-04 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 03:30:22PM +0800, zhang warden wrote: > > On Sep 4, 2024, at 15:14, Josh Poimboeuf wrote: > > If there are multiple people applying patches independently from each > > other (to the same function even!), you are playing with fire, as there > >

Re: [RFC 28/31] x86/alternative: Create symbols for special section entries

2024-09-04 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 02:39:18PM +0200, Borislav Petkov wrote: > On Tue, Sep 03, 2024 at 09:28:29PM -0700, Josh Poimboeuf wrote: > > Take a more generic approach: for the "array of structs" style sections, > > annotate each struct entry with a symbol containing the entry

Re: [RFC 21/31] objtool: Fix x86 addend calcuation

2024-09-04 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 05:24:21PM +0800, laokz wrote: > On Mon, 2024-09-02 at 21:00 -0700, Josh Poimboeuf wrote: > > +++ b/tools/objtool/arch/loongarch/decode.c > > @@ -20,9 +20,9 @@ unsigned long arch_jump_destination(struct > > instruction *insn) > >

Re: [RFC 28/31] x86/alternative: Create symbols for special section entries

2024-09-04 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 10:08:42AM +0200, Peter Zijlstra wrote: > On Tue, Sep 03, 2024 at 09:28:29PM -0700, Josh Poimboeuf wrote: > > Take a more generic approach: for the "array of structs" style sections, > > annotate each struct entry with a symbol containing the entry

Re: [RFC 29/31] objtool: Calculate function checksums

2024-09-04 Thread Josh Poimboeuf
I'm not sure how to integrate them cleanly. Maybe it could only link to the library if it exists, and then complain later at runtime when the feature gets specified on the cmdline? Or we could try dlopen? -- Josh

Re: [RFC 27/31] objtool: Fix weak symbol detection

2024-09-04 Thread Josh Poimboeuf
On Wed, Sep 04, 2024 at 09:42:54AM +0200, Peter Zijlstra wrote: > On Tue, Sep 03, 2024 at 08:55:13PM -0700, Josh Poimboeuf wrote: > > On Tue, Sep 03, 2024 at 10:26:45AM +0200, Peter Zijlstra wrote: > > > On Mon, Sep 02, 2024 at 09:00:10PM -0700, Josh Poimboeuf wrote: > &g

Re: [PATCH v4 2/2] livepatch: Add using attribute to klp_func for using function show

2024-09-04 Thread Josh Poimboeuf
ost accurate information by one sysfs interface. If there are multiple people applying patches independently from each other (to the same function even!), you are playing with fire, as there could easily be implicit dependencies and conflicts between the patches. -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-04 Thread Josh Poimboeuf
On Tue, Sep 03, 2024 at 11:37:39PM -0700, Josh Poimboeuf wrote: > On Tue, Sep 03, 2024 at 10:26:02PM -0700, Song Liu wrote: > > Hi Josh, > > > > I have attached the config I used for LLVM and gcc. > > !IBT is triggering the ORC bug. This should fix it: Also a CO

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-03 Thread Josh Poimboeuf
On Tue, Sep 03, 2024 at 10:26:02PM -0700, Song Liu wrote: > Hi Josh, > > I have attached the config I used for LLVM and gcc. !IBT is triggering the ORC bug. This should fix it: diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 518c70b8db50..643bfba65d48 100755 ---

Re: [PATCH v4 2/2] livepatch: Add using attribute to klp_func for using function show

2024-09-03 Thread Josh Poimboeuf
a problem. And it adds significant maintenance burden. Why? Do you not have any control over what order your patches are applied? If not, that sounds dangerous and you have much bigger problems. This "problem" needs to be managed in user space. -- Josh

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-03 Thread Josh Poimboeuf
On Tue, Sep 03, 2024 at 10:32:00AM -0700, Song Liu wrote: > Hi Josh, > > Thanks for the patchset! We really need this work so that we can undo our > hack for LTO enabled kernels. > > On Mon, Sep 2, 2024 at 9:00 PM Josh Poimboeuf wrote: > > > > Hi, > > >

Re: [RFC 28/31] x86/alternative: Create symbols for special section entries

2024-09-03 Thread Josh Poimboeuf
On Tue, Sep 03, 2024 at 10:29:09AM +0200, Peter Zijlstra wrote: > On Mon, Sep 02, 2024 at 09:00:11PM -0700, Josh Poimboeuf wrote: > > Create a symbol for each special section entry. This helps objtool > > extract needed entries. > > A little more explanation would be nice,..

Re: [RFC 27/31] objtool: Fix weak symbol detection

2024-09-03 Thread Josh Poimboeuf
On Tue, Sep 03, 2024 at 10:26:45AM +0200, Peter Zijlstra wrote: > On Mon, Sep 02, 2024 at 09:00:10PM -0700, Josh Poimboeuf wrote: > > @@ -433,9 +433,13 @@ static void elf_add_symbol(struct elf *elf, struct > > symbol *sym) > > /* > > * Don't store empty

Re: [RFC 20/31] objtool: Add UD1 detection

2024-09-03 Thread Josh Poimboeuf
On Tue, Sep 03, 2024 at 10:17:48AM +0200, Peter Zijlstra wrote: > On Mon, Sep 02, 2024 at 09:00:03PM -0700, Josh Poimboeuf wrote: > > A UD1 isn't a BUG and shouldn't be treated like one. > > > > Signed-off-by: Josh Poimboeuf > > --- > > tools/objto

Re: [RFC 07/31] kbuild: Remove "kmod" prefix from __KBUILD_MODNAME

2024-09-03 Thread Josh Poimboeuf
On Tue, Sep 03, 2024 at 09:58:13AM +0200, Peter Zijlstra wrote: > On Mon, Sep 02, 2024 at 08:59:50PM -0700, Josh Poimboeuf wrote: > > Remove the arbitrary "kmod" prefix from __KBUILD_MODNAME and add it back > > manually in the __initcall_id() macro. > > > &g

Re: [RFC 05/31] x86/compiler: Tweak __UNIQUE_ID naming

2024-09-03 Thread Josh Poimboeuf
date(struct ftrace_likely_data *f, > > int val, > > */ > > #define ___ADDRESSABLE(sym, __attrs) \ > > static void * __used __attrs \ > > - __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)(uintptr_t)&sym; > > + __UNIQUE_ID(__PASTE(addressable_, sym)) = (void *)(uintptr_t)&sym; > > This change doesn't get mention ? Hm, I have no idea why I did that... I'll drop it. -- Josh

[RFC 31/31] objtool, livepatch: Livepatch module generation

2024-09-02 Thread Josh Poimboeuf
rches (currently x86-64 only) - support clang - performance optimization - automated testing Signed-off-by: Josh Poimboeuf --- .gitignore |3 + include/linux/livepatch.h | 25 +- include/linux/livepatch_ext.h | 83 ++ include/lin

[RFC 30/31] livepatch: Enable -ffunction-sections -fdata-sections

2024-09-02 Thread Josh Poimboeuf
would be to add a toolchain option to always use (symbol) relocations. Signed-off-by: Josh Poimboeuf --- Makefile | 9 + include/asm-generic/vmlinux.lds.h | 2 +- scripts/Makefile.lib | 2 +- scripts/module.lds.S | 13 + 4

[RFC 29/31] objtool: Calculate function checksums

2024-09-02 Thread Josh Poimboeuf
Calculate per-function checksums based on the functions' content and relocations. This will enable objtool to do binary diffs. Signed-off-by: Josh Poimboeuf --- scripts/Makefile.lib| 1 + tools/objtool/Makefile | 7 +- tools/objtool/builtin-ch

[RFC 28/31] x86/alternative: Create symbols for special section entries

2024-09-02 Thread Josh Poimboeuf
Create a symbol for each special section entry. This helps objtool extract needed entries. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/alternative.h | 50 -- arch/x86/include/asm/asm.h | 24 +- arch/x86/include/asm/bug.h | 2

[RFC 27/31] objtool: Fix weak symbol detection

2024-09-02 Thread Josh Poimboeuf
.__x64_sys_io_setup+0x19: unreachable instruction vmlinux.o: warning: objtool: .text.__x64_sys_io_setup+0x20: unreachable instruction Fixes: 4adb23686795 ("objtool: Ignore extra-symbol code") Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 14 +- 1 file changed, 9 insert

[RFC 26/31] objtool: Make interval tree functions "static inline"

2024-09-02 Thread Josh Poimboeuf
Otherwise the compiler warns if a function isn't used. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 42a657268306..471df0336aa7 100644 --- a/tools/objtool/elf.c

[RFC 25/31] objtool: Fix interval tree insertion for zero-length symbols

2024-09-02 Thread Josh Poimboeuf
Zero-length symbols get inserted in the wrong spot. Fix that. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 49528e7835aa..42a657268306 100644 --- a/tools/objtool/elf.c

[RFC 24/31] objtool: Make STACK_FRAME_NON_STANDARD consistent

2024-09-02 Thread Josh Poimboeuf
The C version of STACK_FRAME_NON_STANDARD differs from its asm counterpart: - it uses an 8-byte entry (vs 4-byte) - it creates a superfluous temporary variable Make it identical to the asm version. Signed-off-by: Josh Poimboeuf --- include/linux/objtool.h | 7 --- 1 file changed, 4

[RFC 23/31] objtool: Handle __pa_symbol() relocations

2024-09-02 Thread Josh Poimboeuf
A relocation created by __pa_symbol() has a large addend referring to a physical address. Convert it to back its virtual form before calculating the addend. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/x86/decode.c | 13 - 1 file changed, 12 insertions(+), 1 deletion

[RFC 22/31] objtool: Make find_symbol_containing() less arbitrary

2024-09-02 Thread Josh Poimboeuf
In the rare case of overlapping symbols, find_symbol_containing() just returns the first one it finds. Make it less arbitrary by returning the smallest symbol with size > 0. Eventually we should consider making such overlapping symbols illegal. Signed-off-by: Josh Poimboeuf --- tools/objt

[RFC 21/31] objtool: Fix x86 addend calcuation

2024-09-02 Thread Josh Poimboeuf
arch_dest_reloc_offset() hard-codes the addend adjustment to 4, which isn't always true. In fact it's dependent on the instruction itself. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/loongarch/decode.c | 4 ++-- tools/objtool/arch/powerpc/decode.c | 4 ++-- tools/objtoo

[RFC 20/31] objtool: Add UD1 detection

2024-09-02 Thread Josh Poimboeuf
A UD1 isn't a BUG and shouldn't be treated like one. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/x86/decode.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c index 6b34b058a821..72

[RFC 19/31] objtool: Add elf_create_file()

2024-09-02 Thread Josh Poimboeuf
Add interface to enable the creation of a new ELF file. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 118 tools/objtool/include/objtool/elf.h | 3 +- 2 files changed, 120 insertions(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b

[RFC 18/31] objtool: Disallow duplicate prefix symbols

2024-09-02 Thread Josh Poimboeuf
Error out if a duplicate prefix symbol is attempted. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 5 - tools/objtool/elf.c | 9 + tools/objtool/include/objtool/elf.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a

[RFC 17/31] objtool: Open up the elf API

2024-09-02 Thread Josh Poimboeuf
Expose more functionality in the ELF library. This will be needed for the upcoming "objtool klp" support. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 338 +++- tools/objtool/include/objtool/elf.h | 30 ++- tools/objtool

[RFC 16/31] objtool: Simplify fatal error handling

2024-09-02 Thread Josh Poimboeuf
For fatal errors, exit right away instead of passing the error back. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/loongarch/orc.c | 30 +- tools/objtool/arch/x86/decode.c | 40 +- tools/objtool/arch/x86/orc.c| 27 +- tools/objtool/builtin-check.c

[RFC 15/31] objtool: Interval tree cleanups

2024-09-02 Thread Josh Poimboeuf
Change some comments and variable names to improve readability of the interval tree code. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 50 ++--- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/tools/objtool/elf.c b/tools/objtool

[RFC 14/31] objtool: Refactor add_jump_destinations()

2024-09-02 Thread Josh Poimboeuf
The logic is a bit weird - simplify it. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 239 -- 1 file changed, 114 insertions(+), 125 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 9212b5edffc8..6490bc939892

[RFC 12/31] objtool: 'objname' refactoring

2024-09-02 Thread Josh Poimboeuf
Rename the global 'objname' variable to 'Objname' to avoid local variable conflicts, and initialize it in elf_open_read() which is a more natural place for that. Signed-off-by: Josh Poimboeuf --- tools/objtool/builtin-check.c | 2 +- tools/objtool/check.c

[RFC 13/31] objtool: Support references to all symbol types in special sections

2024-09-02 Thread Josh Poimboeuf
Make the code simpler and more flexible. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 74 +-- 1 file changed, 15 insertions(+), 59 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 92171ce458ec..9212b5edffc8

[RFC 11/31] objtool: Add section/symbol type helpers

2024-09-02 Thread Josh Poimboeuf
Add some helper macros to improve readability. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/x86/special.c| 2 +- tools/objtool/check.c | 66 +- tools/objtool/elf.c | 24 +- tools/objtool/include/objtool/elf.h | 73

[RFC 10/31] objtool: Use 'struct elf' in elf macros

2024-09-02 Thread Josh Poimboeuf
'struct objtool_file' is specific to the check code and doesn't belong in the elf code. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 22 +++--- tools/objtool/include/objtool/elf.h | 8 tools/objtool/orc_gen.c |

[RFC 09/31] objtool: Const string cleanup

2024-09-02 Thread Josh Poimboeuf
Use 'const char *' where applicable. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/loongarch/decode.c | 2 +- tools/objtool/arch/powerpc/decode.c | 2 +- tools/objtool/arch/x86/decode.c | 2 +- tools/objtool/elf.c | 6 +++--- tools/objtool/include/objt

[RFC 07/31] kbuild: Remove "kmod" prefix from __KBUILD_MODNAME

2024-09-02 Thread Josh Poimboeuf
uot;. Signed-off-by: Josh Poimboeuf --- include/linux/init.h | 3 ++- scripts/Makefile.lib | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/init.h b/include/linux/init.h index 58cef4c2e59a..b1921f4a7b7e 100644 --- a/include/linux/init.h +++ b/include/linux/init.

[RFC 08/31] objtool: Remove .parainstructions reference

2024-09-02 Thread Josh Poimboeuf
The section no longer exists since commit 60bc276b129e ("x86/paravirt: Switch mixed paravirt/alternative calls to alternatives"). Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/che

[RFC 06/31] elfnote: Use __UNIQUE_ID() for note symbols

2024-09-02 Thread Josh Poimboeuf
The name of an ELF note symbol isn't important. It just needs to be unique. Simplify by using the existing __UNIQUE_ID() macro. Signed-off-by: Josh Poimboeuf --- include/linux/elfnote.h | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/linux/elfnot

[RFC 05/31] x86/compiler: Tweak __UNIQUE_ID naming

2024-09-02 Thread Josh Poimboeuf
Add an underscore between the "name" and the counter so tooling can distinguish between the non-unique and unique portions of the symbol name. This will come in handy for "objtool klp diff". Signed-off-by: Josh Poimboeuf --- include/linux/compiler.h | 8 ++-- 1 file c

[RFC 04/31] kernel/sys: Don't reference UTS_RELEASE directly

2024-09-02 Thread Josh Poimboeuf
it won't affect function checksums. Signed-off-by: Josh Poimboeuf --- kernel/sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sys.c b/kernel/sys.c index 3a2df1bd9f64..526464ea194b 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1291,7 +1291,7 @@ static in

[RFC 03/31] x86/kprobes: Remove STACK_FRAME_NON_STANDARD annotation

2024-09-02 Thread Josh Poimboeuf
Since commit 877b145f0f47 ("x86/kprobes: Move trampoline code into RODATA"), the optprobe template code is no longer analyzed by objtool so it doesn't need to be ignored. Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/kprobes/opt.c | 4 1 file changed, 4 deletions(-) di

[RFC 02/31] x86/module: Improve relocation error messages

2024-09-02 Thread Josh Poimboeuf
Add the section number and reloc index to relocation error messages to help find the faulty relocation. Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/module.c | 15 +-- kernel/livepatch/core.c | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/x86

[RFC 01/31] x86/alternative: Refactor INT3 call emulation selftest

2024-09-02 Thread Josh Poimboeuf
slightly reworking the functionality and moving int3_selftest_ip() to a separate asm function. While at it, improve the naming. Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/alternative.c | 51 +++ 1 file changed, 28 insertions(+), 23 deletions(-) diff --git

[RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-02 Thread Josh Poimboeuf
eeds, the patch module (livepatch.ko) will be created in the current directory. TODO: - specify module name on cmdline - handle edge cases like correlation of static locals - support other arches (currently x86-64 only) - support clang - performance optimization - automated testing

Re: [PATCH v4] perf,x86: avoid missing caller address in stack traces captured in uprobe

2024-07-10 Thread Josh Poimboeuf
, otherwise is_uprobe_at_func_entry() would never return true on OSes which have the ENDBR64 compiled in. However, once userspace IBT actually gets enabled, uprobe should skip the ENDBR64 and patch the subsequent instruction. Then the is_endbr6() check would no longer be needed. -- Josh

Re: [PATCH v2] perf,x86: avoid missing caller address in stack traces captured in uprobe

2024-07-03 Thread Josh Poimboeuf
? > > > Any pointers? > > > > I had a prototype here: > > > > https://lkml.kernel.org/lkml/cover.1699487758.git.jpoim...@kernel.org > > > > Hopefully I can get started on v2 soon. > > Ok, so you are going to work on this. Please cc me on future revisions > then. Thanks! Will do! -- Josh

Re: [PATCH v3] perf,x86: avoid missing caller address in stack traces captured in uprobe

2024-07-03 Thread Josh Poimboeuf
perf_callchain_store(entry, ret_addr); ... Also it's good practice to wait at least several days before posting new versions to avoid spamming reviewers and to give them time to digest what you've already sent. -- Josh

Re: [PATCH v2] perf,x86: avoid missing caller address in stack traces captured in uprobe

2024-07-02 Thread Josh Poimboeuf
On Tue, Jul 02, 2024 at 08:35:08PM -0700, Andrii Nakryiko wrote: > On Tue, Jul 2, 2024 at 6:11 PM Josh Poimboeuf wrote: > > On Tue, Jul 02, 2024 at 05:06:14PM -0700, Andrii Nakryiko wrote: > > > In general, even with false positives, I think it's overwhelmingly > >

Re: [PATCH] kallsyms, livepatch: Fix livepatch with CONFIG_LTO_CLANG

2024-07-02 Thread Josh Poimboeuf
luding livepatching, where we > want to be 100% sure that we match the right symbol. > > They want to match the full names. They even need to distinguish > symbols with the same name. > > > IMHO, we need a separate API for each use-case. We should just always link with -zunique-symbols so the duplicate symbols no longer exist. That would solve a lot of problems. -- Josh

Re: [PATCH v2] perf,x86: avoid missing caller address in stack traces captured in uprobe

2024-07-02 Thread Josh Poimboeuf
e correct), which should be easy for humans to recognize > and filter out, if necessary. Agreed, this is a definite improvement overall. BTW, soon there will be support for sframes instead of frame pointers, at which point these checks should only be done for the frame pointer case. -- Josh

Re: [PATCH v2] perf,x86: avoid missing caller address in stack traces captured in uprobe

2024-07-02 Thread Josh Poimboeuf
On Tue, Jul 02, 2024 at 04:35:56PM -0700, Josh Poimboeuf wrote: > On Tue, Jul 02, 2024 at 10:18:58AM -0700, Andrii Nakryiko wrote: > > When tracing user functions with uprobe functionality, it's common to > > install the probe (e.g., a BPF program) at the first instruction

Re: [PATCH v2] perf,x86: avoid missing caller address in stack traces captured in uprobe

2024-07-02 Thread Josh Poimboeuf
stack trace before proceeding to unwind the > rest using frame pointer-based logic. > > Signed-off-by: Andrii Nakryiko Should it also check for ENDBR64? When compiled with -fcf-protection=branch, the first instruction of the function will almost always be ENDBR64. I'm not sure about other distros, but at least Fedora compiles its binaries like that. -- Josh

Re: [PATCH 1/1] livepatch: Rename KLP_* to KLP_TRANSITION_*

2024-05-07 Thread Josh Poimboeuf
ed-off-by: Wardenjohn Acked-by: Josh Poimboeuf -- Josh

Re: [PATCH 0/1] *** Replace KLP_* to KLP_TRANSITION_* ***

2024-05-06 Thread Josh Poimboeuf
On Tue, May 07, 2024 at 10:56:09AM +0800, zhang warden wrote: > > > > On May 7, 2024, at 10:41, Josh Poimboeuf wrote: > > > > On Tue, May 07, 2024 at 10:21:40AM +0800, zhang warden wrote: > >> > >> > >>> > >>> transition sta

Re: [PATCH 0/1] *** Replace KLP_* to KLP_TRANSITION_* ***

2024-05-06 Thread Josh Poimboeuf
code do no harms here. Maybe it can be kept. The comments aren't actually correct. For example, KLP_TRANSITION_UNPATCHED doesn't always mean "transitioning to unpatched state". Sometimes it means "transitioning *from* unpatched state". -- Josh

Re: [PATCH] livepatch.h: Add comment to klp transition state

2024-05-05 Thread Josh Poimboeuf
N_UNPATCHED KLP_TRANSITION_PATCHED which shouldn't break userspace AFAIK. -- Josh

Re: [RFC PATCH 0/4] perf: Correlating user process data to samples

2024-04-18 Thread Josh Poimboeuf
#x27;s the SFRAME work? Are there pointers to work I > > > could look at and think about what a rebase looks like? Or do you have > > > someone in mind I should work with for this? > > > > I've been offline for a little while and still need to catch up with > &g

Re: [POC 0/7] livepatch: Make livepatch states, callbacks, and shadow variables work together

2023-11-10 Thread Josh Poimboeuf
(void); void klp_states_post_patch_replaced(void); void klp_states_pre_unpatch_replaced(void); void klp_states_post_unpatch_replaced(void); ? (note that passing klp_transition_patch might be optional since state.c already has visibility to it anyway) -- Josh

Re: [RFC PATCH 07/86] Revert "livepatch,sched: Add livepatch task switching to cond_resched()"

2023-11-09 Thread Josh Poimboeuf
d a non-preempted hook (because non-ORC unwinders can't unwind reliably through preemption) which called klp to unwind from the context of the task. Without something to hook into, we have a problem. We could of course hook into schedule(), but if the kthread never calls schedule() from a non-preempted context then it still doesn't help. -- Josh

Re: [RFC PATCH 07/86] Revert "livepatch,sched: Add livepatch task switching to cond_resched()"

2023-11-09 Thread Josh Poimboeuf
On Thu, Nov 09, 2023 at 12:31:47PM -0500, Steven Rostedt wrote: > On Thu, 9 Nov 2023 09:26:37 -0800 > Josh Poimboeuf wrote: > > > On Tue, Nov 07, 2023 at 06:16:09PM -0500, Steven Rostedt wrote: > > > On Tue, 7 Nov 2023 13:56:53 -0800 > > > Ankur Arora wro

Re: [RFC PATCH 07/86] Revert "livepatch,sched: Add livepatch task switching to cond_resched()"

2023-11-09 Thread Josh Poimboeuf
But again if they go through the preemption path then we have the same problem for non-ORC. Worst case we'll need to sprinkle cond_livepatch() everywhere :-/ -- Josh

Re: [PATCH 01/15] objtool: Find a destination for jumps beyond the section end

2021-04-20 Thread Josh Poimboeuf
On Tue, Apr 20, 2021 at 01:25:43PM -0700, Sami Tolvanen wrote: > On Tue, Apr 20, 2021 at 11:14 AM Josh Poimboeuf wrote: > > > > On Fri, Apr 16, 2021 at 01:38:30PM -0700, Sami Tolvanen wrote: > > > With -ffunction-sections, Clang can generate a jump beyond the end of

Re: [PATCH 02/15] objtool: Add CONFIG_CFI_CLANG support

2021-04-20 Thread Josh Poimboeuf
00 .text..L.cfi.jumptable.8047 + 8 which then translates to 0009 06320004 R_X86_64_PLT32 x2apic_prepare_cpu - 4 so the original addend of '8' is no longer valid. Copying the '-4' wouldn't be right either, because that only applies to a PLT32 text reloc. A '0' should be appropriate for the 32S data reloc. This addend might not actually be read by any code, so it may not currently be an actual bug, but better safe than sorry. -- Josh

Re: [PATCH 01/15] objtool: Find a destination for jumps beyond the section end

2021-04-20 Thread Josh Poimboeuf
On Fri, Apr 16, 2021 at 01:38:30PM -0700, Sami Tolvanen wrote: > With -ffunction-sections, Clang can generate a jump beyond the end of > a section when the section ends in an unreachable instruction. Why? Can you show an example? -- Josh

[tip: objtool/core] x86/crypto/aesni-intel_avx: Standardize stack alignment prologue

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: e163be86fff3deec70f63330fc43fedf892c9aee Gitweb: https://git.kernel.org/tip/e163be86fff3deec70f63330fc43fedf892c9aee Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:17 -06:00

[tip: objtool/core] x86/crypto/aesni-intel_avx: Remove unused macros

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 4f08300916e882a0c34a2f325ff3fea2be2e57b3 Gitweb: https://git.kernel.org/tip/4f08300916e882a0c34a2f325ff3fea2be2e57b3 Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:15 -06:00

[tip: objtool/core] x86/crypto/aesni-intel_avx: Fix register usage comments

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: ff5796b6dbea4763fdca002101e32b60aa17f8e8 Gitweb: https://git.kernel.org/tip/ff5796b6dbea4763fdca002101e32b60aa17f8e8 Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:16 -06:00

[tip: objtool/core] objtool: Support asm jump tables

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 99033461e685b48549ec77608b4bda75ddf772ce Gitweb: https://git.kernel.org/tip/99033461e685b48549ec77608b4bda75ddf772ce Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:14 -06:00

[tip: objtool/core] x86/crypto/sha512-avx2: Standardize stack alignment prologue

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: ec063e090bd6487097d459bb4272508b78448270 Gitweb: https://git.kernel.org/tip/ec063e090bd6487097d459bb4272508b78448270 Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:24 -06:00

[tip: objtool/core] x86/crypto/sha_ni: Standardize stack alignment prologue

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 35a0067d2c02a7c35466db5f207b7b9265de84d9 Gitweb: https://git.kernel.org/tip/35a0067d2c02a7c35466db5f207b7b9265de84d9 Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:20 -06:00

[tip: objtool/core] x86/crypto/crc32c-pcl-intel: Standardize jump table

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 2b02ed55482a1c5c310a7f53707292fcf1601e7a Gitweb: https://git.kernel.org/tip/2b02ed55482a1c5c310a7f53707292fcf1601e7a Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:19 -06:00

[tip: objtool/core] x86/crypto/camellia-aesni-avx2: Unconditionally allocate stack buffer

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: dabe5167a3cbb4bf16b20c0e5b6497513e2e3a08 Gitweb: https://git.kernel.org/tip/dabe5167a3cbb4bf16b20c0e5b6497513e2e3a08 Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:18 -06:00

[tip: objtool/core] x86/crypto/sha512-ssse3: Standardize stack alignment prologue

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 27d26793f2105281d9374928448142777cef6f74 Gitweb: https://git.kernel.org/tip/27d26793f2105281d9374928448142777cef6f74 Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:25 -06:00

[tip: objtool/core] x86/crypto/sha256-avx2: Standardize stack alignment prologue

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: ce5846668076aa76a17ab559f0296374e3611fec Gitweb: https://git.kernel.org/tip/ce5846668076aa76a17ab559f0296374e3611fec Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:22 -06:00

[tip: objtool/core] x86/crypto/sha1_avx2: Standardize stack alignment prologue

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 20114c899cafa8313534a841cab0ab1f7ab09672 Gitweb: https://git.kernel.org/tip/20114c899cafa8313534a841cab0ab1f7ab09672 Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:21 -06:00

[tip: objtool/core] x86/crypto: Enable objtool in crypto code

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 7d3d10e0e85fb7c23a86a70f795b1eabd2bc030b Gitweb: https://git.kernel.org/tip/7d3d10e0e85fb7c23a86a70f795b1eabd2bc030b Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:26 -06:00

[tip: objtool/core] x86/crypto/sha512-avx: Standardize stack alignment prologue

2021-04-20 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip: Commit-ID: d61684b56edf369f0a6d388088d7c9d59f1618d4 Gitweb: https://git.kernel.org/tip/d61684b56edf369f0a6d388088d7c9d59f1618d4 Author:Josh Poimboeuf AuthorDate:Wed, 24 Feb 2021 10:29:23 -06:00

Re: [PATCH 0/9] sched: Core scheduling interfaces

2021-04-19 Thread Josh Don
On Mon, Apr 19, 2021 at 2:01 AM Peter Zijlstra wrote: > > Josh, you being on the other Google team, the one that actually uses the > cgroup interface AFAIU, can you fight the good fight with TJ on this? A bit of extra context is in https://lore.kernel.org/lkml/cabk29nttsc

  1   2   3   4   5   6   7   8   9   10   >