| 085c5e37 | 08-Mar-2025 |
Thorsten Blum <[email protected]> |
module: Remove unnecessary size argument when calling strscpy()
The size parameter is optional and strscpy() automatically determines the length of the destination buffer using sizeof() if the argum
module: Remove unnecessary size argument when calling strscpy()
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-off-by: Thorsten Blum <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| d593e0ca | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Use RCU in all users of __module_text_address().
__module_text_address() can be invoked within a RCU section, there is no requirement to have preemption disabled.
Replace the preempt_disabl
module: Use RCU in all users of __module_text_address().
__module_text_address() can be invoked within a RCU section, there is no requirement to have preemption disabled.
Replace the preempt_disable() section around __module_text_address() with RCU.
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| 6593a2c9 | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Use RCU in all users of __module_address().
__module_address() can be invoked within a RCU section, there is no requirement to have preemption disabled.
Replace the preempt_disable() sectio
module: Use RCU in all users of __module_address().
__module_address() can be invoked within a RCU section, there is no requirement to have preemption disabled.
Replace the preempt_disable() section around __module_address() with RCU.
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| 2abf84f6 | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Use RCU in search_module_extables().
search_module_extables() returns an exception_table_entry belonging to a module. The lookup via __module_address() can be performed with RCU protection.
module: Use RCU in search_module_extables().
search_module_extables() returns an exception_table_entry belonging to a module. The lookup via __module_address() can be performed with RCU protection. The returned exception_table_entry remains valid because the passed address usually belongs to a module that is currently executed. So the module can not be removed because "something else" holds a reference to it, ensuring that it can not be removed. Exceptions here are: - kprobe, acquires a reference on the module beforehand - MCE, invokes the function from within a timer and the RCU lifetime guarantees (of the timer) are sufficient.
Therefore it is safe to return the exception_table_entry outside the RCU section which provided the module.
Use RCU for the lookup in search_module_extables() and update the comment.
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| 7d9dda6f | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Allow __module_address() to be called from RCU section.
mod_find() uses either the modules list to find a module or a tree lookup (CONFIG_MODULES_TREE_LOOKUP). The list and the tree can both
module: Allow __module_address() to be called from RCU section.
mod_find() uses either the modules list to find a module or a tree lookup (CONFIG_MODULES_TREE_LOOKUP). The list and the tree can both be iterated under RCU assumption (as well as RCU-sched).
Remove module_assert_mutex_or_preempt() from __module_address() and entirely since __module_address() is the last user. Update comments.
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| 2ff49f89 | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Use RCU in find_symbol().
module_assert_mutex_or_preempt() is not needed in find_symbol(). The function checks for RCU-sched or the module_mutex to be acquired. The list_for_each_entry_rcu()
module: Use RCU in find_symbol().
module_assert_mutex_or_preempt() is not needed in find_symbol(). The function checks for RCU-sched or the module_mutex to be acquired. The list_for_each_entry_rcu() below does the same check.
Remove module_assert_mutex_or_preempt() from try_add_tainted_module(). Use RCU protection to invoke find_symbol() and update callers.
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| 435bbcc3 | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Remove module_assert_mutex_or_preempt() from try_add_tainted_module().
module_assert_mutex_or_preempt() is not needed in try_add_tainted_module(). The function checks for RCU-sched or the mo
module: Remove module_assert_mutex_or_preempt() from try_add_tainted_module().
module_assert_mutex_or_preempt() is not needed in try_add_tainted_module(). The function checks for RCU-sched or the module_mutex to be acquired. The list_for_each_entry_rcu() below does the same check.
Remove module_assert_mutex_or_preempt() from try_add_tainted_module().
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| c4fadf38 | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Use RCU in module_get_kallsym().
The modules list and module::kallsyms can be accessed under RCU assumption.
Iterate the modules with RCU protection, use rcu_dereference() to access the kal
module: Use RCU in module_get_kallsym().
The modules list and module::kallsyms can be accessed under RCU assumption.
Iterate the modules with RCU protection, use rcu_dereference() to access the kallsyms pointer.
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| f0136923 | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Use RCU in find_kallsyms_symbol().
The modules list and module::kallsyms can be accessed under RCU assumption.
Use rcu_dereference() to reference the kallsyms pointer in find_kallsyms_symbo
module: Use RCU in find_kallsyms_symbol().
The modules list and module::kallsyms can be accessed under RCU assumption.
Use rcu_dereference() to reference the kallsyms pointer in find_kallsyms_symbol(). Use a RCU section instead of preempt_disable in callers of find_kallsyms_symbol(). Keep the preempt-disable in module_address_lookup() due to __module_address().
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| 039de468 | 08-Jan-2025 |
Sebastian Andrzej Siewior <[email protected]> |
module: Use proper RCU assignment in add_kallsyms().
add_kallsyms() assigns the RCU pointer module::kallsyms and setups the structures behind it which point to init-data. The module was not publishe
module: Use proper RCU assignment in add_kallsyms().
add_kallsyms() assigns the RCU pointer module::kallsyms and setups the structures behind it which point to init-data. The module was not published yet, nothing can see the kallsyms pointer and the data behind it. Also module's init function was not yet invoked. There is no need to use rcu_dereference() here, it is just to keep checkers quiet. The whole RCU read section is also not needed.
Use a local kallsyms pointer and setup the data structures. Assign that pointer to the data structure at the end via rcu_assign_pointer().
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| f3b93547 | 16-Oct-2024 |
Thorsten Leemhuis <[email protected]> |
module: sign with sha512 instead of sha1 by default
Switch away from using sha1 for module signing by default and use the more modern sha512 instead, which is what among others Arch, Fedora, RHEL, a
module: sign with sha512 instead of sha1 by default
Switch away from using sha1 for module signing by default and use the more modern sha512 instead, which is what among others Arch, Fedora, RHEL, and Ubuntu are currently using for their kernels.
Sha1 has not been considered secure against well-funded opponents since 2005[1]; since 2011 the NIST and other organizations furthermore recommended its replacement[2]. This is why OpenSSL on RHEL9, Fedora Linux 41+[3], and likely some other current and future distributions reject the creation of sha1 signatures, which leads to a build error of allmodconfig configurations:
80A20474797F0000:error:03000098:digital envelope routines:do_sigver_init:invalid digest:crypto/evp/m_sigver.c:342: make[4]: *** [.../certs/Makefile:53: certs/signing_key.pem] Error 1 make[4]: *** Deleting file 'certs/signing_key.pem' make[4]: *** Waiting for unfinished jobs.... make[3]: *** [.../scripts/Makefile.build:478: certs] Error 2 make[2]: *** [.../Makefile:1936: .] Error 2 make[1]: *** [.../Makefile:224: __sub-make] Error 2 make[1]: Leaving directory '...' make: *** [Makefile:224: __sub-make] Error 2
This change makes allmodconfig work again and sets a default that is more appropriate for current and future users, too.
Link: https://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html [1] Link: https://csrc.nist.gov/projects/hash-functions [2] Link: https://fedoraproject.org/wiki/Changes/OpenSSLDistrustsha1SigVer [3] Signed-off-by: Thorsten Leemhuis <[email protected]> Reviewed-by: Sami Tolvanen <[email protected]> Tested-by: kdevops <[email protected]> [0] Link: https://github.com/linux-kdevops/linux-modules-kpd/actions/runs/11420092929/job/31775404330 [0] Link: https://lore.kernel.org/r/52ee32c0c92afc4d3263cea1f8a1cdc809728aff.1729088288.git.linux@leemhuis.info Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| 110b1e07 | 05-Dec-2024 |
Christophe Leroy <[email protected]> |
module: Don't fail module loading when setting ro_after_init section RO failed
Once module init has succeded it is too late to cancel loading. If setting ro_after_init data section to read-only fail
module: Don't fail module loading when setting ro_after_init section RO failed
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.
Reported-by: Thomas Gleixner <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Fixes: d1909c022173 ("module: Don't ignore errors from set_memory_XX()") Signed-off-by: Christophe Leroy <[email protected]> Reviewed-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/d6c81f38da76092de8aacc8c93c4c65cb0fe48b8.1733427536.git.christophe.leroy@csgroup.eu Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|
| 097fd001 | 05-Dec-2024 |
Christophe Leroy <[email protected]> |
module: Split module_enable_rodata_ro()
module_enable_rodata_ro() is called twice, once before module init to set rodata sections readonly and once after module init to set rodata_after_init section
module: Split module_enable_rodata_ro()
module_enable_rodata_ro() is called twice, once before module init to set rodata sections readonly and once after module init to set rodata_after_init section readonly.
The second time, only the rodata_after_init section needs to be set to read-only, no need to re-apply it to already set rodata.
Split module_enable_rodata_ro() in two.
Signed-off-by: Christophe Leroy <[email protected]> Tested-by: Daniel Gomez <[email protected]> Reviewed-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/e3b6ff0df7eac281c58bb02cecaeb377215daff3.1733427536.git.christophe.leroy@csgroup.eu Signed-off-by: Petr Pavlu <[email protected]>
show more ...
|