mbox series

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

Message ID 20250306131430.7016-1-petr.pavlu@suse.com (mailing list archive)
Headers show
Series module: Make .static_call_sites read-only after init | expand

Message

Petr Pavlu March 6, 2025, 1:13 p.m. UTC
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.

Changes since v1 [1]:
* Rebase the patches. 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.pavlu@suse.com/

Petr Pavlu (3):
  module: Constify parameters of module_enforce_rwx_sections()
  module: Add a separate function to mark sections as read-only after
    init
  module: Make .static_call_sites read-only after init

 kernel/module/internal.h   |  7 ++++--
 kernel/module/main.c       | 18 +++------------
 kernel/module/strict_rwx.c | 47 ++++++++++++++++++++++++++++++++++++--
 3 files changed, 53 insertions(+), 19 deletions(-)


base-commit: 848e076317446f9c663771ddec142d7c2eb4cb43

Comments

Luis Chamberlain March 6, 2025, 5:16 p.m. UTC | #1
On Thu, Mar 06, 2025 at 02:13:51PM +0100, 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 modifications.
> 
> Changes since v1 [1]:
> * Rebase the patches. 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.pavlu@suse.com/

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>

  Luis