Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.

2025-01-30 Thread Petr Pavlu
On 1/29/25 09:52, Sebastian Andrzej Siewior wrote: > On 2025-01-27 13:22:17 [+0100], Petr Pavlu wrote: >> On 1/24/25 18:49, Sebastian Andrzej Siewior wrote: >>> On 2025-01-13 12:09:27 [+0100], Petr Pavlu wrote: >>>> Thanks for this cleanup. I've queued the fi

Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.

2025-01-27 Thread Petr Pavlu
On 1/24/25 18:49, Sebastian Andrzej Siewior wrote: > On 2025-01-13 12:09:27 [+0100], Petr Pavlu wrote: >> Thanks for this cleanup. I've queued the fix in patch #1 on >> modules-fixes. For the rest, I plan to give folks more time to look at >> the changes as this affects

[GIT PULL] Modules changes for v6.14-rc1

2025-01-26 Thread Petr Pavlu
The following changes since commit ffd294d346d185b70e28b1a28abe367bbfe53c04: Linux 6.13 (2025-01-19 15:51:45 -0800) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux.git/ tags/modules-6.14-rc1 for you to fetch changes up to f3b93547b91ad849

Re: [PATCH v4 4/4] rust: add parameter support to the `module!` macro

2025-01-22 Thread Petr Pavlu
On 1/9/25 11:54, Andreas Hindborg wrote: > This patch includes changes required for Rust kernel modules to utilize > module parameters. This code implements read only support for integer > types without `sysfs` support. > > Signed-off-by: Andreas Hindborg > --- > rust/kernel/lib.rs |

Re: [PATCH RFC 2/2] module: Introduce hash-based integrity checking

2025-01-13 Thread Petr Pavlu
On 1/10/25 20:16, Luis Chamberlain wrote: > On Thu, Jan 09, 2025 at 11:52:27AM +0100, Arnout Engelen wrote: >> On Fri, 3 Jan 2025 17:37:52 -0800, Luis Chamberlain wrote: >>> What distro which is using module signatures would switch >>> to this as an alternative instead? >> >> In NixOS, we disable M

Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.

2025-01-13 Thread Petr Pavlu
On 1/8/25 10:04, Sebastian Andrzej Siewior wrote: > This is an updated version of the initial post after PeterZ made me > aware that there are users outside of the module directory. > The goal is replace the mix auf rcu_read_lock(), rcu_read_lock_sched() > and preempt_disable() with just rcu_read_l

Re: [PATCH v2] module: sign with sha512 instead of sha1 by default

2025-01-06 Thread Petr Pavlu
On 1/4/25 10:43, Thorsten Leemhuis wrote: > On 20.10.24 00:57, Luis Chamberlain wrote: >> On Wed, Oct 16, 2024 at 04:18:41PM +0200, Thorsten Leemhuis wrote: >>> Switch away from using sha1 for module signing by default and use the >>> more modern sha512 instead, which is what among others Arch, Fed

Re: [PATCH v1 0/3] module: Don't fail module loading when setting ro_after_init section RO failed

2025-01-06 Thread Petr Pavlu
On 1/4/25 08:39, Christophe Leroy wrote: > Le 03/01/2025 à 17:13, Petr Pavlu a écrit : >> On 12/5/24 20:46, Christophe Leroy wrote: >>> This series reworks module loading to avoid leaving the module in a >>> stale state when protecting ro_after_init section fails. &

Re: [PATCH 0/3] module: Make .static_call_sites read-only after init

2025-01-03 Thread Petr Pavlu
On 1/3/25 15:06, Christophe Leroy wrote: > Le 23/12/2024 à 10:37, Petr Pavlu a écrit : >> Section .static_call_sites holds data structures that need to be sorted and >> processed only at module load time. The section is never modified afterwards. >> Make it therefore r

Re: [PATCH v1 0/3] module: Don't fail module loading when setting ro_after_init section RO failed

2025-01-03 Thread Petr Pavlu
On 12/5/24 20:46, Christophe Leroy wrote: > This series reworks module loading to avoid leaving the module in a > stale state when protecting ro_after_init section fails. > > Once module init has succeded it is too late to cancel loading. > If setting ro_after_init data section to read-only fails,

Re: [RFC PATCH 2/3] module: Don't fail module loading when setting ro_after_init section RO failed

2025-01-03 Thread Petr Pavlu
On 12/10/24 11:49, Daniel Gomez wrote: > On 12/4/2024 4:14 PM, Petr Pavlu wrote: >> On 11/28/24 21:23, Daniel Gomez wrote: >>> On 11/12/2024 3:35 PM, Petr Pavlu wrote: >>>> On 11/12/24 10:43, Daniel Gomez wrote: >>>>> On Mon Nov 11

Re: [GIT PULL] Modules fixes for v6.14-rc5

2025-01-01 Thread Petr Pavlu
On 12/23/24 21:14, Linus Torvalds wrote: > On Mon, 23 Dec 2024 at 02:55, Petr Pavlu wrote: >> >> Luis asked me to look after the modules maintenance for a while, with the >> plan to rotate it with other recently added modules maintainers/reviewers. >> This is my first

Re: [PATCH v2 28/28] cfi: Use RCU while invoking __module_address().

2024-12-30 Thread Petr Pavlu
On 12/20/24 18:41, Sebastian Andrzej Siewior wrote: > __module_address() can be invoked within a RCU section, there is no > requirement to have preemption disabled. > > I'm not sure if using rcu_read_lock() will introduce the regression that > has been fixed in commit 14c4c8e41511a ("cfi: Use > rc

Re: [PATCH 1/2] module: get symbol crc back to unsigned

2024-12-30 Thread Petr Pavlu
n.c: > > crcval = *crc; > > Signed-off-by: Masahiro Yamada Reviewed-by: Petr Pavlu I understand the plan is for this to go through the kbuild tree with the rest of the extended modversions + Rust support. -- Thanks, Petr

[GIT PULL] Modules fixes for v6.14-rc5

2024-12-23 Thread Petr Pavlu
The following changes since commit 4bbf9020becbfd8fc2c3da790855b7042fad455b: Linux 6.13-rc4 (2024-12-22 13:22:21 -0800) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux.git/ tags/modules-6.13-rc5 for you to fetch changes up to 0b7a66a2c864

[PATCH 0/3] module: Make .static_call_sites read-only after init

2024-12-23 Thread Petr Pavlu
Section .static_call_sites holds data structures that need to be sorted and processed only at module load time. The section is never modified afterwards. Make it therefore read-only after module initialization to avoid any (non-)accidental modifications. Petr Pavlu (3): module: Constify

[PATCH 2/3] module: Add a separate function to mark sections as read-only after init

2024-12-23 Thread Petr Pavlu
Move the logic to mark special sections as read-only after module initialization into a separate function, along other related code in strict_rwx.c. Use a table with names of such sections to make it easier to add more. Signed-off-by: Petr Pavlu --- kernel/module/internal.h | 2 ++ kernel

[PATCH 3/3] module: Make .static_call_sites read-only after init

2024-12-23 Thread Petr Pavlu
modified afterwards. Make it therefore read-only after module initialization to avoid any (non-)accidental modifications. Signed-off-by: Petr Pavlu --- kernel/module/strict_rwx.c | 9 + 1 file changed, 9 insertions(+) diff --git a/kernel/module/strict_rwx.c b/kernel/module/strict_rwx.c

[PATCH 1/3] module: Constify parameters of module_enforce_rwx_sections()

2024-12-23 Thread Petr Pavlu
Minor cleanup, this is a non-functional change. Signed-off-by: Petr Pavlu --- kernel/module/internal.h | 5 +++-- kernel/module/strict_rwx.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/module/internal.h b/kernel/module/internal.h index daef2be83902

Re: [PATCH 0/3] module: Constify 'struct module_attribute'

2024-12-17 Thread Petr Pavlu
b517bcbfe7ec0d0186f9b0b8 > change-id: 20241204-sysfs-const-attr-module-927afe76eda4 Reviewed-by: Petr Pavlu I'm going to wait for a few days if others want to comment and then plan to queue this on the modules tree for the 6.14 merge window. -- Thanks, Petr

Re: [PATCH -v2 0/7] module: Strict per-modname namespaces

2024-12-16 Thread Petr Pavlu
On 12/2/24 15:59, Peter Zijlstra wrote: > Hi! > > Implement a means for exports to be available only to an explicit list of > named > modules. By explicitly limiting the usage of certain exports, the abuse > potential/risk is greatly reduced. > > The first 'patch' is an awk scripts that cleans u

Re: [PATCH] preempt: Move PREEMPT_RT before PREEMPT in vermagic.

2024-12-10 Thread Petr Pavlu
e string accurate instead of > removing it. > > Move the PREEMPT_RT check before the PREEMPT so that it takes precedence > if both symbols are enabled. > > Fixes: 35772d627b55c ("sched: Enable PREEMPT_DYNAMIC for PREEMPT_RT") > Signed-off-by: Sebastian Andrzej Siewior

Re: [RFC PATCH 2/3] module: Don't fail module loading when setting ro_after_init section RO failed

2024-12-04 Thread Petr Pavlu
On 11/28/24 21:23, Daniel Gomez wrote: > On 11/12/2024 3:35 PM, Petr Pavlu wrote: >> On 11/12/24 10:43, Daniel Gomez wrote: >>> On Mon Nov 11, 2024 at 7:53 PM CET, Christophe Leroy wrote: >>>> >>>> >>>> Le 09/11/2024 à 23:17, Daniel Go

Re: [PATCH v6 11/18] gendwarfksyms: Add symtypes output

2024-12-03 Thread Petr Pavlu
he preprocessed C-style format > genksyms produces. > > Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v6 12/18] gendwarfksyms: Add symbol versioning

2024-12-03 Thread Petr Pavlu
On 11/21/24 21:42, Sami Tolvanen wrote: > Calculate symbol versions from the fully expanded type strings in > type_map, and output the versions in a genksyms-compatible format. > > Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v6 02/18] gendwarfksyms: Add address matching

2024-12-03 Thread Petr Pavlu
&sym_mem, &xndx); > + > + if (!sym || > + GELF_ST_BIND(sym->st_info) == STB_LOCAL) > + continue; Doesn't NULL returned by gelf_getsymshndx() indicate an error? If yes then I think it should be reported instead of silently skipping the symbol. With this addressed, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v6 09/18] gendwarfksyms: Limit structure expansion

2024-12-02 Thread Petr Pavlu
e that genksyms has. I was also recently thinking that it would be great if genksyms could skip definitions that are in internal header files, for example, kernel/events/internal.h. Perhaps something that could be added in the future.. I've noted one nit below, but the patch looks sensible to me

Re: [PATCH] kmod: verify module name before invoking modprobe

2024-11-27 Thread Petr Pavlu
On 11/20/24 03:17, Song Chen wrote: > Hi Petr, > > 在 2024/11/18 20:54, Petr Pavlu 写道: >> On 11/13/24 03:15, Song Chen wrote: >>> 在 2024/11/12 20:56, Petr Pavlu 写道: >>>> On 11/10/24 12:42, Song Chen wrote: >>>>> Sometimes when kernel calls requ

Re: [PATCH] kmod: verify module name before invoking modprobe

2024-11-18 Thread Petr Pavlu
On 11/13/24 03:15, Song Chen wrote: > 在 2024/11/12 20:56, Petr Pavlu 写道: >> On 11/10/24 12:42, Song Chen wrote: >>> Sometimes when kernel calls request_module to load a module >>> into kernel space, it doesn't pass the module name appropriately, >>> and

Re: [RFC PATCH 2/3] module: Don't fail module loading when setting ro_after_init section RO failed

2024-11-12 Thread Petr Pavlu
On 11/12/24 10:43, Daniel Gomez wrote: > On Mon Nov 11, 2024 at 7:53 PM CET, Christophe Leroy wrote: >> >> >> Le 09/11/2024 à 23:17, Daniel Gomez a écrit : >>> On Sat Nov 9, 2024 at 11:35 AM CET, Christophe Leroy wrote: Once module init has succeded it is too late to cancel loading. If se

Re: [PATCH] kmod: verify module name before invoking modprobe

2024-11-12 Thread Petr Pavlu
On 11/10/24 12:42, Song Chen wrote: > Sometimes when kernel calls request_module to load a module > into kernel space, it doesn't pass the module name appropriately, > and request_module doesn't verify it as well. > > As a result, modprobe is invoked anyway and spend a lot of time > searching a no

Re: [RFC PATCH 2/3] module: Don't fail module loading when setting ro_after_init section RO failed

2024-11-11 Thread Petr Pavlu
On 11/9/24 11:35, Christophe Leroy wrote: > Once module init has succeded it is too late to cancel loading. > If setting ro_after_init data section to read-only fails, all we > can do is to inform the user through a warning. Makes sense to me. If I'm looking correctly, set_memory_ro() could mostly

Re: [PATCH v4 18/19] kbuild: Add gendwarfksyms as an alternative to genksyms

2024-10-23 Thread Petr Pavlu
On 10/8/24 20:38, Sami Tolvanen wrote: > When MODVERSIONS is enabled, allow selecting gendwarfksyms as the > implementation, but default to genksyms. > > Signed-off-by: Sami Tolvanen > Acked-by: Neal Gompa > --- > kernel/module/Kconfig | 25 - > scripts/Makefile |

Re: [PATCH v4 16/19] gendwarfksyms: Add support for symbol type pointers

2024-10-23 Thread Petr Pavlu
iscard.gendwarfksyms") = &sym; > > extern int external_symbol(void); > GENDWARFKSYMS_PTR(external_symbol); > > Signed-off-by: Sami Tolvanen > Acked-by: Neal Gompa Looks ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Petr

Re: [PATCH v4 15/19] gendwarfksyms: Add support for reserved and ignored fields

2024-10-23 Thread Petr Pavlu
mber_location(24) > + * STABLE-NEXT: } byte_size(32) > + * > + * VERSION-DAG: #SYMVER ex2b 0x[[#%.08x,EX2]] > + */ > + > +struct { > + int a; > + KABI_IGNORE(0, unsigned int n); > + unsigned long b; > + int c; > + KABI_IGNORE(1, unsigned int m); > + unsigned long d; > +} ex2c; > + > +_Static_assert(sizeof(ex2a) == sizeof(ex2c), "ex2a size doesn't match ex2c"); > + > +/* > + * STABLE: variable structure_type { > + * STABLE-NEXT: member base_type int byte_size(4) encoding(5) a > data_member_location(0) , > + * STABLE-NEXT: member base_type [[ULONG]] byte_size(8) encoding(7) b > data_member_location(8) > + * STABLE-NEXT: member base_type int byte_size(4) encoding(5) c > data_member_location(16) , > + * STABLE-NEXT: member base_type [[ULONG]] byte_size(8) encoding(7) d > data_member_location(24) > + * STABLE-NEXT: } byte_size(32) > + * > + * VERSION-DAG: #SYMVER ex2c 0x[[#%.08x,EX2]] > + */ > diff --git a/scripts/gendwarfksyms/gendwarfksyms.h > b/scripts/gendwarfksyms/gendwarfksyms.h > index f32ad4389b58..1cff868bacdb 100644 > --- a/scripts/gendwarfksyms/gendwarfksyms.h > +++ b/scripts/gendwarfksyms/gendwarfksyms.h > @@ -222,6 +222,20 @@ void cache_clear_expanded(struct expansion_cache *ec); > /* > * dwarf.c > */ > + > +/* See dwarf.c:get_union_kabi_status */ > +#define KABI_PREFIX "__kabi_" > +#define KABI_PREFIX_LEN (sizeof(KABI_PREFIX) - 1) > +#define KABI_RESERVED_PREFIX "reserved" > +#define KABI_RESERVED_PREFIX_LEN (sizeof(KABI_RESERVED_PREFIX) - 1) > +#define KABI_IGNORED_PREFIX "ignored" > +#define KABI_IGNORED_PREFIX_LEN (sizeof(KABI_IGNORED_PREFIX) - 1) > + > +static inline bool is_kabi_prefix(const char *name) > +{ > + return name && !strncmp(name, KABI_PREFIX, KABI_PREFIX_LEN); > +} > + Nit: The new KABI_* macros and the is_kabi_prefix() function are used only in dwarf.c so could be all moved there. > struct expansion_state { > bool expand; > unsigned int ptr_depth; > @@ -229,6 +243,18 @@ struct expansion_state { > const char *current_fqn; > }; > > +enum kabi_status { > + /* >0 to stop DIE processing */ > + KABI_NORMAL = 1, > + KABI_RESERVED, > + KABI_IGNORED, > +}; > + > +struct kabi_state { > + int members; > + Dwarf_Die placeholder; > +}; > + > struct state { > struct symbol *sym; > Dwarf_Die die; > @@ -239,6 +265,9 @@ struct state { > /* Structure expansion */ > struct expansion_state expand; > struct expansion_cache expansion_cache; > + > + /* Reserved or ignored members */ > + struct kabi_state kabi; > }; > > typedef int (*die_callback_t)(struct state *state, struct die *cache, I've noted some nits above which you might want to trivially address. Otherwise this looks ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v4 14/19] gendwarfksyms: Add support for kABI rules

2024-10-22 Thread Petr Pavlu
On 10/8/24 20:38, Sami Tolvanen wrote: > Distributions that want to maintain a stable kABI need the ability > to make ABI compatible changes to kernel without affecting symbol > versions, either because of LTS updates or backports. > > With genksyms, developers would typically hide these changes f

Re: [PATCH v4 13/19] gendwarfksyms: Add symbol versioning

2024-10-22 Thread Petr Pavlu
+ > + hash_for_each_safe(symbol_names, sym, tmp, name_hash) { > + func(sym, arg); > + } > +} > + > typedef void (*elf_symbol_callback_t)(const char *name, GElf_Sym *sym, > Elf32_Word xndx, void *arg); > > @@ -231,3 +271,22 @@ void symbol_read_symtab(int fd) > { > elf_for_each_global(fd, elf_set_symbol_addr, NULL); > } > + > +void symbol_print_versions(void) > +{ > + struct hlist_node *tmp; > + struct symbol *sym; > + > + hash_for_each_safe(symbol_names, sym, tmp, name_hash) { > + if (sym->state != SYMBOL_PROCESSED) > + warn("no information for symbol %s", sym->name); > + > + printf("#SYMVER %s 0x%08lx\n", sym->name, sym->crc); > + > + free((void *)sym->name); > + free(sym); > + } > + > + hash_init(symbol_addrs); > + hash_init(symbol_names); > +} I had some minor comment about adjusting the name of function symbol_print_versions() and possibly changing sym->name to 'char *' on the v2 of the patch: https://lore.kernel.org/all/286b1cc5-1757-4f0a-bb66-0875f4608...@suse.com/ Please have a look, it seems it felt through the cracks. In any case, the patch looks ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v4 09/19] gendwarfksyms: Expand structure types

2024-10-22 Thread Petr Pavlu
) alignment(8) msg > ) > -> base_type void > > Signed-off-by: Sami Tolvanen > Acked-by: Neal Gompa Looks ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Petr

Re: [PATCH v4 05/19] gendwarfksyms: Add a cache for processed DIEs

2024-10-22 Thread Petr Pavlu
, free free to add: Reviewed-by: Petr Pavlu -- Petr

Re: [PATCH v4 12/19] gendwarfksyms: Add symtypes output

2024-10-17 Thread Petr Pavlu
On 10/8/24 20:38, Sami Tolvanen wrote: > Add support for producing genksyms-style symtypes files. Process > die_map to find the longest expansions for each type, and use symtypes > references in type definitions. The basic file format is similar to > genksyms, with two notable exceptions: > > 1.

Re: [PATCH v4 11/19] gendwarfksyms: Add die_map debugging

2024-10-17 Thread Petr Pavlu
-by: Sami Tolvanen > Acked-by: Neal Gompa Looks ok to me, feel free to use: Reviewed-by: Petr Pavlu -- Petr

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

2024-10-17 Thread Petr Pavlu
On 10/8/24 20:38, Sami Tolvanen wrote: > The compiler may choose not to emit type information in DWARF for all > aliases, but it's possible for each alias to be exported separately. > To ensure we find type information for the aliases as well, read > {section, address} tuples from the symbol table

Re: [PATCH v4 10/19] gendwarfksyms: Limit structure expansion

2024-10-16 Thread Petr Pavlu
On 10/8/24 20:38, Sami Tolvanen wrote: > Expand each structure type only once per exported symbol. This > is necessary to support self-referential structures, which would > otherwise result in infinite recursion, but is still sufficient for > catching ABI changes. > > For pointers, limit structure

Re: [PATCH v3 03/20] tools: Add gendwarfksyms

2024-10-01 Thread Petr Pavlu
if (!name || !*name) > + return 0; > + > + hash_for_each_possible_safe(symbol_names, match, tmp, name_hash, > + hash_str(name)) { > + if (strcmp(match->name, name)) > + continue; > + > + if (func) > + func(match, data); > + > + return 1; > + } > + > + return 0; > +} > + > +static bool is_exported(const char *name) > +{ > + return checkp(for_each(name, NULL, NULL)) > 0; > +} > + > +void symbol_read_exports(FILE *file) > +{ > + struct symbol *sym; > + char *line = NULL; > + char *name = NULL; > + size_t size = 0; > + int nsym = 0; > + > + while (getline(&line, &size, file) > 0) { > + if (sscanf(line, "%ms\n", &name) != 1) > + error("malformed input line: %s", line); > + > + if (is_exported(name)) { > + /* Ignore duplicates */ > + free(name); > + continue; > + } > + > + sym = xcalloc(1, sizeof(struct symbol)); > + sym->name = name; > + > + hash_add(symbol_names, &sym->name_hash, hash_str(sym->name)); > + ++nsym; > + > + debug("%s", sym->name); > + } > + > + free(line); > + debug("%d exported symbols", nsym); > +} > + > +static void get_symbol(struct symbol *sym, void *arg) > +{ > + struct symbol **res = arg; > + > + *res = sym; > +} > + > +struct symbol *symbol_get(const char *name) > +{ > + struct symbol *sym = NULL; > + > + for_each(name, get_symbol, &sym); > + return sym; > +} Nit: The code inconsistently checks for a potential error from the function for_each(). Looking at the whole series, the value is checked using checkp() in functions symbol_set_crc(), symbol_set_ptr(), symbol_set_die(), is_exported(), but not in symbol_get() and elf_set_symbol_addr(). It would be good to unify this, or perhaps even make for_each() return an unsigned int to indicate it never fails? Looks otherwise ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v3 06/20] gendwarfksyms: Add a cache for processed DIEs

2024-10-01 Thread Petr Pavlu
On 9/23/24 20:18, Sami Tolvanen wrote: > 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

Re: [PATCH v3 04/20] gendwarfksyms: Add address matching

2024-10-01 Thread Petr Pavlu
On 9/23/24 20:18, Sami Tolvanen wrote: > The compiler may choose not to emit type information in DWARF for all > aliases, but it's possible for each alias to be exported separately. > To ensure we find type information for the aliases as well, read > {section, address} tuples from the symbol table

Re: [PATCH v3 09/20] gendwarfksyms: Expand array_type

2024-10-01 Thread Petr Pavlu
pointer_type { > const_type { > base_type char byte_size(1) encoding(6) > } > } byte_size(8) > } > > Signed-off-by: Sami Tolvanen > [...] Looks ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v3 10/20] gendwarfksyms: Expand structure types

2024-10-01 Thread Petr Pavlu
On 9/23/24 20:18, Sami Tolvanen wrote: > Recursively expand DWARF structure types, i.e. structs, unions, and > enums. Also include relevant DWARF attributes in type strings to > encode structure layout, for example. > > Example output with --dump-dies: > > subprogram ( > formal_parameter st

Re: [PATCH v3 07/20] gendwarfksyms: Expand type modifiers and typedefs

2024-10-01 Thread Petr Pavlu
and indentation to debugging output to make it > more readable. > > Signed-off-by: Sami Tolvanen > [...] Looks ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v3 08/20] gendwarfksyms: Expand subroutine_type

2024-10-01 Thread Petr Pavlu
{ > const_type { > base_type char byte_size(1) encoding(6) > } > } > ) > -> base_type unsigned long byte_size(8) encoding(7) > > Signed-off-by: Sami Tolvanen > [...] Looks ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v3 05/20] gendwarfksyms: Expand base_type

2024-10-01 Thread Petr Pavlu
ug --dump-dies vmlinux.o > ... > gendwarfksyms: process_symbol: loops_per_jiffy > variable base_type unsigned long byte_size(8) encoding(7) > ... > > Signed-off-by: Sami Tolvanen > [...] Looks ok to me, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

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

2024-09-12 Thread Petr Pavlu
On 9/11/24 18:03, Sami Tolvanen wrote: > On Wed, Sep 11, 2024 at 3:08 AM Petr Pavlu wrote: >> On 8/15/24 19:39, Sami Tolvanen wrote: >> More importantly, it made me think which names are included in the CRC >> calculation and which ones are omitted. >> >> I

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

2024-09-11 Thread Petr Pavlu
On 8/31/24 02:05, Sami Tolvanen wrote: > On Fri, Aug 30, 2024 at 9:34 AM Miroslav Benes wrote: >> >> yes, this is one of the approaches we use in SLES. We add kabi paddings >> to some structures in advance (see [1] as a random example) and then use >> it later if needed. >> >> It is not the only a

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

2024-09-11 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > 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

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

2024-09-10 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > Add support for producing genksyms-style symtypes files. Process > die_map to find the longest expansions for each type, and use symtypes > references in type definitions. The basic file format is similar to > genksyms, with two notable exceptions: > > 1.

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

2024-09-03 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > Expand each structure type only once per exported symbol. This > is necessary to support self-referential structures, which would > otherwise result in infinite recursion, but is still sufficient for > catching ABI changes. > > For pointers to structure typ

Re: [PATCH v2 08/19] gendwarfksyms: Expand subroutine_type

2024-09-03 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > Add support for expanding DW_TAG_subroutine_type and the parameters > in DW_TAG_formal_parameter. Use this to also expand subprograms. > > Example output with --debug: > > subprogram( > formal_parameter base_type usize byte_size(8), > formal_para

Re: [PATCH] module: abort module loading when sysfs setup suffer errors

2024-09-03 Thread Petr Pavlu
On 8/30/24 07:43, Chunhui Li wrote: > When insmod a kernel module, if fails in add_notes_attrs or > add_sysfs_attrs such as memory allocation fail, mod_sysfs_setup > will still return success, but we can't access user interface > on android device. > > Patch for make mod_sysfs_setup can check the

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

2024-09-02 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > 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

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

2024-09-02 Thread Petr Pavlu
On 8/29/24 00:53, Sami Tolvanen wrote: > On Wed, Aug 28, 2024 at 04:04:09PM +0900, Masahiro Yamada wrote: >> On Fri, Aug 16, 2024 at 2:39 AM Sami Tolvanen >> wrote: >>> - Added a --symtypes flag for generating a genksyms-style >>> symtypes output based on Petr's feedback, and refactored >>> s

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

2024-09-02 Thread Petr Pavlu
On 8/29/24 01:09, Sami Tolvanen wrote: > On Wed, Aug 28, 2024 at 02:35:29PM +0200, Petr Pavlu wrote: >> On 8/15/24 19:39, Sami Tolvanen wrote: >>> diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c >>> index 65a29d0bd8f4..71cfab0553da 100644 >

Re: [PATCH v2 05/19] gendwarfksyms: Expand base_type

2024-08-28 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > Start making gendwarfksyms more useful by adding support for > expanding DW_TAG_base_type types and basic DWARF attributes. > > Example: > > $ echo loops_per_jiffy | \ > scripts/gendwarfksyms/gendwarfksyms --debug vmlinux.o > ... > gendwarfksym

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

2024-08-28 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c > index 65a29d0bd8f4..71cfab0553da 100644 > --- a/scripts/gendwarfksyms/dwarf.c > +++ b/scripts/gendwarfksyms/dwarf.c > @@ -5,6 +5,48 @@ > [...] > + > +static bool is_export_symbol(st

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

2024-08-28 Thread Petr Pavlu
On 8/26/24 20:47, Sami Tolvanen wrote: > On Mon, Aug 26, 2024 at 10:42 AM Petr Pavlu wrote: >> On 8/15/24 19:39, Sami Tolvanen wrote: >>> [...] >>> +int main(int argc, const char **argv) >>> +{ >>> + unsigned int n; >>> + >>> +

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

2024-08-27 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > The compiler may choose not to emit type information in DWARF for all > aliases, but it's possible for each alias to be exported separately. > To ensure we find type information for the aliases as well, read > {section, address} tuples from the symbol table

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

2024-08-27 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > 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

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

2024-08-26 Thread Petr Pavlu
On 8/15/24 19:39, Sami Tolvanen wrote: > 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. > > Sig

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

2024-08-22 Thread Petr Pavlu
les 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: Petr Pavlu Cheers, Petr

[PATCH] function_graph: Fix the ret_stack used by ftrace_graph_ret_addr()

2024-08-03 Thread Petr Pavlu
ted-by: Miroslav Benes Fixes: 7aa1eaef9f42 ("function_graph: Allow multiple users to attach to function graph") Signed-off-by: Petr Pavlu --- kernel/trace/fgraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index

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

2024-08-01 Thread Petr Pavlu
On 7/26/24 23:05, Sami Tolvanen wrote: > 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. >> >&

Re: [PATCH 1/2] module: Split modules_install compression and in-kernel decompression

2024-07-25 Thread Petr Pavlu
On 7/22/24 12:23, Masahiro Yamada wrote: > On Mon, Jul 22, 2024 at 6:07 PM Petr Pavlu wrote: >> >> The kernel configuration allows specifying a module compression mode. If >> one is selected then each module gets compressed during >> 'make modules_install'

[PATCH 2/2] module: Clean up the description of MODULE_SIG_

2024-07-22 Thread Petr Pavlu
The MODULE_SIG_ config choice has an inconsistent prompt styled as a question and lengthy option names. Simplify the prompt and option names to be consistent with other module options. Signed-off-by: Petr Pavlu --- kernel/module/Kconfig | 16 1 file changed, 8 insertions(+), 8

[PATCH 1/2] module: Split modules_install compression and in-kernel decompression

2024-07-22 Thread Petr Pavlu
t defaults to Y. * "Support in-kernel module decompression" (MODULE_DECOMPRESS) enables in-kernel decompression. Signed-off-by: Petr Pavlu --- kernel/module/Kconfig| 61 scripts/Makefile.modinst | 2 ++ 2 files changed, 33 insertions(+), 30 d

[PATCH 0/2] module: Split modules_install compression and in-kernel decompression

2024-07-22 Thread Petr Pavlu
Allow enabling the in-kernel module decompression support separately, without requiring to enable also the automatic compression during 'make modules_install'. Petr Pavlu (2): module: Split modules_install compression and in-kernel decompression module: Clean up the description of M

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

2024-07-22 Thread Petr Pavlu
On 7/15/24 22:39, Sami Tolvanen wrote: > On Wed, Jul 10, 2024 at 7:30 AM Petr Pavlu wrote: >> On 6/17/24 19:58, Sami Tolvanen wrote: >>> The first 12 patches of this series add a small tool for computing >>> symbol versions from DWARF, called gendwarfksyms. When pa

[PATCH pre-6.7] kprobes: Fix double free of kretprobe_holder

2024-07-17 Thread Petr Pavlu
for longterm or distribution kernels. Additionally, I would like to propose a small improvement to refcount_t and this gives me an actual problem to point to about its motivation. Cheers, Petr --- >From b0dde62cc5268a7d728cfdb360cb5170266a5e11 Mon Sep 17 00:00:00 2001 From: Petr Pavlu Date: Thu

[PATCH v3] ring-buffer: Limit time with disabled interrupts in rb_check_pages()

2024-07-15 Thread Petr Pavlu
ividual pages. Introduce for this purpose a new variable ring_buffer_per_cpu.cnt which is bumped any time the list is modified. The value is used by rb_check_pages() to detect such a change and restart the check. Signed-off-by: Petr Pavlu --- This is a follow-up to the discussion about improving

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

2024-07-10 Thread Petr Pavlu
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 > kernel modules, and depend on modversions to help ensure module ABI > compatibility. Thanks for working on this

Re: [PATCH v2] ring-buffer: Limit time with disabled interrupts in rb_check_pages()

2024-07-04 Thread Petr Pavlu
On 7/3/24 23:44, Steven Rostedt wrote: > On Wed, 3 Jul 2024 09:53:14 +0200 > Petr Pavlu wrote: > >> The function rb_check_pages() validates the integrity of a specified >> per-CPU tracing ring buffer. It does so by traversing the underlying >> linked list and check

[PATCH v2] ring-buffer: Limit time with disabled interrupts in rb_check_pages()

2024-07-03 Thread Petr Pavlu
ividual pages. Introduce for this purpose a new variable ring_buffer_per_cpu.pages_era which is bumped any time the list is modified. The value is used by rb_check_pages() to detect such a change and restart the check. Signed-off-by: Petr Pavlu --- This is a follow-up to the discussion about improving

Re: [PATCH] ring-buffer: Limit time with disabled interrupts in rb_check_pages()

2024-06-23 Thread Petr Pavlu
On 6/21/24 17:09, Petr Pavlu wrote: > Function rb_check_pages() validates the integrity of a specified per-CPU > tracing ring buffer. It does so by walking the underlying linked > list and checking its next and prev links. > > To guarantee that the list doesn't get modified d

[PATCH] ring-buffer: Limit time with disabled interrupts in rb_check_pages()

2024-06-21 Thread Petr Pavlu
ze. This particularly affects PREEMPT_RT because the reader_lock is a raw spinlock which doesn't become sleepable on PREEMPT_RT kernels. Modify the check so it still tries to walk the whole list but gives up the reader_lock between checking individual pages. Signed-off-by: Petr Pavlu -

Re: [PATCH 2/2] ring-buffer: Fix a race between readers and resize checks

2024-06-07 Thread Petr Pavlu
On 5/28/24 01:43, Steven Rostedt wrote: > On Mon, 27 May 2024 11:36:55 +0200 > Petr Pavlu wrote: > >>>> static void rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer) >>>> { >>>> @@ -2200,8 +2205,13 @@ int ring_buffer_resize(struct t

Re: [PATCH 2/2] ring-buffer: Fix a race between readers and resize checks

2024-05-27 Thread Petr Pavlu
On 5/20/24 15:50, Steven Rostedt wrote: > On Fri, 17 May 2024 15:40:08 +0200 > Petr Pavlu wrote: > >> The reader code in rb_get_reader_page() swaps a new reader page into the >> ring buffer by doing cmpxchg on old->list.prev->next to point it to the >> new page.

[PATCH 2/2] ring-buffer: Fix a race between readers and resize checks

2024-05-17 Thread Petr Pavlu
g on the same ring_buffer_per_cpu by taking its cpu_buffer->reader_lock. Fixes: 659f451ff213 ("ring-buffer: Add integrity check at end of iter read") Signed-off-by: Petr Pavlu --- kernel/trace/ring_buffer.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/kernel/trace/ri

[PATCH 1/2] ring-buffer: Correct stale comments related to non-consuming readers

2024-05-17 Thread Petr Pavlu
. Nonetheless, the lock is still needed because a reader swapping a page into the ring buffer can make the underlying doubly-linked list temporarily inconsistent. This is a non-functional change. Signed-off-by: Petr Pavlu --- kernel/trace/ring_buffer.c | 16 +++- 1 file chang

[PATCH 0/2] ring-buffer: Fix a race between readers and resize checks

2024-05-17 Thread Petr Pavlu
to exist for ring_buffer_subbuf_order_set() too. I plan to tackle it in a separate series. Petr Pavlu (2): ring-buffer: Correct stale comments related to non-consuming readers ring-buffer: Fix a race between readers and resize checks kernel/trace/ring_buffer.c | 26

[PATCH] tracing: Fix HAVE_DYNAMIC_FTRACE_WITH_REGS ifdef

2024-02-13 Thread Petr Pavlu
he missing "CONFIG_" prefix for the logic to work as intended. Fixes: a8b9cf62ade1 ("ftrace: Fix DIRECT_CALLS to use SAVE_REGS by default") Signed-off-by: Petr Pavlu --- kernel/trace/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/ft

[PATCH] tracing: Ensure visibility when inserting an element into tracing_map

2024-01-22 Thread Petr Pavlu
y expected potential races which result in duplicates but merged them later when they occurred. Fixes: c193707dde77 ("tracing: Remove code which merges duplicates") Signed-off-by: Petr Pavlu --- kernel/trace/tracing_map.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-)

[PATCH v2 3/3] tracing: Fix a possible race when disabling buffered events

2023-12-05 Thread Petr Pavlu
;tracing: Use temp buffer when filtering events") Signed-off-by: Petr Pavlu --- kernel/trace/trace.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index dd45020fcdde..dc234b5dde47 100644 --- a/kernel/trace/trace.c +++

[PATCH v2 2/3] tracing: Fix a warning when allocating buffered events fails

2023-12-05 Thread Petr Pavlu
the first failure and left any cleanup later to when trace_buffered_event_disable() is called. Fixes: 0fc1b09ff1ff ("tracing: Use temp buffer when filtering events") Signed-off-by: Petr Pavlu --- kernel/trace/trace.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff

[PATCH v2 1/3] tracing: Fix incomplete locking when disabling buffered events

2023-12-05 Thread Petr Pavlu
h invokes a given callback on all CPUs. Fixes: 0fc1b09ff1ff ("tracing: Use temp buffer when filtering events") Fixes: dea499781a11 ("tracing: Fix warning in trace_buffered_event_disable()") Signed-off-by: Petr Pavlu --- kernel/trace/trace.c | 12 1 file changed, 4 inserti

[PATCH v2 0/3] tracing: Simplify and fix "buffered event" synchronization

2023-12-05 Thread Petr Pavlu
/20231127151248.7232-1-petr.pa...@suse.com/ Petr Pavlu (3): tracing: Fix incomplete locking when disabling buffered events tracing: Fix a warning when allocating buffered events fails tracing: Fix a possible race when disabling buffered events kernel/trace/trace.c | 35 +-- 1

Re: [PATCH 1/2] tracing: Simplify and fix "buffered event" synchronization

2023-12-05 Thread Petr Pavlu
On 12/1/23 15:46, Steven Rostedt wrote: > On Fri, 1 Dec 2023 15:17:35 +0100 > Petr Pavlu wrote: > >> Ok, keeping the current approach, my plan for v2 is to prepare the >> following patches: >> >> [...] >> * Fix the potential race be

Re: [PATCH 1/2] tracing: Simplify and fix "buffered event" synchronization

2023-12-01 Thread Petr Pavlu
On 11/29/23 15:58, Steven Rostedt wrote: > On Wed, 29 Nov 2023 10:22:23 +0100 > Petr Pavlu wrote: > >> Yes, I believe this should address this potential race condition. >> >> An alternative would be instead to update >> trace_event_buffer_lock_re

Re: [PATCH 1/2] tracing: Simplify and fix "buffered event" synchronization

2023-11-29 Thread Petr Pavlu
On 11/28/23 16:27, Steven Rostedt wrote: > On Tue, 28 Nov 2023 16:05:00 +0100 > Petr Pavlu wrote: > >> On 11/27/23 18:41, Steven Rostedt wrote: >>> On Mon, 27 Nov 2023 16:12:47 +0100 >>> Petr Pavlu wrote: >>> >>>> The following warning

Re: [PATCH 1/2] tracing: Simplify and fix "buffered event" synchronization

2023-11-28 Thread Petr Pavlu
On 11/27/23 18:41, Steven Rostedt wrote: > On Mon, 27 Nov 2023 16:12:47 +0100 > Petr Pavlu wrote: > >> The following warning appears when using buffered events: >> [ 203.556451] WARNING: CPU: 53 PID: 10220 at >> kernel/trace/ring_buffer.c:3912 ring_buffer_discard_com

[PATCH 2/2] tracing: Disable events in reverse order of their enable operation

2023-11-27 Thread Petr Pavlu
event would be still registered and could be hit, but would unnecessarily go directly to a ring buffer. * The SOFT_DISABLED flag is now consistently set only when SOFT_MODE is also set. Signed-off-by: Petr Pavlu --- kernel/trace/trace_events.c | 17 ++--- 1 file changed, 10

[PATCH 0/2] tracing: Simplify and fix "buffered event" synchronization

2023-11-27 Thread Petr Pavlu
Rework the maintenance synchronization for buffered events to simplify it and to address several found problems. Petr Pavlu (2): tracing: Simplify and fix "buffered event" synchronization tracing: Disable events in reverse order of their enable operation kernel/trace/trace.c

[PATCH 1/2] tracing: Simplify and fix "buffered event" synchronization

2023-11-27 Thread Petr Pavlu
cing: Use temp buffer when filtering events") Fixes: dea499781a11 ("tracing: Fix warning in trace_buffered_event_disable()") Signed-off-by: Petr Pavlu --- kernel/trace/trace.c | 66 ++-- 1 file changed, 27 insertions(+), 39 deletions(-) diff --gi

  1   2   >