[PATCH 05/15] scripts/mod: disable LTO for empty.c

2017-11-03 Thread Sami Tolvanen
With CONFIG_CLANG_LTO, clang generates LLVM IR instead of ELF object files. As empty.o is used for probing target properties, disable LTO for it to produce an object file instead. Signed-off-by: Sami Tolvanen --- scripts/mod/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts

[PATCH 01/15] kbuild: add ld-name macro and support for GNU gold

2017-11-03 Thread Sami Tolvanen
GNU gold may require different flags than GNU ld. Add a macro for detecting the linker and conditionally add gold specific flags from LDFLAGS_GOLD. Signed-off-by: Sami Tolvanen --- Makefile | 5 + scripts/Kbuild.include | 4 2 files changed, 9 insertions(+) diff --git a

[PATCH 13/15] arm64: add a workaround for GNU gold with ARM64_MODULE_PLTS

2017-11-03 Thread Sami Tolvanen
when RANDOMIZE_MODULE_REGION_FULL is selected, 2) and disables RANDOMIZE_MODULE_REGION_FULL with clang LTO. Signed-off-by: Sami Tolvanen --- arch/arm64/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 43ccddb7c8ec..a301fdc90319 1

[PATCH 14/15] arm64: crypto: disable LTO for aes-ce-cipher.c

2017-11-03 Thread Sami Tolvanen
CONFIG_CLANG_LTO requires the use of clang's integrated assembler, which doesn't understand the inline assembly in aes-ce-cipher.c. Disable LTO for the file to work around the issue. Signed-off-by: Sami Tolvanen --- arch/arm64/crypto/Makefile | 2 +- 1 file changed, 1 insertion(+),

[PATCH 12/15] arm64: add a workaround for GNU gold with ARM64_MODULE_PLTS

2017-11-03 Thread Sami Tolvanen
when RANDOMIZE_MODULE_REGION_FULL is selected, 2) and disables RANDOMIZE_MODULE_REGION_FULL with clang LTO. Signed-off-by: Sami Tolvanen --- arch/arm64/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 43ccddb7c8ec..a301fdc90319 1

[PATCH 13/15] arm64: fix mrs_s/msr_s macros for clang LTO

2017-11-03 Thread Sami Tolvanen
9 As binutils doesn't allow macros to be redefined, this change adds C preprocessor macros that define the assembly macros globally for binutils and locally for clang's integrated assembler. Suggested-by: Greg Hackmann Suggested-by: Nick Desaulniers Signed-off-by: Sami Tolvanen --- arc

[PATCH 15/15] arm64: select ARCH_SUPPORTS_CLANG_LTO

2017-11-03 Thread Sami Tolvanen
Allow CONFIG_CLANG_LTO to be enabled for the architecture. Signed-off-by: Sami Tolvanen --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a301fdc90319..6ae31f0c58ee 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig

[PATCH 10/15] arm64: disable ARM64_ERRATUM_843419 for clang LTO

2017-11-03 Thread Sami Tolvanen
CONFIG_CLANG_LTO depends on GNU gold, which can generate ADR_PREL_PG_HI21 relocations even with --fix-cortex-a53-843419. Since ARM64_ERRATUM_843419 disables kernel support for these relocations, disable the erratum when LTO is used. Signed-off-by: Sami Tolvanen --- arch/arm64/Kconfig | 1 + 1

[PATCH 11/15] arm64: fix mrs_s/msr_s macros for clang LTO

2017-11-03 Thread Sami Tolvanen
9 As binutils doesn't allow macros to be redefined, this change adds C preprocessor macros that define the assembly macros globally for binutils and locally for clang's integrated assembler. Suggested-by: Greg Hackmann Suggested-by: Nick Desaulniers Signed-off-by: Sami Tolvanen --- arc

[PATCH 11/15] arm64: explicitly pass --no-fix-cortex-a53-843419 to GNU gold

2017-11-03 Thread Sami Tolvanen
e the erratum fix is not used even if the linker is configured to enable it by default. Signed-off-by: Sami Tolvanen --- arch/arm64/Makefile | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index c16bd1ab37f8..0c1fb297c98e 100644 --- a/arch/arm64/Mak

[PATCH 12/15] arm64: explicitly pass --no-fix-cortex-a53-843419 to GNU gold

2017-11-03 Thread Sami Tolvanen
e the erratum fix is not used even if the linker is configured to enable it by default. Signed-off-by: Sami Tolvanen --- arch/arm64/Makefile | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index c16bd1ab37f8..0c1fb297c98e 100644 --- a/arch/arm64/Mak

[PATCH 09/15] arm64: keep .altinstructions and .altinstr_replacement

2017-11-03 Thread Sami Tolvanen
Make sure the linker doesn't remove .altinstructions or .altinstr_replacement when CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is enabled. Signed-off-by: Sami Tolvanen --- arch/arm64/kernel/vmlinux.lds.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/k

[PATCH 08/15] arm64: don't pass -maarch64linux to GNU gold

2017-11-03 Thread Sami Tolvanen
This change fixes the following error message when linking with GNU gold: ld.gold: error: unrecognized emulation aarch64linux Signed-off-by: Sami Tolvanen --- arch/arm64/Makefile | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index

[PATCH 03/15] kbuild: add support for clang LTO

2017-11-03 Thread Sami Tolvanen
C=clang LD=ld.gold LD_FINAL_VMLINUX=ld Recommended versions are >= 5.0 for clang, and >= 2.27 for binutils. Signed-off-by: Sami Tolvanen --- .gitignore | 2 ++ Makefile | 16 - arch/Kconfig | 32 + scripts/Makef

[PATCH 07/15] arm64: use -mno-implicit-float instead of -mgeneral-regs-only

2017-11-03 Thread Sami Tolvanen
From: Greg Hackmann LLVM bug 30792 causes clang's AArch64 backend to crash compiling arch/arm64/crypto/aes-ce-cipher.c. Replacing -mgeneral-regs-only with -mno-implicit-float is the suggested workaround. Signed-off-by: Greg Hackmann Cc: Matthias Kaehlcke Signed-off-by: Sami Tol

[PATCH 06/15] efi/libstub: disable LTO

2017-11-03 Thread Sami Tolvanen
With CONFIG_CLANG_LTO, we produce LLVM IR instead of object files. Since LTO is not really needed here and the Makefile assumes we produce an object file, disable LTO for libstub. Signed-off-by: Sami Tolvanen --- drivers/firmware/efi/libstub/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH 04/15] kbuild: fix dynamic ftrace with clang LTO

2017-11-03 Thread Sami Tolvanen
gnore, and a __norecordmcount attribute for moving functions to this section. Signed-off-by: Sami Tolvanen --- arch/Kconfig | 2 +- include/asm-generic/vmlinux.lds.h | 2 +- include/linux/compiler-clang.h| 7 +++ include/linux/compiler.h | 4 kernel/

[PATCH 06/15] efi/libstub: disable clang LTO

2017-11-03 Thread Sami Tolvanen
With CONFIG_CLANG_LTO, we produce LLVM IR instead of object files. Since LTO is not really needed here and the Makefile assumes we produce an object file, disable LTO for libstub. Signed-off-by: Sami Tolvanen --- drivers/firmware/efi/libstub/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH 02/15] kbuild: fix LD_DEAD_CODE_DATA_ELIMINATION with GNU gold

2017-11-03 Thread Sami Tolvanen
Don't remove .head.text or .exitcall.exit when linking with --gc-sections, and include .init.text.* in .init.text and .init.rodata.* in .init.rodata. Signed-off-by: Sami Tolvanen --- include/asm-generic/vmlinux.lds.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --

[PATCH 00/15] Add support for clang LTO

2017-11-03 Thread Sami Tolvanen
ld issues with KASLR, for example. Greg Hackmann (1): arm64: use -mno-implicit-float instead of -mgeneral-regs-only Sami Tolvanen (14): kbuild: add ld-name macro and support for GNU gold kbuild: fix LD_DEAD_CODE_DATA_ELIMINATION with GNU gold kbuild: add support for clang LTO kbuild: fix

Re: [PATCH 00/15] Add support for clang LTO

2017-11-03 Thread Sami Tolvanen
On Fri, Nov 03, 2017 at 05:51:56PM +, Mark Rutland wrote: > Which tree are you testing with? I've tested that this builds on top of Linus' current tree. > I had to create an aarch64-linux-gnu-clang wrapper, too. I'm not sure if > there's build system help to avoid needing that? This appears

Re: [PATCH 00/15] Add support for clang LTO

2017-11-03 Thread Sami Tolvanen
On Fri, Nov 03, 2017 at 07:26:35PM +, Mark Rutland wrote: > I guess that in Google you haven't tested on a platform with EL2 > available? Correct. I'll look into this and include a fix in v2. Does this work on a clang build without LTO? Sami

Re: [PATCH 07/15] arm64: use -mno-implicit-float instead of -mgeneral-regs-only

2017-11-03 Thread Sami Tolvanen
On Fri, Nov 03, 2017 at 12:06:15PM -0700, Kees Cook wrote: > Should a clang version test be included, since we know at least 5.0 is > need (with this fix)? There are distros with much earlier versions of > clang, for example... Greg knows better, but I remember him mentioning that upstream clang d

Re: [PATCH 13/15] arm64: add a workaround for GNU gold with ARM64_MODULE_PLTS

2017-11-03 Thread Sami Tolvanen
On Fri, Nov 03, 2017 at 08:09:42PM +, Ard Biesheuvel wrote: > This is not true. Even when RANDOMIZE_MODULE_REGION_FULL is not > enabled, we may need module PLTs. Got it. PLTs themselves are not a problem with gold, only the bug when processing a linker script of this particular format. I'll se

Re: [PATCH 08/15] arm64: don't pass -maarch64linux to GNU gold

2017-11-06 Thread Sami Tolvanen
On Fri, Nov 03, 2017 at 11:41:57PM +0300, Yury Norov wrote: > Also, IIUC, this patch is not related to LTO, because if ld.gold doesn't > recognize -maarch64linux with LTO, it will not recognize it in non-LTO > build. Am I right? That's correct. ld.gold --help says -m is obsolete, but at the same t

Re: Linux 4.9.93

2018-04-09 Thread Sami Tolvanen
On Mon, Apr 9, 2018 at 10:02 AM Greg Hackmann wrote: > Sami, what are the plans for upstreaming this work? CFI is a clang-specific feature that depends on LTO. Based on the earlier LTO discussion, we decided to collect some more evidence that clang's LTO doesn't actually break anything in the ker

[PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Sami Tolvanen
: VCPU:000804fc20001221 This change adds -fno-jump-tables to arm64/hyp to work around the bug. Suggested-by: AKASHI Takahiro Signed-off-by: Sami Tolvanen --- arch/arm64/kvm/hyp/Makefile | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kvm/hyp/Makefile b/arch

[PATCH] modpost: validate symbol names also in find_elf_symbol

2018-10-23 Thread Sami Tolvanen
set_reset_devices() to the variable .init.text:$x.0 This change adds a call to is_valid_name to find_elf_symbol, similarly to how it's already used in find_elf_symbol2. Signed-off-by: Sami Tolvanen --- scripts/mod/modpost.c | 50 ++- 1 file changed, 26 inser

Re: [PATCH -fixes] riscv: Fix ftrace syscall handling which are now prefixed with __riscv_

2023-10-03 Thread Sami Tolvanen
const char *name) > +{ > + /* > +* Since all syscall functions have __riscv_ prefix, we must skip it. > +* However, as we described above, we decided to ignore compat > +* syscalls, so we don't care about __riscv_compat_ prefix here. > +*/ > + return !strcmp(sym + 8, name); > +} Good catch, thanks for fixing this! Reviewed-by: Sami Tolvanen Sami

[PATCH 01/15] tools: Add gendwarfksyms

2024-06-17 Thread Sami Tolvanen
compatibility. Signed-off-by: Sami Tolvanen --- tools/Makefile | 11 +-- tools/gendwarfksyms/Build | 2 + tools/gendwarfksyms/Makefile| 49 +++ tools/gendwarfksyms/gendwarfksyms.c | 128 tools/gendwarfksyms

[PATCH 00/15] Implement MODVERSIONS for Rust

2024-06-17 Thread Sami Tolvanen
l.org/lkml/2023061155.1349375-1-g...@garyguo.net/ [2] https://lore.kernel.org/rust-for-linux/20231118025748.2778044-1-mmau...@google.com/ [3] https://lore.kernel.org/rust-for-linux/cagsqo005hriuzdeppcifdqg9zfdjrwahpble4x7-myfjscn...@mail.gmail.com/ Sami Sami Tolvanen (15): tools: Add gen

[PATCH 02/15] gendwarfksyms: Add symbol list input handling

2024-06-17 Thread Sami Tolvanen
ols, where only one name appears in the debugging information. Signed-off-by: Sami Tolvanen --- tools/gendwarfksyms/Build | 1 + tools/gendwarfksyms/gendwarfksyms.c | 2 + tools/gendwarfksyms/gendwarfksyms.h | 17 tools/gendwarfksyms/symbols.c

[PATCH 03/15] gendwarfksyms: Add CRC calculation

2024-06-17 Thread Sami Tolvanen
emove13assert_failed 0x985f94dd ... Note that type strings are not yet expanded, so the CRCs can only distinguish between functions and variables for now. Signed-off-by: Sami Tolvanen --- tools/gendwarfksyms/Build | 1 + tools/gendwarfksyms/crc32.c | 69

[PATCH 04/15] gendwarfksyms: Expand base_type

2024-06-17 Thread Sami Tolvanen
ug vmlinux.o Output: gendwarfksyms: symbol_read_list: adding { 4b0, "loops_per_jiffy" } gendwarfksyms: process_modules: vmlinux.o gendwarfksyms: process_exported_symbols: loops_per_jiffy (@ 4b0) variable base_type unsigned long byte_size(8); #SYMVER loops_per_jiffy 0xc694aefc Signed-off

[PATCH 05/15] gendwarfksyms: Add a cache

2024-06-17 Thread Sami Tolvanen
Basic types in DWARF repeat frequently and traversing the DIEs using libdw is relatively slow. Add a simple hashtable based cache for the processed DIEs. Signed-off-by: Sami Tolvanen --- tools/gendwarfksyms/Build | 1 + tools/gendwarfksyms/cache.c | 147

[PATCH 06/15] gendwarfksyms: Expand type modifiers and typedefs

2024-06-17 Thread Sami Tolvanen
Add support for expanding DWARF type modifiers, such as pointers, const values etc., and typedefs. These types all have DW_AT_type attribute pointing the underlying type, and thus produce similar output. Signed-off-by: Sami Tolvanen --- tools/gendwarfksyms/gendwarfksyms.h | 3 ++ tools

[PATCH 07/15] gendwarfksyms: Add pretty-printing

2024-06-17 Thread Sami Tolvanen
byte_size(1)}; Signed-off-by: Sami Tolvanen --- tools/gendwarfksyms/cache.c | 13 + tools/gendwarfksyms/gendwarfksyms.c | 3 +++ tools/gendwarfksyms/gendwarfksyms.h | 5 - tools/gendwarfksyms/types.c | 22 ++ 4 files changed, 42 insertions(+), 1

[PATCH 08/15] gendwarfksyms: Expand subroutine_type

2024-06-17 Thread Sami Tolvanen
oid; Signed-off-by: Sami Tolvanen --- tools/gendwarfksyms/gendwarfksyms.h | 1 + tools/gendwarfksyms/types.c | 58 - 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/tools/gendwarfksyms/gendwarfksyms.h b/tools/gendwarfksyms/gendwarfksyms.h in

[PATCH 09/15] gendwarfksyms: Expand array_type

2024-06-17 Thread Sami Tolvanen
Add support for expanding DW_TAG_array_type, and the subrange type indicating array size. Example output with --debug: variable array_type [34] { pointer_type { const_type { base_type char byte_size(1) } } }; Signed-off-by: Sami Tolvanen --- tools

[PATCH 11/15] gendwarfksyms: Limit structure expansion

2024-06-17 Thread Sami Tolvanen
levels inside the pointer. This should be plenty for catching ABI differences and stops us from pulling in half the kernel for structs that contain pointers to large structs like task_struct. Signed-off-by: Sami Tolvanen --- tools/gendwarfksyms/cache.c | 49 tools

[PATCH 12/15] gendwarfksyms: Add inline debugging

2024-06-17 Thread Sami Tolvanen
Understanding the operation and caching of the tool can be somewhat challenging without a debugger. Add inline debugging information with the --inline-debug command, which adds highlighted tags to the --debug output with information about cache states etc. Signed-off-by: Sami Tolvanen --- tools

[PATCH 13/15] modpost: Add support for hashing long symbol names

2024-06-17 Thread Sami Tolvanen
if needed. Suggested-by: Matthew Maurer Signed-off-by: Sami Tolvanen --- scripts/mod/Makefile | 4 +- scripts/mod/modpost.c | 20 ++- scripts/mod/modpost.h | 20 +++ scripts/mod/symhash.c | 327 ++ 4 files changed, 364 insertions(+), 7 deletions(-)

[PATCH 14/15] module: Support hashed symbol names when checking modversions

2024-06-17 Thread Sami Tolvanen
When checking modversions for symbol names longer than MODULE_NAME_LEN, look for the hashed symbol name instead. This is needed for Rust modules, which frequently use symbol names longer than the maximum length supported by struct modversion_info. Suggested-by: Matthew Maurer Signed-off-by: Sami

[PATCH 15/15] kbuild: Use gendwarfksyms to generate Rust symbol versions

2024-06-17 Thread Sami Tolvanen
Use gendwarfksyms to generate symbol versions for exported Rust symbols, and allow CONFIG_MODVERSIONS to be enabled with CONFIG_RUST, assuming the debugging information needed by gendwarfksyms is also available. Signed-off-by: Sami Tolvanen --- Makefile | 6 ++ init/Kconfig | 2

[PATCH 10/15] gendwarfksyms: Expand structure types

2024-06-17 Thread Sami Tolvanen
e_type void; Signed-off-by: Sami Tolvanen --- tools/gendwarfksyms/gendwarfksyms.h | 5 ++ tools/gendwarfksyms/types.c | 127 +++- 2 files changed, 130 insertions(+), 2 deletions(-) diff --git a/tools/gendwarfksyms/gendwarfksyms.h b/tools/gendwarfksyms/gend

Re: [PATCH 00/15] Implement MODVERSIONS for Rust

2024-06-18 Thread Sami Tolvanen
Hi Masahiro, On Wed, Jun 19, 2024 at 01:28:21AM +0900, Masahiro Yamada wrote: > I am surprised at someone who attempts to add another variant of genksyms. The options are rather limited if we want Rust modules that are compatible with modversions. We either come up with a way to version Rust symb

Re: [PATCH 13/15] modpost: Add support for hashing long symbol names

2024-06-18 Thread Sami Tolvanen
On Wed, Jun 19, 2024 at 01:47:13AM +0900, Masahiro Yamada wrote: > On Tue, Jun 18, 2024 at 2:58 AM Sami Tolvanen wrote: > > > > +#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") > > > > > I know this is a copy-

Re: [PATCH 00/15] Implement MODVERSIONS for Rust

2024-06-18 Thread Sami Tolvanen
On Wed, Jun 19, 2024 at 04:03:45AM +0900, Masahiro Yamada wrote: > On Wed, Jun 19, 2024 at 2:18 AM Greg Kroah-Hartman > wrote: > > > > On Wed, Jun 19, 2024 at 01:50:36AM +0900, Masahiro Yamada wrote: > > > On Wed, Jun 19, 2024 at 1:44 AM Greg Kroah-Hartman > > > wrote: > > > > > > > > That's cool

Re: [PATCH 00/15] Implement MODVERSIONS for Rust

2024-06-18 Thread Sami Tolvanen
Hi Luis, On Tue, Jun 18, 2024 at 12:42:51PM -0700, Luis Chamberlain wrote: > On Mon, Jun 17, 2024 at 05:58:19PM +0000, Sami Tolvanen wrote: > > The first 12 patches of this series add a small tool for computing > > symbol versions from DWARF, called gendwarfksyms. When passe

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

2024-06-28 Thread Sami Tolvanen
Hi Luis, On Fri, Jun 28, 2024 at 10:36 AM Luis Chamberlain wrote: > > On Fri, Jun 28, 2024 at 02:23:49PM +0200, Miroslav Benes wrote: > > On Fri, 7 Jun 2024, Song Liu wrote: > > > > > Hi Miroslav, > > > > > > Thanks for reviewing the patch! > > > > > > I think it is possible. Currently, kallsyms_

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

2024-07-08 Thread Sami Tolvanen
On Mon, Jul 8, 2024 at 2:33 PM Luis Chamberlain wrote: > > Looking at this again its not to me why Masahiro Yamada's suggestion on > that old patch series to just increase the length and put long symbols > names into its own section [0] could not be embraced with a new kconfig > option, so new ker

Re: [PATCH 00/15] Implement MODVERSIONS for Rust

2024-07-15 Thread Sami Tolvanen
Hi Petr, On Wed, Jul 10, 2024 at 7:30 AM Petr Pavlu wrote: > > On 6/17/24 19:58, Sami Tolvanen wrote: > > Hi folks, > > > > This series implements CONFIG_MODVERSIONS for Rust, an important > > feature for distributions like Android that want to ship Rust >

Re: [PATCH 00/15] Implement MODVERSIONS for Rust

2024-07-18 Thread Sami Tolvanen
On Tue, Jul 16, 2024 at 12:12 AM Greg Kroah-Hartman wrote: > > > After replacement: > > > > union { > > u64 new_member; > > struct { > > u8 __kabi_reserved_1[8]; > > }; > > } > > Note, such a thing would only be for the distros that w

Re: [PATCH] rust: add `module_params` macro

2024-07-24 Thread Sami Tolvanen
Hi Luis, On Thu, Jul 18, 2024 at 5:15 PM Luis Chamberlain wrote: > > On Tue, Jul 09, 2024 at 12:08:16PM +0200, Miguel Ojeda wrote: > > On Mon, Jul 8, 2024 at 11:42 PM Luis Chamberlain wrote: > > > > > > The rationale here is that a rust binding means commitment then also > > > from fresh blood t

Re: [PATCH 00/15] Implement MODVERSIONS for Rust

2024-07-26 Thread Sami Tolvanen
Hi Petr, On Mon, Jul 22, 2024 at 8:20 AM Petr Pavlu wrote: > > From my perspective, I'm okay if gendwarfksyms doesn't provide > functionality to compare a new object file with its reference symtypes > file. > > As mentioned, genksyms has this functionality but I actually think the > way it works

Re: [PATCH 00/15] Implement MODVERSIONS for Rust

2024-08-01 Thread Sami Tolvanen
Hi Petr, On Thu, Aug 1, 2024 at 4:22 AM Petr Pavlu wrote: > > STG is an interesting tool. I've played with it a bit last year. To be > frank, I was surprised to see a new tool being proposed by Google to > generate modversion CRCs from DWARF instead of potentially extending > your STG project for

Re: [PATCH v2 3/3] tracing/kprobes: Use APIs that matches symbols without .XXX suffix

2024-08-07 Thread Sami Tolvanen
Hi, On Wed, Aug 7, 2024 at 3:08 AM Masami Hiramatsu wrote: > > On Wed, 7 Aug 2024 00:19:20 + > Song Liu wrote: > > > Do you mean we do not want patch 3/3, but would like to keep 1/3 and part > > of 2/3 (remove the _without_suffix APIs)? If this is the case, we are > > undoing the change by S

Re: [PATCH v3 0/2] Fix kallsyms with CONFIG_LTO_CLANG

2024-08-13 Thread Sami Tolvanen
anges in the first place, this series looks reasonable to me. Thanks for cleaning this up! Reviewed-by: Sami Tolvanen Sami

[PATCH v2 00/19] Implement DWARF modversions

2024-08-15 Thread Sami Tolvanen
data structure fields and declaration-onl structures. Also added examples for using these features. - Added a GENDWARFKSYMS option and hooked up kbuild support for both C and assembly code. Note that with gendwarfksyms, we have to actually build a temporary .o file for calculating assem

[PATCH v2 01/19] tools: Add gendwarfksyms

2024-08-15 Thread Sami Tolvanen
Add a basic DWARF parser, which uses libdw to traverse the debugging information in an object file and looks for functions and variables. In follow-up patches, this will be expanded to produce symbol versions for CONFIG_MODVERSIONS from DWARF. Signed-off-by: Sami Tolvanen --- kernel/module

[PATCH v2 02/19] gendwarfksyms: Add symbol list handling

2024-08-15 Thread Sami Tolvanen
Add support for passing a list of exported symbols to gendwarfksyms via stdin and filter out non-exported symbols from the output. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/dwarf.c | 53 ++- scripts/gendwarfksyms

[PATCH v2 03/19] gendwarfksyms: Add address matching

2024-08-15 Thread Sami Tolvanen
d-off-by: Sami Tolvanen --- scripts/gendwarfksyms/gendwarfksyms.c | 2 + scripts/gendwarfksyms/gendwarfksyms.h | 7 ++ scripts/gendwarfksyms/symbols.c | 161 +- 3 files changed, 165 insertions(+), 5 deletions(-) diff --git a/scripts/gendwarfksyms/gendwarfksyms

[PATCH v2 04/19] gendwarfksyms: Add support for type pointers

2024-08-15 Thread Sami Tolvanen
xternal_symbol); Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/dwarf.c | 26 +- scripts/gendwarfksyms/gendwarfksyms.h | 6 ++ scripts/gendwarfksyms/symbols.c | 16 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/scripts

[PATCH v2 05/19] gendwarfksyms: Expand base_type

2024-08-15 Thread Sami Tolvanen
base_type unsigned long byte_size(8) encoding(7); ... Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/dwarf.c | 121 +- 1 file changed, 120 insertions(+), 1 deletion(-) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c index

[PATCH v2 07/19] gendwarfksyms: Expand type modifiers and typedefs

2024-08-15 Thread Sami Tolvanen
-off-by: Sami Tolvanen --- scripts/gendwarfksyms/die.c | 13 + scripts/gendwarfksyms/dwarf.c | 76 +-- scripts/gendwarfksyms/gendwarfksyms.h | 7 ++- 3 files changed, 92 insertions(+), 4 deletions(-) diff --git a/scripts/gendwarfksyms/die.c b/scripts

[PATCH v2 06/19] gendwarfksyms: Add a cache for processed DIEs

2024-08-15 Thread Sami Tolvanen
Basic types in DWARF repeat frequently and traversing the DIEs using libdw is relatively slow. Add a simple hashtable based cache for the processed DIEs. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/die.c | 170

[PATCH v2 08/19] gendwarfksyms: Expand subroutine_type

2024-08-15 Thread Sami Tolvanen
ype void; Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/dwarf.c | 57 ++- scripts/gendwarfksyms/gendwarfksyms.h | 1 + 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c in

[PATCH v2 09/19] gendwarfksyms: Expand array_type

2024-08-15 Thread Sami Tolvanen
(8) }; Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/dwarf.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c index c81652426be8..4ec69fce95f3 100644 --- a/scripts/gendwarfksyms/dwarf.c

[PATCH v2 10/19] gendwarfksyms: Expand structure types

2024-08-15 Thread Sami Tolvanen
&str { member pointer_type { base_type u8 byte_size(1) encoding(7) } data_member_location(0), member base_type usize byte_size(8) encoding(7) data_member_location(8), } byte_size(16) alignment(8) }, ) -> base_type void; Signed-off-by: Sami Tolvanen -

[PATCH v2 11/19] gendwarfksyms: Limit structure expansion

2024-08-15 Thread Sami Tolvanen
levels. This should be plenty for detecting ABI differences, but it stops us from pulling in half the kernel for types that contain pointers to large kernel data structures, like task_struct, for example. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/Makefile| 1 + scripts

[PATCH v2 12/19] gendwarfksyms: Add die_map debugging

2024-08-15 Thread Sami Tolvanen
. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/dwarf.c | 19 +-- scripts/gendwarfksyms/gendwarfksyms.c | 9 + scripts/gendwarfksyms/gendwarfksyms.h | 14 ++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/scripts/gendwarfksyms

[PATCH v2 13/19] gendwarfksyms: Add symtypes output

2024-08-15 Thread Sami Tolvanen
references are wrapped in single quotes. E.g.: s#'core::result::Result' 2. The actual type definition is the simple parsed DWARF format we output with --dump-dies, not the preprocessed C-style format genksyms produces. Signed-off-by: Sami Tolvanen --- scripts/gen

[PATCH v2 14/19] gendwarfksyms: Add symbol versioning

2024-08-15 Thread Sami Tolvanen
Add a basic CRC32 implementation adapted from genksyms, and produce matching output from symtypes strings in type_map. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/crc32.c | 69 ++ scripts/gendwarfksyms/crc32.h

[PATCH v2 15/19] gendwarfksyms: Add support for declaration-only data structures

2024-08-15 Thread Sami Tolvanen
g --stable, the definition is ignored and we again have the original symbol version: subprogram( formal_parameter pointer_type { structure_type struct0 { } } byte_size(8), ) -> base_type int byte_size(4) encoding(5); #SYMVER func 0x7e8284f9 Signed-off-b

[PATCH v2 16/19] gendwarfksyms: Add support for reserved structure fields

2024-08-15 Thread Sami Tolvanen
g int byte_size(8) encoding(5) data_member_location(0), member base_type long int byte_size(8) encoding(5) data_member_location(8), } byte_size(16); #SYMVER exported 0x67997f89 Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/dwarf.c | 148 +- sc

[PATCH v2 17/19] export: Add __gendwarfksyms_ptr_ references to exported symbols

2024-08-15 Thread Sami Tolvanen
igned-off-by: Sami Tolvanen --- include/linux/export.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/include/linux/export.h b/include/linux/export.h index 0bbd02fd351d..cf71d3202e5b 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -52,9 +52,24 @@

[PATCH v2 18/19] x86/asm-prototypes: Include

2024-08-15 Thread Sami Tolvanen
refers to struct pt_regs, make sure it's visible. Signed-off-by: Sami Tolvanen --- arch/x86/include/asm/asm-prototypes.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h index 25466c4d2134..c82e68c8b7c2 1

[PATCH v2 19/19] kbuild: Add gendwarfksyms as an alternative to genksyms

2024-08-15 Thread Sami Tolvanen
When MODVERSIONS is enabled, allow selecting gendwarfksyms as the implementation, but default to genksyms. Signed-off-by: Sami Tolvanen --- kernel/module/Kconfig | 25 - scripts/Makefile | 2 +- scripts/Makefile.build | 34 -- 3

Re: [PATCH v3 14/16] modules: Support extended MODVERSIONS info

2024-08-15 Thread Sami Tolvanen
Hi Matt, On Tue, Aug 6, 2024 at 9:25 PM Matthew Maurer wrote: > [...] > +void modversion_ext_start(const struct load_info *info, > + struct modversion_info_ext *start) > +{ > + unsigned int crc_idx = info->index.vers_ext_crc; > + unsigned int name_idx = info->i

Re: [PATCH v2 00/19] Implement DWARF modversions

2024-08-15 Thread Sami Tolvanen
Hi Sedat, On Thu, Aug 15, 2024 at 8:14 PM Sedat Dilek wrote: > > so this work is on top of Linux v6.11-rc3 Correct. git format-patch also adds the base commit to the end of the cover letter. > can you tag it as gendwarfksyms-v2? Sure. Here you go: https://github.com/samitolvanen/linux/commits

Re: [PATCH v2 16/19] gendwarfksyms: Add support for reserved structure fields

2024-08-16 Thread Sami Tolvanen
Hi Greg, On Fri, Aug 16, 2024 at 12:20 AM Greg Kroah-Hartman wrote: > > On Thu, Aug 15, 2024 at 05:39:20PM +, Sami Tolvanen wrote: > > Distributions that want to maintain a stable kABI need the ability to > > add reserved fields to kernel data structures that they anti

Re: [PATCH v2 16/19] gendwarfksyms: Add support for reserved structure fields

2024-08-19 Thread Sami Tolvanen
Hi Benno, On Sat, Aug 17, 2024 at 01:19:55PM +, Benno Lossin wrote: > > For this use-case (the one in the patch), I don't really know if we want > to copy the approach from C. Do we even support exporting kABI from > Rust? If yes, then we I would recommend we tag it in the source code > inste

Re: [BUG] tracing: dynamic ftrace selftest detected failures

2024-08-20 Thread Sami Tolvanen
On Tue, Aug 20, 2024 at 3:48 AM Mark Rutland wrote: > > On Tue, Aug 20, 2024 at 10:03:30AM +0900, Masami Hiramatsu wrote: > > On Mon, 19 Aug 2024 12:02:44 -0400 > > Steven Rostedt wrote: > > > > > On Tue, 20 Aug 2024 00:56:49 +0900 > > > Masami Hiramatsu (Google) wrote: > > > > > > > > > > > > >

Re: [PATCH v2 16/19] gendwarfksyms: Add support for reserved structure fields

2024-08-20 Thread Sami Tolvanen
On Mon, Aug 19, 2024 at 10:17 PM Benno Lossin wrote: > > On 19.08.24 21:38, Sami Tolvanen wrote: > > > > This definitely looks cleaner than unions in Rust, but how would this > > scheme be visible in DWARF? You might also need to expand the annotation > > to allo

Re: [BUG] tracing: dynamic ftrace selftest detected failures

2024-08-21 Thread Sami Tolvanen
On Tue, Aug 20, 2024 at 5:21 PM Masami Hiramatsu wrote: > > On Wed, 21 Aug 2024 08:43:51 +0900 > Masami Hiramatsu (Google) wrote: > > > On Tue, 20 Aug 2024 18:11:09 -0400 > > Steven Rostedt wrote: > > > > > On Wed, 21 Aug 2024 07:05:39 +0900 > > > Masami Hiramatsu (Google) wrote: > > > > > > >

Re: [PATCH v2 16/19] gendwarfksyms: Add support for reserved structure fields

2024-08-21 Thread Sami Tolvanen
On Wed, Aug 21, 2024 at 4:31 AM Benno Lossin wrote: > > On 20.08.24 22:03, Matthew Maurer wrote: > >>> The way `KAbiReserved` is implemented is via a `union` (maybe a bit > >>> ironic, considering what I said in my other replies, but in this case, > >>> we would provide a safe abstraction over thi

Re: [PATCH] MAINTAINERS: scale modules with more reviewers

2024-08-21 Thread Sami Tolvanen
t and C code for modules so we can ensure we get proper > reviews for both parts of the code and so that we can scale. > > Add those who have stepped up to help. > > Signed-off-by: Luis Chamberlain Acked-by: Sami Tolvanen Sami

Re: [PATCH v2 00/19] Implement DWARF modversions

2024-08-22 Thread Sami Tolvanen
Hi Jon, On Thu, Aug 22, 2024 at 9:43 AM Jonathan Corbet wrote: > > Sami Tolvanen writes: > > > The first 16 patches of this series add a small tool for computing > > symbol versions from DWARF, called gendwarfksyms. When passed a > > list of exported symbols a

Re: [PATCH v8 2/4] kbuild: generate offset range data for builtin modules

2024-08-23 Thread Sami Tolvanen
Hi Kris, On Thu, Aug 22, 2024 at 02:19:39PM -0400, Kris Van Hees wrote: > diff --git a/scripts/generate_builtin_ranges.awk > b/scripts/generate_builtin_ranges.awk > new file mode 100755 > index ..68df05fd3036 > --- /dev/null > +++ b/scripts/generate_builtin_ranges.awk > @@ -0,0 +1,505

Re: [PATCH v8 2/4] kbuild: generate offset range data for builtin modules

2024-08-23 Thread Sami Tolvanen
On Fri, Aug 23, 2024 at 10:06 AM Kris Van Hees wrote: > > On Fri, Aug 23, 2024 at 04:53:29PM +, Sami Tolvanen wrote: > > Hi Kris, > > > > On Thu, Aug 22, 2024 at 02:19:39PM -0400, Kris Van Hees wrote: > > > diff --git a/scripts/generate_bu

Re: [PATCH v2 16/19] gendwarfksyms: Add support for reserved structure fields

2024-08-23 Thread Sami Tolvanen
On Thu, Aug 22, 2024 at 11:53 PM Greg Kroah-Hartman wrote: > > On Thu, Aug 22, 2024 at 12:00:15PM +, Benno Lossin wrote: > > > Here's one example in the android tree where 4 64bit fields are reserved > > > for future abi changes: > > > > > > https://android.googlesource.com/kernel/common/

Re: [PATCH v2 01/19] tools: Add gendwarfksyms

2024-08-26 Thread Sami Tolvanen
Hi Petr, On Mon, Aug 26, 2024 at 10:42 AM Petr Pavlu wrote: > > On 8/15/24 19:39, Sami Tolvanen wrote: > > +static int parse_options(int argc, const char **argv) > > +{ > > + for (int i = 1; i < argc; i++) { > > + bool flag = false; > >

Re: [PATCH v2 01/19] tools: Add gendwarfksyms

2024-08-27 Thread Sami Tolvanen
Hi Greg, On Fri, Aug 16, 2024 at 12:14 AM Greg Kroah-Hartman wrote: > > On Thu, Aug 15, 2024 at 05:39:05PM +, Sami Tolvanen wrote: > > --- /dev/null > > +++ b/scripts/gendwarfksyms/dwarf.c > > @@ -0,0 +1,87 @@ > > +// SPDX-License-Identifier: GPL-2.0-or-later &g

Re: [PATCH v2 02/19] gendwarfksyms: Add symbol list handling

2024-08-27 Thread Sami Tolvanen
Hi Petr, On Tue, Aug 27, 2024 at 2:16 AM Petr Pavlu wrote: > > On 8/15/24 19:39, Sami Tolvanen wrote: > > +static bool is_export_symbol(struct state *state, Dwarf_Die *die) > > +{ > > + Dwarf_Die *source = die; > > + Dwarf_Die origin; > > + > &

Re: [PATCH v2 03/19] gendwarfksyms: Add address matching

2024-08-27 Thread Sami Tolvanen
Hi Petr, On Tue, Aug 27, 2024 at 12:40 PM Petr Pavlu wrote: > > On 8/15/24 19:39, Sami Tolvanen wrote: > > +static inline u32 symbol_addr_hash(const struct symbol_addr *addr) > > +{ > > + return jhash(addr, sizeof(struct symbol_addr), 0); > > I would be c

Re: [PATCH v2 01/19] tools: Add gendwarfksyms

2024-08-28 Thread Sami Tolvanen
On Wed, Aug 28, 2024 at 02:31:05PM +0200, Petr Pavlu wrote: > On 8/26/24 20:47, Sami Tolvanen wrote: > > How do you propose using the function? This loop goes through multiple > > input files, should we need them, and we iterate through all the CUs > > in process_modules. &

Re: [PATCH v2 01/19] tools: Add gendwarfksyms

2024-08-28 Thread Sami Tolvanen
Hi Masahiro, On Thu, Aug 29, 2024 at 02:45:03AM +0900, Masahiro Yamada wrote: > On Fri, Aug 16, 2024 at 2:39 AM Sami Tolvanen wrote: > > +static int usage(void) > > +{ > > + error("usage: gendwarfksyms [options] elf-object-file ..."); > > > >

Re: [PATCH v2 02/19] gendwarfksyms: Add symbol list handling

2024-08-28 Thread Sami Tolvanen
On Thu, Aug 29, 2024 at 03:16:21AM +0900, Masahiro Yamada wrote: > On Fri, Aug 16, 2024 at 2:39 AM Sami Tolvanen wrote: > > @@ -105,6 +105,8 @@ int main(int argc, const char **argv) > > if (parse_options(argc, argv) < 0) > > return usage(

Re: [PATCH v2 03/19] gendwarfksyms: Add address matching

2024-08-28 Thread Sami Tolvanen
On Thu, Aug 29, 2024 at 03:22:25AM +0900, Masahiro Yamada wrote: > On Fri, Aug 16, 2024 at 2:39 AM Sami Tolvanen wrote: > > int symbol_read_exports(FILE *file) > > @@ -57,13 +93,14 @@ int symbol_read_exports(FILE *file) > >

Re: [PATCH v2 04/19] gendwarfksyms: Add support for type pointers

2024-08-28 Thread Sami Tolvanen
On Wed, Aug 28, 2024 at 04:15:03PM +0900, Masahiro Yamada wrote: > On Wed, Aug 28, 2024 at 3:50 PM Masahiro Yamada wrote: > > > > On Fri, Aug 16, 2024 at 2:39 AM Sami Tolvanen > > wrote: > > > > > > The compiler may choose not to emit type information in

  1   2   3   4   5   6   7   8   9   10   >