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

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

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

[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

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

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

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

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

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

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

[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

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

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

[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

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

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

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

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 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: [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 -v2 0/7] module: Strict per-modname namespaces

2025-02-05 Thread Petr Pavlu
On 12/16/24 17:43, Petr Pavlu wrote: > 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 >> poten

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

  1   2   >