Re: [PATCH v13 4/6] rust: module: update the module macro with module parameter support

2025-06-18 Thread Benno Lossin
me}_struct: > +::kernel::module_param::RacyKernelParam = > + > ::kernel::module_param::RacyKernelParam(::kernel::bindings::kernel_param {{ > +name: if cfg!(MODULE) {{ > + >

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-18 Thread Benno Lossin
; @@ -0,0 +1,201 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +//! Support for module parameters. > +//! > +//! C header: > [`include/linux/moduleparam.h`](srctree/include/linux/moduleparam.h) > + > +use crate::prelude::*; > +use crate::str::BStr; > + &g

Re: [PATCH v13 3/6] rust: module: use a reference in macros::module::module

2025-06-18 Thread Benno Lossin
On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: > When we add parameter support to the module macro, we want to be able to > pass a reference to `ModuleInfo` to a helper function. That is not possible > when we move out of the local `modinfo`. So change the function to acc

Re: [PATCH v13 5/6] rust: samples: add a module parameter to the rust_minimal sample

2025-06-18 Thread Benno Lossin
On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: > Showcase the rust module parameter support by adding a module parameter to > the `rust_minimal` sample. > > Signed-off-by: Andreas Hindborg Reviewed-by: Benno Lossin --- Cheers, Benno > --- > samples/rust/ru

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

2025-06-18 Thread Daniel Gomez
_type_t enum > having a signed integer as its underlying type. > > Fixes: c7ee8aebf6c0 ("module: 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,

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

2025-06-18 Thread Daniel Gomez
ed-off-by: Petr Pavlu > Reviewed-by: Sami Tolvanen > --- > kernel/module/main.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/kernel/module/main.c b/kernel/module/main.c > index 9ac994b2f354..7822b91fca6b 100644 > --- a/kernel/module/main.c >

[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

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

2025-06-18 Thread Petr Pavlu
reasons as well, in which case t remains set to 0 and no memory is freed. Fix the problem by initializing t to MOD_MEM_NUM_TYPES. Additionally, make the deallocation loop more robust by not relying on the mod_mem_type_t enum having a signed integer as its underlying type. Fixes: c7ee8aebf6c0 ("m

[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

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

2025-06-17 Thread Daniel Gomez
>> One thing though, we are "releasing" the memory even if we have skipped the >> allocation in the first place. So, I think it would make sense to release >> only >> for the types we have actually allocated. What do you think? > > I noticed this too, specifically because move_module() is inco

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;

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

2025-06-17 Thread Suren Baghdasaryan
On Tue, Jun 17, 2025 at 2:27 AM Petr Pavlu wrote: > > 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 misinterp

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

2025-06-17 Thread Daniel Gomez
> 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] 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 function

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

2025-06-17 Thread Petr Pavlu
On 6/12/25 4:53 PM, Thomas Weißschuh wrote: > The struct was moved to the public header file in > commit c8e21ced08b3 ("module: fix kdb's illicit use of struct module_use."). > Back then the structure was used outside of the module core. > Nowadays this is not true anymo

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

2025-06-16 Thread Petr Pavlu
y earlier suggestion was incorrect. We can simply initialize the memory > type t to MOD_MEM_NUM_TYPES since it's only used in the error path of > module_memory_alloc(). Do you mean the following, or something else: static int move_module(struct module *mod, struct load_i

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

2025-06-14 Thread Daniel Gomez
> 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_module() and control is transferred to > out

[PATCH net-next v3 3/8] netpoll: relocate netconsole-specific functions to netconsole module

2025-06-13 Thread Breno Leitao
Move netpoll_parse_ip_addr() and netpoll_parse_options() from the generic netpoll module to the netconsole module where they are actually used. These functions were originally placed in netpoll but are only consumed by netconsole. This refactoring improves code organization by: - Removing

Re: [PATCH v2 00/62] objtool,livepatch: klp-build livepatch module generation

2025-06-12 Thread Josh Poimboeuf
On Fri, May 09, 2025 at 01:16:24PM -0700, Josh Poimboeuf wrote: > I've tested with a variety of patches on defconfig and Fedora-config > kernels with both GCC and Clang. > > These patches can also be found at: > > git://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git > klp-build-v2

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

2025-06-12 Thread Thomas Weißschuh
The struct was moved to the public header file in commit c8e21ced08b3 ("module: fix kdb's illicit use of struct module_use."). Back then the structure was used outside of the module core. Nowadays this is not true anymore, so the structure can be made internal. Signed-off-by: T

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

2025-06-12 Thread Thomas Weißschuh
MODULE_STATE_COMING,/* Full formed, running module_init. */ @@ -598,6 +587,18 @@ struct module { struct _ddebug_info dyndbg_info; #endif } cacheline_aligned __randomize_layout; + +#ifdef CONFIG_MODULES + +extern int modules_disabled; /* for sysctl */ +/* Get/put a kernel symbol

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

2025-06-12 Thread Thomas Weißschuh
Code using IS_ENABLED(CONFIG_MODULES) as a C expression may need access to the module structure definitions to compile. Make sure these structure definitions are always visible. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (3): module: move 'struct module_use' to

[PATCH v13 3/6] rust: module: use a reference in macros::module::module

2025-06-12 Thread Andreas Hindborg
When we add parameter support to the module macro, we want to be able to pass a reference to `ModuleInfo` to a helper function. That is not possible when we move out of the local `modinfo`. So change the function to access the local via reference rather than value. Signed-off-by: Andreas Hindborg

[PATCH v13 4/6] rust: module: update the module macro with module parameter support

2025-06-12 Thread Andreas Hindborg
Allow module parameters to be declared in the rust `module!` macro. Signed-off-by: Andreas Hindborg --- rust/macros/helpers.rs | 25 +++ rust/macros/lib.rs | 31 + rust/macros/module.rs | 175 ++--- 3 files changed, 221 insertions

[PATCH v13 2/6] rust: introduce module_param module

2025-06-12 Thread Andreas Hindborg
/module_param.rs new file mode 100644 index ..fd167df8e53d --- /dev/null +++ b/rust/kernel/module_param.rs @@ -0,0 +1,201 @@ +// SPDX-License-Identifier: GPL-2.0 + +//! Support for module parameters. +//! +//! C header: [`include/linux/moduleparam.h`](srctree/include/linux/moduleparam.h) + +use

[PATCH v13 5/6] rust: samples: add a module parameter to the rust_minimal sample

2025-06-12 Thread Andreas Hindborg
Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Signed-off-by: Andreas Hindborg --- samples/rust/rust_minimal.rs | 10 ++ 1 file changed, 10 insertions(+) diff --git a/samples/rust/rust_minimal.rs b/samples/rust/rust_minimal.rs

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

2025-06-12 Thread Andreas Hindborg
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` branch [1]. Link: https://github.com/Rust-for-Linux/linux

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-12 Thread Andreas Hindborg
; +/// Parse a token stream of the form `expected_name: "value",` and return >>>> the >>>> +/// string in the position of "value". >>>> +/// >>>> +/// # Panics >>>> +/// >>>> +/// - On parse error. >>>>

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

2025-06-12 Thread Petr Pavlu
test it by directly inserting errors in move_module(). > >> >> Fix the problem by setting t to MOD_MEM_NUM_TYPES after all memory types >> have been allocated. Additionally, make the deallocation loop more robust >> by not relying on the mod_mem_type_t enum having a signed intege

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-12 Thread Benno Lossin
cs >>> +/// >>> +/// - On parse error. >>> +pub(crate) fn expect_string_field(it: &mut token_stream::IntoIter, >>> expected_name: &str) -> String { >>> +assert_eq!(expect_ident(it), expected_name); >>> +assert_eq!(expect_punct(it

[PATCH net-next v2 3/7] netpoll: relocate netconsole-specific functions to netconsole module

2025-06-11 Thread Breno Leitao
Move netpoll_parse_ip_addr() and netpoll_parse_options() from the generic netpoll module to the netconsole module where they are actually used. These functions were originally placed in netpoll but are only consumed by netconsole. This refactoring improves code organization by: - Removing

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-11 Thread Andreas Hindborg
"Miguel Ojeda" writes: > On Wed, Jun 11, 2025 at 2:24 PM Andreas Hindborg > wrote: >> >> So either we need to `#[allow(missing_docs)]` or just add the line back. >> What do you prefer? > > Do you mean if you remove the `concat!` too, right? Yes, all of it. > > It would need to be `expect`, b

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-11 Thread Miguel Ojeda
On Wed, May 7, 2025 at 1:23 PM Benno Lossin wrote: > > > +unsafe extern "C" fn set_param( > > +val: *const kernel::ffi::c_char, > > +param: *const crate::bindings::kernel_param, > > +) -> core::ffi::c_int New instance of `core::ffi::` (and both these `c_*` should be unqualified). Cheers,

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-11 Thread Miguel Ojeda
On Wed, Jun 11, 2025 at 2:24 PM Andreas Hindborg wrote: > > So either we need to `#[allow(missing_docs)]` or just add the line back. What > do you prefer? Do you mean if you remove the `concat!` too, right? It would need to be `expect`, but I think even an `expect(missing_docs)` is not really u

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-11 Thread Andreas Hindborg
Andreas Hindborg writes: > "Benno Lossin" writes: > >> On Tue May 6, 2025 at 3:02 PM CEST, Andreas Hindborg wrote: >>> Add support for module parameters to the `module!` macro. Implement read >>> only support for integer types without `sysfs` suppo

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-11 Thread Andreas Hindborg
"Benno Lossin" writes: > On Tue May 6, 2025 at 3:02 PM CEST, Andreas Hindborg wrote: >> Add support for module parameters to the `module!` macro. Implement read >> only support for integer types without `sysfs` support. >> >> Acked-by: Petr Pavlu # from mod

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

2025-06-10 Thread Daniel Gomez
ed-off-by: Petr Pavlu Reviewed-by: Daniel Gomez > --- > 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 322b38c0a782..06511607075c 100644 > --- a/kernel/module/main.c > +++ b/kernel

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

2025-06-10 Thread Daniel Gomez
ocated. Additionally, make the deallocation loop more robust > by not relying on the mod_mem_type_t enum having a signed integer as its > underlying type. > > Fixes: c7ee8aebf6c0 ("module: add stop-grap sanity check on module memcpy()") > Signed-off-by: Petr Pavlu > --- > ker

[PATCH] alloc_tag: remove empty module tag section

2025-06-10 Thread Casey Chen
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. (gdb) disas __ib_process_cq Dump of

[PATCH net-next 3/7] netpoll: relocate netconsole-specific functions to netconsole module

2025-06-10 Thread Breno Leitao
Move netpoll_parse_ip_addr() and netpoll_parse_options() from the generic netpoll module to the netconsole module where they are actually used. These functions were originally placed in netpoll but are only consumed by netconsole. This refactoring improves code organization by: - Removing

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

2025-06-10 Thread Sebastian Andrzej Siewior
initial per-cpu support for modules. The relocation > handling at that point appears correct to me. I think it's the mentioned patch > "Don't relocate non-allocated regions in modules" that broke it. Ach, it ignores that bit. Okay then. > It seems logical to me

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

2025-06-09 Thread Sami Tolvanen
; > 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 322b38c0a782..06511607075c 100644 > --- a/kernel/module/main.c > +++ b/kernel/mod

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

2025-06-09 Thread Sami Tolvanen
to MOD_MEM_NUM_TYPES after all memory types > > have been allocated. Additionally, make the deallocation loop more robust > > by not relying on the mod_mem_type_t enum having a signed integer as its > > underlying type. > > > > Fixes: c7ee8aebf6c0 ("module: add stop-gr

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

2025-06-08 Thread Petr Pavlu
robust > by not relying on the mod_mem_type_t enum having a signed integer as its > 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 c

[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

[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 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

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

2025-06-05 Thread Masahiro Yamada
On Wed, Jun 4, 2025 at 5:50 PM Petr Pavlu wrote: > > On 6/2/25 12:55 PM, Masahiro Yamada wrote: > > The __mod_device_table__* symbols are only parsed by modpost to generate > > MODULE_ALIAS() entries from MODULE_DEVICE_TABLE(). > > > > Therefore, these symbols do not need to be globally visible, o

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

2025-06-05 Thread Petr Pavlu
.sh_flags &= ~(unsigned long)SHF_ALLOC; > + } > > so this looks like the origin. This patch added the initial per-cpu support for modules. The relocation handling at that point appears correct to me. I think it's the mentioned patch "Don't relocate non-alloc

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

2025-06-05 Thread Sebastian Andrzej Siewior
dralign); + if (!mod->percpu) { + err = -ENOMEM; + goto free_mod; + } + sechdrs[pcpuindex].sh_flags &= ~(unsigned long)SHF_ALLOC; + } so this looks like the origin. … > > --- a/kernel/module/main.c > > +++ b/kernel/

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

2025-06-05 Thread Peter Zijlstra
On Thu, Jun 05, 2025 at 03:44:23PM +0200, Petr Pavlu wrote: > For instance: > > /* >* Don't bother with non-allocated sections. >* >* An exception is the percpu section, which has separate allocations >* for individual CPUs. We relocate the percpu section in

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

2025-06-05 Thread Petr Pavlu
or the per-CPU section (if found) after > move_module(). > > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-lkp/202506041623.e45e4f7d-...@intel.com > Fixes: 8d8022e8aba85 ("module: do percpu allocation after uniqueness check. > No, really!") Isn't

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

2025-06-04 Thread Sebastian Andrzej Siewior
e4f7d-...@intel.com Fixes: 8d8022e8aba85 ("module: do percpu allocation after uniqueness check. No, really!") Signed-off-by: Sebastian Andrzej Siewior --- v1…v2: https://lore.kernel.org/all/20250604152707.cied9...@linutronix.de/ - Add the flag back only on SMP if the per-CPU section was

Re: [PATCH v2 42/62] kbuild,x86: Fix module permissions for __jump_table and __bug_table

2025-06-04 Thread Josh Poimboeuf
e and must remain writable. While > > > SHF_WRITE is ignored by vmlinux, it's still needed for modules. > > > > > > To work around the linker interference, remove SHF_WRITE during > > > compilation and restore it after linking the module. > > > &

Re: [PATCH v2 42/62] kbuild,x86: Fix module permissions for __jump_table and __bug_table

2025-06-04 Thread Josh Poimboeuf
modules. > > > > To work around the linker interference, remove SHF_WRITE during > > compilation and restore it after linking the module. > > *groan* > > This and the following patches marking a whole bunch of sections M, > seems to suggest you're going to rely o

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

2025-06-04 Thread Sebastian Andrzej Siewior
e4f7d-...@intel.com Fixes: 8d8022e8aba85 ("module: do percpu allocation after uniqueness check. No, really!") Signed-off-by: Sebastian Andrzej Siewior --- kernel/module/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/module/main.c b/kernel/module/main.c inde

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

2025-06-04 Thread Petr Pavlu
On 6/2/25 12:55 PM, Masahiro Yamada wrote: > The __mod_device_table__* symbols are only parsed by modpost to generate > MODULE_ALIAS() entries from MODULE_DEVICE_TABLE(). > > Therefore, these symbols do not need to be globally visible, or globally > unique. > > If they are in the global scope, we

Re: [PATCH] kbuild: stop module name mangling

2025-06-02 Thread Lucas De Marchi
: characters such as commas (,) and hyphens (-) are not allowed in C identifiers, so they were replaced with underscores (_) in Kbuild. Since commit f83b5e323f57 ("kbuild: set correct KBUILD_MODNAME when using well known kernel symbols as module names"), KBUILD_MODNAME has been passed to C a

Re: [PATCH] kbuild: stop module name mangling

2025-06-02 Thread Masahiro Yamada
ens (-) are not allowed in C identifiers, so they were replaced > with underscores (_) in Kbuild. > > Since commit f83b5e323f57 ("kbuild: set correct KBUILD_MODNAME when > using well known kernel symbols as module names"), KBUILD_MODNAME has > been passed to C as a string literal

[PATCH] kbuild: stop module name mangling

2025-06-02 Thread Masahiro Yamada
Kbuild. Since commit f83b5e323f57 ("kbuild: set correct KBUILD_MODNAME when using well known kernel symbols as module names"), KBUILD_MODNAME has been passed to C as a string literal, which allows any characters. Aside from this historical behavior in the build system, there is no longe

[PATCH] module: make __mod_device_table__* symbols static

2025-06-02 Thread Masahiro Yamada
/module.h +++ b/include/linux/module.h @@ -249,8 +249,8 @@ struct module_kobject *lookup_or_create_module_kobject(const char *name); #ifdef MODULE /* Creates an alias so file2alias.c can find device table. */ #define MODULE_DEVICE_TABLE(type, name) \ -extern

Re: [PATCH v4 1/2] livepatch, x86/module: Generalize late module relocation locking.

2025-05-28 Thread Dylan Hatch
lly considered this. From what I can tell, kprobe is the only non-arch-specific code that takes this mutex when touching kernel text. Though my understanding of kprobe is very limited, I think there could be a risk due to the late relocations for livepatch: Suppose I apply a livepatch 'L' that

Re: [PATCH v4 1/2] livepatch, x86/module: Generalize late module relocation locking.

2025-05-27 Thread Petr Mladek
On Thu 2025-05-22 20:52:04, Dylan Hatch wrote: > Late module relocations are an issue on any arch that supports > livepatch, so move the text_mutex locking to the livepatch core code. > > Signed-off-by: Dylan Hatch > Acked-by: Song Liu > --- > arch/x86/kernel/module.c |

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

2025-05-27 Thread Petr Pavlu
On 5/22/25 09:17, Masahiro Yamada wrote: > When MODULE_IMPORT_NS() is missing, "make nsdeps" runs the Coccinelle > script to automatically add MODULE_IMPORT_NS() to each module. > > This should not occur for users of EXPORT_SYMBOL_GPL_FOR_MODULES(), which > is intende

Re: [PATCH v2 42/62] kbuild,x86: Fix module permissions for __jump_table and __bug_table

2025-05-26 Thread Peter Zijlstra
licitly forbids combining with SHF_MERGE. > > Those sections are modified at runtime and must remain writable. While > SHF_WRITE is ignored by vmlinux, it's still needed for modules. > > To work around the linker interference, remove SHF_WRITE during > compilation and restor

Re: vmlinux BTF as a module (was Re: [PATCH bpf-next v4 0/3] Allow mmap of /sys/kernel/btf/vmlinux)

2025-05-23 Thread Andrii Nakryiko
On Thu, May 22, 2025 at 6:04 PM Alexei Starovoitov wrote: > > On Wed, May 21, 2025 at 8:00 AM Alan Maguire wrote: > > > > > Hi Alan, > > > > > > Thanks for taking a look at this. I've been following your related effort > > > to allow /s

RE: [PATCH v4 0/2] livepatch, arm64/module: Enable late module relocations.

2025-05-22 Thread Toshiyuki Sato (Fujitsu)
Hi Dylan, > Late relocations (after the module is initially loaded) are needed when > livepatches change module code. This is supported by x86, ppc, and s390. > This series borrows the x86 methodology to reach the same level of support on > arm64, and moves the text-poke locking i

Re: vmlinux BTF as a module (was Re: [PATCH bpf-next v4 0/3] Allow mmap of /sys/kernel/btf/vmlinux)

2025-05-22 Thread Alexei Starovoitov
On Wed, May 21, 2025 at 8:00 AM Alan Maguire wrote: > > > Hi Alan, > > > > Thanks for taking a look at this. I've been following your related effort > > to allow /sys/kernel/btf/vmlinux as a module in support of small systems > > with kernel-size constrain

[PATCH v4 2/2] arm64/module: Use text-poke API for late relocations.

2025-05-22 Thread Dylan Hatch
To enable late module patching, livepatch modules need to be able to apply some of their relocations well after being loaded. In this scenario, use the text-poking API to allow this, even with STRICT_MODULE_RWX. This patch is partially based off commit 88fc078a7a8f6 ("x86/module: Use text

[PATCH v4 1/2] livepatch, x86/module: Generalize late module relocation locking.

2025-05-22 Thread Dylan Hatch
Late module relocations are an issue on any arch that supports livepatch, so move the text_mutex locking to the livepatch core code. Signed-off-by: Dylan Hatch Acked-by: Song Liu --- arch/x86/kernel/module.c | 8 ++-- kernel/livepatch/core.c | 18 +- 2 files changed, 15

[PATCH v4 0/2] livepatch, arm64/module: Enable late module relocations.

2025-05-22 Thread Dylan Hatch
Late relocations (after the module is initially loaded) are needed when livepatches change module code. This is supported by x86, ppc, and s390. This series borrows the x86 methodology to reach the same level of support on arm64, and moves the text-poke locking into the core livepatch code to

Re: [PATCH v3 2/2] arm64/module: Use text-poke API for late relocations.

2025-05-22 Thread Dylan Hatch
On Thu, May 22, 2025 at 11:43 AM Dylan Hatch wrote: > -static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int > len) > +static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int > len, > + struct module *me) > {

Re: [PATCH v3 1/2] livepatch, x86/module: Generalize late module relocation locking.

2025-05-22 Thread Song Liu
On Thu, May 22, 2025 at 11:43 AM Dylan Hatch wrote: > > Late module relocations are an issue on any arch that supports > livepatch, so move the text_mutex locking to the livepatch core code. > > Signed-off-by: Dylan Hatch Acked-by: Song Liu

[PATCH v3 1/2] livepatch, x86/module: Generalize late module relocation locking.

2025-05-22 Thread Dylan Hatch
Late module relocations are an issue on any arch that supports livepatch, so move the text_mutex locking to the livepatch core code. Signed-off-by: Dylan Hatch --- arch/x86/kernel/module.c | 8 ++-- kernel/livepatch/core.c | 18 +- 2 files changed, 15 insertions(+), 11

[PATCH v3 0/2] livepatch, arm64/module: Enable late module relocations.

2025-05-22 Thread Dylan Hatch
Late relocations (after the module is initially loaded) are needed when livepatches change module code. This is supported by x86, ppc, and s390. This series borrows the x86 methodology to reach the same level of support on arm64, and moves the text-poke locking into the core livepatch code to

[PATCH v3 2/2] arm64/module: Use text-poke API for late relocations.

2025-05-22 Thread Dylan Hatch
To enable late module patching, livepatch modules need to be able to apply some of their relocations well after being loaded. In this scenario, use the text-poking API to allow this, even with STRICT_MODULE_RWX. This patch is partially based off commit 88fc078a7a8f6 ("x86/module: Use text

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

2025-05-22 Thread Masahiro Yamada
When MODULE_IMPORT_NS() is missing, "make nsdeps" runs the Coccinelle script to automatically add MODULE_IMPORT_NS() to each module. This should not occur for users of EXPORT_SYMBOL_GPL_FOR_MODULES(), which is intended to export a symbol to a specific module only. In such cases, explici

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

2025-05-21 Thread Masahiro Yamada
On Wed, May 21, 2025 at 9:08 PM Masahiro Yamada wrote: > > I think the patch subject is stale. > > MODULE_ was the prefix in the previous v2 series. > > Now, the prefix part is module: I will apply with the subject fixed, as "MODULE_" prefix does not make sense any

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

2025-05-21 Thread Masahiro Yamada
On Sat, May 17, 2025 at 4:19 PM Masahiro Yamada wrote: > > On Fri, May 2, 2025 at 11:26 PM Peter Zijlstra wrote: > > > > Designate the "module:${modname}" symbol namespace to mean: 'only > > export to the named module'. > > > > Notably

Re: [PATCH 1/1] alloc_tag: handle module codetag load errors as module load failures

2025-05-21 Thread Suren Baghdasaryan
On Wed, May 21, 2025 at 2:04 PM Casey Chen wrote: > > On Wed, May 21, 2025 at 9:06 AM Suren Baghdasaryan wrote: > > > > Failures inside codetag_load_module() are currently ignored. As a > > result an error there would not cause a module load failure and freeing > &g

Re: [PATCH 1/1] alloc_tag: handle module codetag load errors as module load failures

2025-05-21 Thread Casey Chen
On Wed, May 21, 2025 at 9:06 AM Suren Baghdasaryan wrote: > > Failures inside codetag_load_module() are currently ignored. As a > result an error there would not cause a module load failure and freeing > of the associated resources. Correct this behavior by propagating the > er

vmlinux BTF as a module (was Re: [PATCH bpf-next v4 0/3] Allow mmap of /sys/kernel/btf/vmlinux)

2025-05-21 Thread Alan Maguire
> Hi Alan, > > Thanks for taking a look at this. I've been following your related effort > to allow /sys/kernel/btf/vmlinux as a module in support of small systems > with kernel-size constraints, and wondered how this series might affect > that work? Such support would

[PATCH 1/1] alloc_tag: handle module codetag load errors as module load failures

2025-05-21 Thread Suren Baghdasaryan
Failures inside codetag_load_module() are currently ignored. As a result an error there would not cause a module load failure and freeing of the associated resources. Correct this behavior by propagating the error code to the caller and handling possible errors. With this change, error to allocate

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

2025-05-21 Thread Masahiro Yamada
I think the patch subject is stale. MODULE_ was the prefix in the previous v2 series. Now, the prefix part is module: On Fri, May 2, 2025 at 11:25 PM Peter Zijlstra wrote: > > Instead of only accepting "module:${name}", extend it with a comma > separated list of module name

Re: [PATCH v2] module: release codetag section when module load fails

2025-05-19 Thread Suren Baghdasaryan
On Mon, May 19, 2025 at 9:46 AM Suren Baghdasaryan wrote: > > On Mon, May 19, 2025 at 9:38 AM David Wang <00107...@163.com> wrote: > > > > When module load fails after memory for codetag section is ready, > > codetag section memory will not be properly released. Th

Re: [PATCH v2] module: release codetag section when module load fails

2025-05-19 Thread Suren Baghdasaryan
On Mon, May 19, 2025 at 9:38 AM David Wang <00107...@163.com> wrote: > > When module load fails after memory for codetag section is ready, > codetag section memory will not be properly released. This > causes memory leak, and if next module load happens to get the > same mo

[PATCH v2] module: release codetag section when module load fails

2025-05-19 Thread David Wang
When module load fails after memory for codetag section is ready, codetag section memory will not be properly released. This causes memory leak, and if next module load happens to get the same module address, codetag may pick the uninitialized section when manipulating tags during module unload

Re: [PATCH] module: release codetag section when module load fails

2025-05-19 Thread David Wang
At 2025-05-20 00:03:16, "Suren Baghdasaryan" wrote: >On Sun, May 18, 2025 at 3:12 AM David Wang <00107...@163.com> wrote: >> >> When module load failed after memory for codetag sections ready, > >nit: s/ready/is ready > >> codetag section memory wa

Re: [PATCH] module: release codetag section when module load fails

2025-05-19 Thread Suren Baghdasaryan
On Sun, May 18, 2025 at 3:12 AM David Wang <00107...@163.com> wrote: > > When module load failed after memory for codetag sections ready, nit: s/ready/is ready > codetag section memory was not properly released. This > causes memory leak, and if next module load happens

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

2025-05-19 Thread Joel Granados
On Thu, May 15, 2025 at 02:45:22PM +0200, Petr Pavlu wrote: > 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_disab

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

2025-05-18 Thread Petr Pavlu
plicitly limiting the usage of certain exports, the abuse >>> potential/risk is greatly reduced. >>> >>> Changes since v2: >>> >>> - switch to "module:" prefix (Masahiro) >>> - removed some patch noise (Masahiro) >>> - st

[PATCH] module: release codetag section when module load fails

2025-05-18 Thread David Wang
When module load failed after memory for codetag sections ready, codetag section memory was not properly released. This causes memory leak, and if next module load happens to got the same module address, codetag may pick the uninitialized section when manipulating tags during module unload, and

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

2025-05-17 Thread Masahiro Yamada
On Fri, May 2, 2025 at 11:26 PM Peter Zijlstra wrote: > > Designate the "module:${modname}" symbol namespace to mean: 'only > export to the named module'. > > Notably, explicit imports of anything in the "module:" space is > forbidden. > > Si

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

2025-05-16 Thread Masahiro Yamada
On Fri, May 2, 2025 at 11:26 PM Peter Zijlstra wrote: > > Designate the "module:${modname}" symbol namespace to mean: 'only > export to the named module'. > > Notably, explicit imports of anything in the "module:" space is > forbidden. > >

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

2025-05-16 Thread Masahiro Yamada
t; potential/risk is greatly reduced. > > > > Changes since v2: > > > > - switch to "module:" prefix (Masahiro) > > - removed some patch noise (Masahiro) > > - strstarts() and strlen() usage for prefixes (Masahiro) > > - simpler ___EXPORT_SYMB

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

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

2025-05-15 Thread Joel Granados
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 modprobe_path variable static > > as it no longer

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 lon

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: > > -

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

2025-05-14 Thread Petr Pavlu
On 5/2/25 16:12, Peter Zijlstra wrote: > Helper macro to more easily limit the export of a symbol to a given > list of modules. > > Eg: > > EXPORT_SYMBOL_GPL_FOR_MODULES(preempt_notifier_inc, "kvm"); > > will limit the use of said function to kvm.ko, any

  1   2   3   4   5   6   7   8   9   10   >