mbox series

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

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

Message

Petr Pavlu Dec. 23, 2024, 9:37 a.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.

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

Comments

Christophe Leroy Jan. 3, 2025, 2:06 p.m. UTC | #1
Hi Petr,

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 read-only after module initialization to avoid any
> (non-)accidental modifications.
> 
> 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(-)
> 
> 

We have a problem at the moment with ro_after_init sections, isn't it 
better to fix it before adding new stuff to ro_after_init ?

This series conflicts with my series which aims at fixing up 
ro_after_init handling in modules, see 
https://patchwork.kernel.org/project/linux-modules/cover/cover.1733427536.git.christophe.leroy@csgroup.eu/

I was expecting my series to land in modules-next, do you or Luis plan 
to take it anytime soon ?

Christophe
Petr Pavlu Jan. 3, 2025, 4:24 p.m. UTC | #2
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 read-only after module initialization to avoid any
>> (non-)accidental modifications.
>>
>> 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(-)
>>
>>
> 
> We have a problem at the moment with ro_after_init sections, isn't it 
> better to fix it before adding new stuff to ro_after_init ?
> 
> This series conflicts with my series which aims at fixing up 
> ro_after_init handling in modules, see 
> https://patchwork.kernel.org/project/linux-modules/cover/cover.1733427536.git.christophe.leroy@csgroup.eu/

Sure, this is a fairly minor change to keep what the modules loader does
in sync with how the same .static_call_sites data in vmlinux is handled.
It can wait.

> I was expecting my series to land in modules-next, do you or Luis plan 
> to take it anytime soon ?

Sorry for the lack of clarity. I've been waiting with applying that
series as there was still some discussion. I have now replied in its
thread [1].

[1] https://lore.kernel.org/linux-modules/f0e892c7-43cd-4310-9d60-1d6e839f5bb2@suse.com/