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: [syzbot] [modules?] KMSAN: uninit-value in __request_module (6)

2025-02-13 Thread Petr Pavlu
On 2/12/25 14:41, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit:febbc555cf0f Merge tag 'nfsd-6.14-1' of git://git.kernel.o.. > git tree: upstream > console+strace: https://syzkaller.appspot.com/x/log.txt?x=137a78e458 > kernel config: https://syzkal

Re: [PATCH v3 1/4] kernel: param: rename locate_module_kobject

2025-02-13 Thread Petr Pavlu
On 2/11/25 22:48, Shyam Saini wrote: > The locate_module_kobject() function looks up an existing > module_kobject for a given module name. If it cannot find the > corresponding module_kobject, it creates one for the given name. > > This commit renames locate_module_kobject() to > lookup_or_create_

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

2025-03-15 Thread Petr Pavlu
. The kernel now has commit 110b1e070f1d ("module: Don't fail module loading when setting ro_after_init section RO failed") which addresses a previous problem with handling ro_after_init sections. [1] https://lore.kernel.org/linux-modules/20241223093840.29417-1-petr.pa...@suse.c

Re: [PATCH v8 0/7] rust: extend `module!` macro with integer parameter support

2025-03-20 Thread Petr Pavlu
On 3/20/25 13:00, Miguel Ojeda wrote: > On Thu, Mar 20, 2025 at 11:26 AM Andreas Hindborg > wrote: >> >> As far as I understand, Miguel would take patch 1-5 for v6.15 and >> modules would take patch 6-7 for v6.16. At least that is my >> understanding from [1], @Petr and @Miguel please correct me

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

2025-04-07 Thread Petr Pavlu
On 3/6/25 14:13, Petr Pavlu wrote: > 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 m

Re: [PATCH v9 0/3] rust: extend `module!` macro with integer parameter support

2025-04-22 Thread Petr Pavlu
On 3/21/25 10:17, Andreas Hindborg wrote: > Extend the `module!` macro with support module parameters. Also add some > string > to integer parsing functions and updates `BStr` with a method to strip a > string > prefix. > > Based on code by Adam Bratschi-Kaye lifted from the original `rust` bran

Re: [PATCH v1 0/7] Add generated modalias to modules.builtin.modinfo

2025-04-28 Thread Petr Pavlu
On 4/26/25 18:16, Alexey Gladkov wrote: > The modules.builtin.modinfo file is used by userspace (kmod to be specific) to > get information about builtin modules. Among other information about the > module, > information about module aliases is stored. This is very important to > determine > that

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

2025-04-30 Thread Petr Pavlu
The following changes since commit 8ffd015db85fea3e15a77027fda6c02ced4d2444: Linux 6.15-rc2 (2025-04-13 11:54:49 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux.git/ tags/modules-6.15-rc5 for you to fetch changes up to f95bbfe18512

Re: [PATCH v4 0/4] Properly handle module_kobject creation

2025-04-16 Thread Petr Pavlu
On 2/27/25 19:49, Shyam Saini wrote: > Hi Everyone, > > This patch series fixes handling of module_kobject creation. > A driver expect module_kset list populated with its corresponding > module_kobject to create its /sys/module//drivers > directory. > > Since, > [1] commit 96a1a2412acb ("kernel/p

Re: [PATCH v2 3/4] gendwarfksyms: Add a kABI rule to override type strings

2025-05-06 Thread Petr Pavlu
s to fully override a type string for a symbol or a > type. Also add a more informative error message in case we find > a non-existent type references when calculating versions. > > Suggested-by: Giuliano Procida > Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH 1/4] gendwarfksyms: Clean up kABI rule look-ups

2025-05-05 Thread Petr Pavlu
On 4/30/25 23:40, Sami Tolvanen wrote: > Reduce code duplication by moving kABI rule look-ups to separate > functions. > > Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu -- Petr

Re: [PATCH 2/4] gendwarfksyms: Add a kABI rule to override byte_size attributes

2025-05-05 Thread Petr Pavlu
yte_size attribute for types: > > /* >* struct s allocation is handled by the kernel, so >* appending new members without changing the original >* layout won't break the ABI. >*/ > KABI_BYTE_SIZE(s, 16); > > This results in a type string that's unchanged from the original > and therefore, won't change versions for symbols that reference > the changed structure. > > Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu -- Petr

Re: [PATCH 3/4] gendwarfksyms: Add a kABI rule to override type strings

2025-05-05 Thread Petr Pavlu
On 4/30/25 23:40, Sami Tolvanen wrote: > In rare situations where distributions must make significant > changes to otherwise opaque data structures that have > inadvertently been included in the published ABI, keeping > symbol versions stable using the existing kABI macros can > become tedious. >

Re: [PATCH v1 5/7] modpost: Create modalias for builtin modules

2025-04-29 Thread Petr Pavlu
On 4/26/25 18:16, Alexey Gladkov wrote: > For some modules, modalias is generated using the modpost utility and > the section is added to the module file. > > When a module is added inside vmlinux, modpost does not generate > modalias for such modules and the information is lost. > > As a result

Re: [PATCH v1 5/7] modpost: Create modalias for builtin modules

2025-04-29 Thread Petr Pavlu
On 4/29/25 14:49, Alexey Gladkov wrote: > On Tue, Apr 29, 2025 at 12:04:44PM +0200, Alexey Gladkov wrote: >>> I'm not sure it's best to overload this data in this way. I think mixing >>> actual files and "logical" modules in the modules list is somewhat >>> confusing. >>> >>> An alternative would b

Re: [PATCH v1 5/7] modpost: Create modalias for builtin modules

2025-05-03 Thread Petr Pavlu
On 4/29/25 17:15, Alexey Gladkov wrote: > On Tue, Apr 29, 2025 at 04:14:13PM +0200, Petr Pavlu wrote: >> On 4/29/25 14:49, Alexey Gladkov wrote: >>> On Tue, Apr 29, 2025 at 12:04:44PM +0200, Alexey Gladkov wrote: >>>>> I'm not sure it's best to ove

[PATCH] module: Taint the kernel when write-protecting ro_after_init fails

2025-03-06 Thread Petr Pavlu
d-by: Kees Cook Signed-off-by: Petr Pavlu --- I opted to use TAINT_BAD_PAGE for now because it seemed unnecessary to me to introduce a new flag only for this specific case. However, if we end up similarly checking set_memory_*() in the boot context, a separate flag would be probably better. --- kerne

Re: [PATCH] module: Taint the kernel when write-protecting ro_after_init fails

2025-03-06 Thread Petr Pavlu
+To: Christophe Leroy On 3/6/25 11:36, Petr Pavlu wrote: > In the unlikely case that setting ro_after_init data to read-only fails, it > is too late to cancel loading of the module. The loader then issues only > a warning about the situation. Given that this reduces the kernel's &g

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

2025-03-06 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] MAINTAINERS: Update the MODULE SUPPORT section

2025-03-06 Thread Petr Pavlu
. They were introduced previously by commit 84b4a51fce4c ("selftests: add new kallsyms selftests"). Signed-off-by: Petr Pavlu --- MAINTAINERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 8e0736dc2ee0..0c8a00b0b49b 100644 --- a/M

Re: [PATCH] module: Remove unnecessary size argument when calling strscpy()

2025-03-10 Thread Petr Pavlu
On 3/8/25 20:46, Thorsten Blum wrote: > The size parameter is optional and strscpy() automatically determines > the length of the destination buffer using sizeof() if the argument is > omitted. This makes the explicit sizeof() unnecessary. Remove it to > shorten and simplify the code. > > Signed-o

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

2025-03-11 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 d09b46ef032f

Re: [PATCH v7 0/6] rust: extend `module!` macro with integer parameter support

2025-02-27 Thread Petr Pavlu
On 2/25/25 12:54, Miguel Ojeda wrote: > On Tue, Feb 25, 2025 at 11:22 AM Petr Pavlu wrote: >> >> I'd say the easiest is for the entire series to go through the Rust >> tree. I'd also propose that any updates go primarily through that tree >> as well. >&g

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

2025-03-11 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] codetag: Avoid unused alloc_tags sections/symbols

2025-03-13 Thread Petr Pavlu
codetag.lds.h to make the data conditional on CONFIG_MEM_ALLOC_PROFILING. Signed-off-by: Petr Pavlu --- include/asm-generic/codetag.lds.h | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/codetag.lds.h b/include/asm-generic/codetag.lds.h index

Re: [PATCH v4 0/4] Properly handle module_kobject creation

2025-03-05 Thread Petr Pavlu
On 2/27/25 19:49, Shyam Saini wrote: > Hi Everyone, > > This patch series fixes handling of module_kobject creation. > A driver expect module_kset list populated with its corresponding > module_kobject to create its /sys/module//drivers > directory. > > Since, > [1] commit 96a1a2412acb ("kernel/p

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

2025-03-12 Thread Petr Pavlu
On 3/7/25 01:12, Sami Tolvanen wrote: > On Thu, Mar 06, 2025 at 06:28:58PM +0100, Christophe Leroy wrote: >> Le 06/03/2025 à 14:13, Petr Pavlu a écrit : >>> Section .static_call_sites holds data structures that need to be sorted and >>> processed only at module load ti

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

2025-03-13 Thread Petr Pavlu
On 3/13/25 00:21, Sami Tolvanen wrote: > Hi Petr, > > On Wed, Mar 12, 2025 at 5:05 AM Petr Pavlu wrote: >> >> On 3/7/25 01:12, Sami Tolvanen wrote: >>> On Thu, Mar 06, 2025 at 06:28:58PM +0100, Christophe Leroy wrote: >>>> Le 06/03/2025 à

Re: [PATCH v3 2/4] kernel: refactor lookup_or_create_module_kobject()

2025-02-13 Thread Petr Pavlu
On 2/11/25 22:48, Shyam Saini wrote: > In the unlikely event of the allocation failing, it is better to let > the machine boot with a not fully populated sysfs than to kill it with > this BUG_ON(). All callers are already prepared for > lookup_or_create_module_kobject() returning NULL. > > This is

Re: [PATCH v3 3/4] kernel: globalize lookup_or_create_module_kobject()

2025-02-13 Thread Petr Pavlu
On 2/11/25 22:48, Shyam Saini wrote: > lookup_or_create_module_kobject() is marked as static and __init, > to make it global drop static keyword. > Since this function can be called from non-init code, use __modinit > instead of __init, __modinit marker will make it __init if > CONFIG_MODULES is no

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

2025-02-17 Thread Petr Pavlu
;s worth, this looks reasonable to me from the modules perspective. Acked-by: Petr Pavlu # from modules perspective -- Thanks, Petr

Re: [PATCH v3 2/4] kernel: refactor lookup_or_create_module_kobject()

2025-02-25 Thread Petr Pavlu
On 2/21/25 11:42, Rasmus Villemoes wrote: > On Thu, Feb 13 2025, Petr Pavlu wrote: > >> On 2/11/25 22:48, Shyam Saini wrote: >>> In the unlikely event of the allocation failing, it is better to let >>> the machine boot with a not fully populated sysfs than to kill

Re: [PATCH v7 0/6] rust: extend `module!` macro with integer parameter support

2025-02-25 Thread Petr Pavlu
On 2/24/25 12:27, Andreas Hindborg wrote: > Hi Petr, > > "Andreas Hindborg" writes: > >> This series extends the `module!` macro with support module parameters. It >> also adds some string to integer parsing functions and updates `BStr` with >> a method to strip a string prefix. >> >> This serie

Re: [PATCH v3 2/4] kernel: refactor lookup_or_create_module_kobject()

2025-02-27 Thread Petr Pavlu
On 2/25/25 18:24, Shyam Saini wrote: > On Tue, Feb 25, 2025 at 09:33:10AM +0100, Petr Pavlu wrote: >> On 2/21/25 11:42, Rasmus Villemoes wrote: >>> On Thu, Feb 13 2025, Petr Pavlu wrote: >>> >>>> On 2/11/25 22:48, Shyam Saini wrote: >>>>>

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

2025-03-28 Thread Petr Pavlu
change when KASAN + lockdep were enabled, but it was effectively addressed by the already merged ee57ab5a3212 ("locking/lockdep: Disable KASAN instrumentation of lockdep.c"). Joel Granados (1): tests/module: nix-ify

Re: [GIT PULL] Modules fixes for v6.15-rc6

2025-05-09 Thread Petr Pavlu
On 5/9/25 18:19, Linus Torvalds wrote: > On Fri, 9 May 2025 at 08:09, Petr Pavlu wrote: >> >> The fix has been on modules-next only since yesterday but should be safe. > > Hmm. > > At a minimum, the *description* of this bug is garbage. > > It talks about an

Re: [PATCH] params: Add support for static keys

2025-05-12 Thread Petr Pavlu
On 5/10/25 23:01, Kent Overstreet wrote: > Static keys can now be a module parameter, e.g. > > module_param_named(foo, foo.key, static_key_t, 0644) > > bcachefs is now using this. > > Cc: Luis Chamberlain > Cc: Petr Pavlu > Cc: Sami Tolvanen > Cc:

Re: [PATCH v2 4/6] modpost: Create modalias for builtin modules

2025-05-12 Thread Petr Pavlu
st if the module is built separately. > > To fix this it is necessary to generate the same modalias for vmlinux as > for the individual modules. Fortunately '.vmlinux.export.o' is already > generated from which '.modinfo' can be extracted in the same way as for > vmlinux.o. > > Signed-off-by: Masahiro Yamada > Signed-off-by: Alexey Gladkov Reviewed-by: Petr Pavlu -- Petr

[GIT PULL] Modules fixes for v6.15-rc6

2025-05-09 Thread Petr Pavlu
The following changes since commit 92a09c47464d040866cf2b4cd052bc60555185fb: Linux 6.15-rc5 (2025-05-04 13:55:04 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux.git/ tags/modules-6.15-rc6 for you to fetch changes up to a6aeb739974e

Re: [PATCH v2 3/6] modpost: Make mod_device_table aliases more unique

2025-05-12 Thread Petr Pavlu
On 5/9/25 18:42, Alexey Gladkov wrote: > In order to avoid symbol conflicts if they appear in the same binary, a > more unique alias identifier can be generated. > > Signed-off-by: Alexey Gladkov Reviewed-by: Petr Pavlu -- Petr

Re: [PATCH v2 2/6] modules: Add macros to specify modinfo prefix

2025-05-12 Thread Petr Pavlu
t; builtin modules. > > Signed-off-by: Alexey Gladkov Reviewed-by: Petr Pavlu -- Petr

Re: [PATCH v3 2/5] module: Add module specific symbol namespace support

2025-05-14 Thread Petr Pavlu
ijlstra (Intel) Sorry, I thought this was already reviewed from the modules perspective, but I'll make it explicit. Looks ok to me, besides the already mentioned "strsmp" typo. I can fix it when picking up the series. Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v3 3/5] module: Extend the MODULE_ namespace parsing

2025-05-14 Thread Petr Pavlu
On 5/2/25 16:12, Peter Zijlstra wrote: > Instead of only accepting "module:${name}", extend it with a comma > separated list of module names and add tail glob support. > > That is, something like: "module:foo-*,bar" is now possible. > > Signed-off-by: Pete

Re: [PATCH v3 4/5] module: Account for the build time module name mangling

2025-05-14 Thread Petr Pavlu
> + for (int i = 0; i < n; i++) { Nit: This could be 'size_t i' for consistency. I can adjust it when picking up the series. Reviewed-by: Petr Pavlu -- Petr > + char a = str_a[i]; > + char b = str_b[i]; > + int d; > + > +

Re: [PATCH v3 5/5] module: Provide EXPORT_SYMBOL_GPL_FOR_MODULES() helper

2025-05-14 Thread Petr Pavlu
#x27; and chokes on: > + * > + * .asciz "MODULE_" "kvm" ; > + */ Typo: "cam" -> "can't". I can correct it when picking up the series. Reviewed-by: Petr Pavlu -- Petr > +#define ___EXPORT_SYMBOL(sym, license, ns

Re: [PATCH v3 0/5] module: Strict per-modname namespaces

2025-05-14 Thread Petr Pavlu
On 5/2/25 16:12, Peter Zijlstra wrote: > Hi! > > Implement means for exports to be available to an explicit list of named > modules. By explicitly limiting the usage of certain exports, the abuse > potential/risk is greatly reduced. > > Changes since v2: > > - switch to "module:" prefix (Masahi

Re: [PATCH v3 0/5] module: Strict per-modname namespaces

2025-05-18 Thread Petr Pavlu
On 5/17/25 08:48, Masahiro Yamada wrote: > On Wed, May 14, 2025 at 5:48 PM Petr Pavlu wrote: >> >> On 5/2/25 16:12, Peter Zijlstra wrote: >>> Hi! >>> >>> Implement means for exports to be available to an explicit list of named >>> modules. By ex

Re: [PATCH 2/3] modpost: allow "make nsdeps" to skip module-specific symbol namespace

2025-05-27 Thread Petr Pavlu
st: module "foo" uses symbol "bar", which is exported only for > module "baz" > > Apply the same logic for kernel space as well. > > Fixes: 092a4f5985f2 ("module: Add module specific symbol namespace support") > Signed-off-by: Masah

Re: [PATCH 01/12] module: Move modprobe_path and modules_disabled ctl_tables into the module subsys

2025-05-15 Thread Petr Pavlu
On 5/9/25 14:54, Joel Granados wrote: > Move module sysctl (modprobe_path and modules_disabled) out of sysctl.c > and into the modules subsystem. Make the modprobe_path variable static > as it no longer needs to be exported. Remove module.h from the includes > in sysctl as it no longer uses any mod

Re: [PATCH 01/12] module: Move modprobe_path and modules_disabled ctl_tables into the module subsys

2025-05-15 Thread Petr Pavlu
On 5/15/25 12:04, Joel Granados wrote: > On Thu, May 15, 2025 at 10:04:53AM +0200, Petr Pavlu wrote: >> On 5/9/25 14:54, Joel Granados wrote: >>> Move module sysctl (modprobe_path and modules_disabled) out of sysctl.c >>> and into the modules subsystem. Make the mo

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

2025-06-02 Thread Petr Pavlu
discussed previously, we rotate module maintainership among its co-maintainers every 6 months. Daniel Gomez is next in line and he will send the next pull request for the modules. Petr Pavlu (3): module: Constify parameters of

[PATCH v2] codetag: Avoid unused alloc_tags sections/symbols

2025-06-18 Thread Petr Pavlu
codetag.lds.h to make the data conditional on CONFIG_MEM_ALLOC_PROFILING. Signed-off-by: Petr Pavlu Reviewed-by: Kent Overstreet Reviewed-by: Suren Baghdasaryan --- Changes since v1 [1]: - Trivially rebased the patch on top of "alloc_tag: remove empty module tag section" [2].

[PATCH v2 1/2] module: Fix memory deallocation on error path in move_module()

2025-06-18 Thread Petr Pavlu
odule: add stop-grap sanity check on module memcpy()") Signed-off-by: Petr Pavlu Reviewed-by: Sami Tolvanen --- kernel/module/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 413ac6ea3702..9ac994b2f354 100644 --

[PATCH v2 0/2] module: Fix memory deallocation on error path in move_module()

2025-06-18 Thread Petr Pavlu
/linux-modules/20250607161823.409691-1-petr.pa...@suse.com/ Petr Pavlu (2): module: Fix memory deallocation on error path in move_module() module: Avoid unnecessary return value initialization in move_module() kernel/module/main.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions

[PATCH v2 2/2] module: Avoid unnecessary return value initialization in move_module()

2025-06-18 Thread Petr Pavlu
All error conditions in move_module() set the return value by updating the ret variable. Therefore, it is not necessary to the initialize the variable when declaring it. Remove the unnecessary initialization. Signed-off-by: Petr Pavlu Reviewed-by: Sami Tolvanen --- kernel/module/main.c | 3

Re: [PATCH 3/3] kunit: test: Drop CONFIG_MODULE ifdeffery

2025-06-17 Thread Petr Pavlu
On 6/17/25 10:39 AM, Thomas Weißschuh wrote: > On Tue, Jun 17, 2025 at 09:44:49AM +0200, Petr Pavlu wrote: >> On 6/12/25 4:53 PM, Thomas Weißschuh wrote: >>> The function stubs exposed by module.h allow the code to compile properly >>> without the ifdeffery. The gene

Re: [PATCH 1/2] module: Fix memory deallocation on error path in move_module()

2025-06-17 Thread Petr Pavlu
On 6/17/25 11:47 AM, Daniel Gomez wrote: >> Do you mean the following, or something else: >> >> static int move_module(struct module *mod, struct load_info *info) >> { >> int i; >> enum mod_mem_type t = MOD_MEM_NUM_TYPES; >> int ret; >> bool codetag_section_found = false; >> >>

Re: [PATCH] gendwarfksyms: Fix structure type overrides

2025-06-13 Thread Petr Pavlu
d); > - __type_expand(cache, &child, true); > - type_map_add(name, &child); > - type_expansion_free(&child); > - } Nit: This code was the only user of __cache_was_expanded() and __cache_mark_expanded(). It is now possible to merge __cache_was_expanded() into cache_was_expanded() and __cache_mark_expanded() into cache_mark_expanded(). Looks ok to me otherwise, feel free to add: Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH 1/2] module: Fix memory deallocation on error path in move_module()

2025-06-16 Thread Petr Pavlu
On 6/14/25 11:28 PM, Daniel Gomez wrote: >> This seems to be off by one. For instance, if the loop reaches the last >> valid type in mod_mem_type, MOD_INIT_RODATA, and successfully allocates >> its memory, the variable t gets set to MOD_INIT_RODATA. Subsequently, if >> an error occurs later in move

Re: [PATCH 3/3] kunit: test: Drop CONFIG_MODULE ifdeffery

2025-06-17 Thread Petr Pavlu
On 6/12/25 4:53 PM, Thomas Weißschuh wrote: > The function stubs exposed by module.h allow the code to compile properly > without the ifdeffery. The generated object code stays the same, as the > compiler can optimize away all the dead code. > As the code is still typechecked developer errors can b

Re: [PATCH 1/3] module: move 'struct module_use' to internal.h

2025-06-17 Thread Petr Pavlu
re, so the structure can be made internal. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH] alloc_tag: remove empty module tag section

2025-06-17 Thread Petr Pavlu
On 6/10/25 6:22 PM, Casey Chen wrote: > The empty MOD_CODETAG_SECTIONS() macro added an incomplete .data > section in module linker script, which caused symbol lookup tools > like gdb to misinterpret symbol addresses e.g., __ib_process_cq > incorrectly mapping to unrelated functions like below. >

Re: [PATCH 1/2] module: Fix memory deallocation on error path in move_module()

2025-06-08 Thread Petr Pavlu
On 6/7/25 6:16 PM, Petr Pavlu wrote: > The function move_module() uses the variable t to track how many memory > types it has allocated and consequently how many should be freed if an > error occurs. > > The variable is initially set to 0 and is updated when a call to > m

Re: [PATCH v2] module: Make sure relocations are applied to the per-CPU section

2025-06-05 Thread Petr Pavlu
On 6/5/25 8:07 AM, Sebastian Andrzej Siewior wrote: > The per-CPU data section is handled differently than the other sections. > The memory allocations requires a special __percpu pointer and then the > section is copied into the view of each CPU. Therefore the SHF_ALLOC > flag is removed to ensure

Re: [PATCH] module: make __mod_device_table__* symbols static

2025-06-04 Thread Petr Pavlu
e in the global scope, we would worry about the symbol > uniqueness, but modpost is fine with parsing multiple symbols with the > same name. > > Signed-off-by: Masahiro Yamada Reviewed-by: Petr Pavlu -- Thanks, Petr

Re: [PATCH v2] module: Make sure relocations are applied to the per-CPU section

2025-06-05 Thread Petr Pavlu
On 6/5/25 5:54 PM, Sebastian Andrzej Siewior wrote: > On 2025-06-05 15:44:23 [+0200], Petr Pavlu wrote: >> Isn't this broken earlier by "Don't relocate non-allocated regions in >> modules." >> (pre-Git, [1])? > > Looking further back into the histo

[PATCH 0/2] module: Fix memory deallocation on error path in move_module()

2025-06-07 Thread Petr Pavlu
The first patch is an actual fix. The second patch is a minor related cleanup. Petr Pavlu (2): module: Fix memory deallocation on error path in move_module() module: Avoid unnecessary return value initialization in move_module() kernel/module/main.c | 9 + 1 file changed, 5

[PATCH 2/2] module: Avoid unnecessary return value initialization in move_module()

2025-06-07 Thread Petr Pavlu
All error conditions in move_module() set the return value by updating the ret variable. Therefore, it is not necessary to the initialize the variable when declaring it. Remove the unnecessary initialization. Signed-off-by: Petr Pavlu --- kernel/module/main.c | 2 +- 1 file changed, 1

[PATCH 1/2] module: Fix memory deallocation on error path in move_module()

2025-06-07 Thread Petr Pavlu
underlying type. Fixes: c7ee8aebf6c0 ("module: add stop-grap sanity check on module memcpy()") Signed-off-by: Petr Pavlu --- kernel/module/main.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 08b59c37735e..322b38c0a

Re: [PATCH 1/2] module: Fix memory deallocation on error path in move_module()

2025-06-12 Thread Petr Pavlu
On 6/10/25 8:51 PM, Daniel Gomez wrote: > On 07/06/2025 18.16, Petr Pavlu wrote: >> The function move_module() uses the variable t to track how many memory >> types it has allocated and consequently how many should be freed if an >> error occurs. >> >> The vari

Re: [PATCH 2/3] module: make structure definitions always visible

2025-07-08 Thread Petr Pavlu
On 7/7/25 9:11 PM, Daniel Gomez wrote: > On 12/06/2025 16.53, Thomas WeiÃschuh wrote: >> To write code that works with both CONFIG_MODULES=y and CONFIG_MODULES=n >> it is convenient to use "if (IS_ENABLED(CONFIG_MODULES))" over raw #ifdef. >> The code will still fully typechecked but the unreachabl

Re: [PATCH 2/3] module: make structure definitions always visible

2025-07-08 Thread Petr Pavlu
On 6/12/25 4:53 PM, Thomas Weißschuh wrote: > To write code that works with both CONFIG_MODULES=y and CONFIG_MODULES=n > it is convenient to use "if (IS_ENABLED(CONFIG_MODULES))" over raw #ifdef. > The code will still fully typechecked but the unreachable parts are > discarded by the compiler. This

Re: [PATCH] MAINTAINERS: update Daniel Gomez's role and email address

2025-07-08 Thread Petr Pavlu
/lore.kernel.org/linux-modules/z3gdanpla3sze...@bombadil.infradead.org [5] Signed-off-by: Daniel Gomez """ You can update the patch on modules-next, no need to resend. Acked-by: Petr Pavlu -- Thanks Petr

[PATCH 2/5] module: Remove unnecessary +1 from last_unloaded_module::name size

2025-06-30 Thread Petr Pavlu
an extra byte. Fixes: e14af7eeb47e ("debug: track and print last unloaded module in the oops trace") Signed-off-by: Petr Pavlu --- kernel/module/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 93

[PATCH 0/5] module: Fix minor problems related to MODULE_NAME_LEN

2025-06-30 Thread Petr Pavlu
Fix a few minor problems related to MODULE_NAME_LEN and MAX_PARAM_PREFIX_LEN, and clean up their usage. Petr Pavlu (5): module: Prevent silent truncation of module name in delete_module(2) module: Remove unnecessary +1 from last_unloaded_module::name size module: Restore the moduleparam

[PATCH 3/5] module: Restore the moduleparam prefix length check

2025-06-30 Thread Petr Pavlu
quot;[PATCH] Compile-time check re world-writeable module params"). This comment was related to the test variable __param_perm_check_##name, which was removed in the previously mentioned commit 58f86cc89c33. Fixes: 58f86cc89c33 ("VERIFY_OCTAL_PERMISSIONS: stricter checking for sysfs perms.&q

[PATCH 5/5] module: Rename MAX_PARAM_PREFIX_LEN to __MODULE_NAME_LEN

2025-06-30 Thread Petr Pavlu
n terms of MAX_PARAM_PREFIX_LEN. Rename MAX_PARAM_PREFIX_LEN to __MODULE_NAME_LEN for clarity. This matches the similar approach of defining MODULE_INFO in module.h and __MODULE_INFO in moduleparam.h. Signed-off-by: Petr Pavlu --- include/linux/module.h | 2 +- include/linux/moduleparam.h | 12 +

[PATCH 4/5] tracing: Replace MAX_PARAM_PREFIX_LEN with MODULE_NAME_LEN

2025-06-30 Thread Petr Pavlu
ernel param length at compile time, not runtime") only to break a circular dependency between module.h and moduleparam.h, and should mostly be limited to use in moduleparam.h. Signed-off-by: Petr Pavlu Cc: Steven Rostedt Cc: Masami Hiramatsu --- As a side note, I suspect the function mod

[PATCH 1/5] module: Prevent silent truncation of module name in delete_module(2)

2025-06-30 Thread Petr Pavlu
uch a case. Update the syscall to return ENOENT, as documented in the delete_module(2) man page to mean "No module by that name exists." This is appropriate because a module with a name longer than MODULE_NAME_LEN cannot be loaded in the first place. Signed-off-by: Petr Pavlu --- kerne

Re: [PATCH] module: pr_debug when there is no version info

2025-07-22 Thread Petr Pavlu
On 7/22/25 5:08 AM, Wang Jinchao wrote: > On 7/21/25 22:40, Petr Pavlu wrote: >> On 7/21/25 6:52 AM, Wang Jinchao wrote: >>> When there is no version information, modprobe and insmod only >>> report "invalid format". >>> Print the actual cause to

Re: [PATCH] module: pr_debug when there is no version info

2025-07-21 Thread Petr Pavlu
On 7/21/25 6:52 AM, Wang Jinchao wrote: > When there is no version information, modprobe and insmod only > report "invalid format". > Print the actual cause to make it easier to diagnose the issue. > This helps developers quickly identify version-related module > loading failures. > Signed-off-by:

Re: [PATCH 3/5] module: Restore the moduleparam prefix length check

2025-07-21 Thread Petr Pavlu
On 7/17/25 9:23 PM, Daniel Gomez wrote: > On 30/06/2025 16.32, Petr Pavlu wrote: >> The moduleparam code allows modules to provide their own definition of >> MODULE_PARAM_PREFIX, instead of using the default KBUILD_MODNAME ".". >> >> Commit 730b69d22525 (

<    1   2