Re: [PATCH v8 2/3] modpost: Produce extended MODVERSIONS information

2024-11-21 Thread Matthew Maurer
On Thu, Nov 7, 2024 at 2:38 PM Luis Chamberlain wrote: > > On Wed, Nov 06, 2024 at 02:19:38PM -0800, Matthew Maurer wrote: > > > > > > > If booted against an old kernel, it will > > > > behave as though there is no modversions information. > > >

Re: [PATCH v8 2/3] modpost: Produce extended MODVERSIONS information

2024-11-18 Thread Matthew Maurer
> Thinking about this some more, if we're going down enabling a new > option, it seems to beg the question if the old *two* ksymtab sections > could just be folded into the a new one where the "gpl only" thing > becomes just one "column" as you call it. Reasons I ask, it seems like > we're duplicat

Re: [PATCH v8 1/3] modules: Support extended MODVERSIONS info

2024-11-07 Thread Matthew Maurer
Adding Lucas DeMarchi to the thread after voicing an interest in the modpost patch. On Thu, Oct 31, 2024 at 12:49 AM Luis Chamberlain wrote: > > On Wed, Oct 30, 2024 at 10:06:12PM -0700, Matthew Maurer wrote: > > On Wed, Oct 30, 2024 at 9:37 PM Luis Chamberlain wrote: > > >

Re: [PATCH v8 2/3] modpost: Produce extended MODVERSIONS information

2024-11-07 Thread Matthew Maurer
On Wed, Nov 6, 2024 at 10:27 PM Lucas De Marchi wrote: > > On Wed, Nov 06, 2024 at 02:19:38PM -0800, Matthew Maurer wrote: > >> > >> > If booted against an old kernel, it will > >> > behave as though there is no modversions information. > >> > &g

Re: [PATCH v8 2/3] modpost: Produce extended MODVERSIONS information

2024-11-06 Thread Matthew Maurer
> > > If booted against an old kernel, it will > > behave as though there is no modversions information. > > Huh? This I don't get. If you have the new libkmod and boot > an old kernel, that should just not break becauase well, long > symbols were not ever supported properly anyway, so no regressio

Re: [PATCH v8 2/3] modpost: Produce extended MODVERSIONS information

2024-11-05 Thread Matthew Maurer
On Fri, Nov 1, 2024 at 2:10 PM Luis Chamberlain wrote: > > On Thu, Oct 31, 2024 at 01:00:28PM -0700, Matthew Maurer wrote: > > > The question is, if only extended moversions are used, what new tooling > > > requirements are there? Can you test using only extended modvers

Re: [PATCH v8 2/3] modpost: Produce extended MODVERSIONS information

2024-10-31 Thread Matthew Maurer
> The question is, if only extended moversions are used, what new tooling > requirements are there? Can you test using only extended modversions? > > Luis I'm not sure precisely what you're asking for. Do you want: 1. A kconfig that suppresses the emission of today's MODVERSIONS format? This wou

Re: [PATCH v8 1/3] modules: Support extended MODVERSIONS info

2024-10-30 Thread Matthew Maurer
On Wed, Oct 30, 2024 at 9:37 PM Luis Chamberlain wrote: > > On Thu, Oct 31, 2024 at 12:22:36PM +1100, Michael Ellerman wrote: > > Matthew Maurer writes: > > > Adds a new format for MODVERSIONS which stores each field in a separate > > > ELF section. This initi

[PATCH v8 3/3] rust: Use gendwarfksyms + extended modversions for CONFIG_MODVERSIONS

2024-10-30 Thread Matthew Maurer
selecting both features. Signed-off-by: Sami Tolvanen Co-developed-by: Matthew Maurer Signed-off-by: Matthew Maurer --- init/Kconfig | 3 ++- rust/Makefile | 33 +++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/init/Kconfig b/init/Kconfig

[PATCH v8 2/3] modpost: Produce extended MODVERSIONS information

2024-10-30 Thread Matthew Maurer
appropriately encoded in the extended section. These symbols will be skipped in the previous encoding. An error will still be generated if CONFIG_EXTENDED_MODVERSIONS is not set. Reviewed-by: Sami Tolvanen Signed-off-by: Matthew Maurer --- kernel/module/Kconfig| 10 scripts

[PATCH v8 1/3] modules: Support extended MODVERSIONS info

2024-10-30 Thread Matthew Maurer
usage of this information. Reviewed-by: Sami Tolvanen Signed-off-by: Matthew Maurer --- arch/powerpc/kernel/module_64.c | 24 ++- kernel/module/internal.h| 11 + kernel/module/main.c| 92 + kernel/module/version.c

[PATCH v8 0/3] Extended MODVERSIONS Support

2024-10-30 Thread Matthew Maurer
;s suggestion. v2: https://lore.kernel.org/all/20231118025748.2778044-1-mmau...@google.com/ - Add loading/verification refactor before modifying, per Luis's request v1: https://lore.kernel.org/rust-for-linux/20231115185858.2110875-1-mmau...@google.com/ -- 2.47.0.rc1.288.g06298d15

[PATCH v2] scripts: Remove export_report.pl

2024-10-30 Thread Matthew Maurer
der to list *.o instead of *.ko"). Both of these changes sat for years with no reports. Rather than reviving this script as we make further changes to `.mod.c`, this patch gets rid of it because it is clearly unused. Signed-off-by: Matthew Maurer --- Changes in v2: - Remove references to export_

[PATCH] scripts: Remove export_report.pl

2024-10-29 Thread Matthew Maurer
der to list *.o instead of *.ko"). Both of these changes sat for years with no reports. Rather than reviving this script as we make further changes to `.mod.c`, this patch gets rid of it because it is clearly unused. Signed-off-by: Matthew Maurer --- scripts/ex

Re: [PATCH v7 1/3] modules: Support extended MODVERSIONS info

2024-10-25 Thread Matthew Maurer
> Sorry I realise it's version 7, but although the above looks correct it's > kind of dense. > > I think the below would also work and is (I think) easier to follow, and > is more obviously similar to the existing code. I'm sure your version is > faster, but I don't think it's that performance crit

[PATCH v7 0/3] Extended MODVERSIONS Support

2024-10-22 Thread Matthew Maurer
efore modifying, per Luis's request v1: https://lore.kernel.org/rust-for-linux/20231115185858.2110875-1-mmau...@google.com/ Matthew Maurer (5): export_report: Rehabilitate script modules: Support extended MODVERSIONS info export_report: Tolerate additional `.mod.c` content

[PATCH v7 3/3] rust: Use gendwarfksyms + extended modversions for CONFIG_MODVERSIONS

2024-10-22 Thread Matthew Maurer
selecting both features. Signed-off-by: Sami Tolvanen Co-developed-by: Matthew Maurer Signed-off-by: Matthew Maurer --- init/Kconfig | 3 ++- rust/Makefile | 32 ++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index

[PATCH v7 2/3] modpost: Produce extended MODVERSIONS information

2024-10-22 Thread Matthew Maurer
appropriately encoded in the extended section. These symbols will be skipped in the previous encoding. An error will still be generated if CONFIG_EXTENDED_MODVERSIONS is not set. Signed-off-by: Matthew Maurer --- kernel/module/Kconfig| 10 scripts/Makefile.modpost | 1 + scripts/mod

[PATCH v7 1/3] modules: Support extended MODVERSIONS info

2024-10-22 Thread Matthew Maurer
usage of this information. Signed-off-by: Matthew Maurer --- arch/powerpc/kernel/module_64.c | 24 ++- kernel/module/internal.h| 11 + kernel/module/main.c| 92 + kernel/module/version.c | 45 4

Re: [PATCH v5 14/16] modules: Support extended MODVERSIONS info

2024-10-15 Thread Matthew Maurer
So, the basic things I can think of to test here are: 1. The kernel can still load the previous MODVERSIONS format 2. The kernel can load the new MODVERSIONS format 3. If we artificially tweak a CRC in the previous format, it will fail to load. 4. If we artificially tweak a CRC in the new format,

[PATCH v6 5/5] export_report: Use new version info format

2024-10-15 Thread Matthew Maurer
final module is controlled by conditional compilation inside the at file. Signed-off-by: Matthew Maurer --- scripts/export_report.pl | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/scripts/export_report.pl b/scripts/export_report.pl index dcef915

[PATCH v6 4/5] modpost: Produce extended MODVERSIONS information

2024-10-15 Thread Matthew Maurer
appropriately encoded in the extended section. These symbols will be skipped in the previous encoding. An error will still be generated if CONFIG_EXTENDED_MODVERSIONS is not set. Signed-off-by: Matthew Maurer --- kernel/module/Kconfig | 8 scripts/mod/modpost.c | 41

[PATCH v6 3/5] export_report: Tolerate additional `.mod.c` content

2024-10-15 Thread Matthew Maurer
rk for the subsequent extended modversions information, which would not be parseable otherwise. Signed-off-by: Matthew Maurer --- scripts/export_report.pl | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 30b5f7819086..dc

[PATCH v6 2/5] modules: Support extended MODVERSIONS info

2024-10-15 Thread Matthew Maurer
usage of this information. Signed-off-by: Matthew Maurer --- arch/powerpc/kernel/module_64.c | 23 - kernel/module/internal.h| 11 kernel/module/main.c| 92 ++--- kernel/module/version.c | 45 4 files changed

[PATCH v6 1/5] export_report: Rehabilitate script

2024-10-15 Thread Matthew Maurer
...@socionext.com/ Signed-off-by: Matthew Maurer --- scripts/export_report.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/export_report.pl b/scripts/export_report.pl index feb3d5542a62..30b5f7819086 100755 --- a/scripts/export_report.pl +++ b/scripts

[PATCH v6 0/5] Extended MODVERSIONS Support

2024-10-15 Thread Matthew Maurer
ing, per Luis's request v1: https://lore.kernel.org/rust-for-linux/20231115185858.2110875-1-mmau...@google.com/ Matthew Maurer (5): export_report: Rehabilitate script modules: Support extended MODVERSIONS info export_report: Tolerate additional `.mod.c` content modpost: Produce extended MODVERSI

[PATCH 12/12] module: Reformat struct for code style

2024-10-15 Thread Matthew Maurer
Using commas to declare struct members makes adding new members to this struct not as nice with patch management. Signed-off-by: Matthew Maurer --- kernel/module/internal.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/module/internal.h b/kernel/module

[PATCH 11/12] module: Additional validation in elf_validity_cache_strtab

2024-10-15 Thread Matthew Maurer
e while reading). * All symbols names are inbounds of the string table. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 38 +- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 22aa5eb4e4f

[PATCH 10/12] module: Factor out elf_validity_cache_strtab

2024-10-15 Thread Matthew Maurer
This patch only moves the existing strtab population to a function. Validation comes in a following patch, this is split out to make the new validation checks more clearly separated. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 23 --- 1 file changed, 20

[PATCH 09/12] module: Group section index calculations together

2024-10-15 Thread Matthew Maurer
Group all the index detection together to make the parent function easier to read. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 68 +--- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/kernel/module/main.c b/kernel/module

[PATCH 08/12] module: Factor out elf_validity_cache_index_str

2024-10-15 Thread Matthew Maurer
Pull out index validation for the symbol string section. Note that this does not validate the *contents* of the string table, only shape and presence of the section. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 37 - 1 file changed, 28 insertions

[PATCH 07/12] module: Factor out elf_validity_cache_index_sym

2024-10-15 Thread Matthew Maurer
Centralize symbol table detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 73 ++-- 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index b633347d5d98

[PATCH 06/12] module: Factor out elf_validity_cache_index_mod

2024-10-15 Thread Matthew Maurer
Centralize .gnu.linkonce.this_module detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 129 ++- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index

[PATCH 05/12] module: Factor out elf_validity_cache_index_info

2024-10-15 Thread Matthew Maurer
Centralize .modinfo detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 82 1 file changed, 68 insertions(+), 14 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 473f1fb25de2

[PATCH 04/12] module: Factor out elf_validity_cache_secstrings

2024-10-15 Thread Matthew Maurer
w checked prior to the access, which could avoid bad accesses with malformed modules. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 106 --- 1 file changed, 69 insertions(+), 37 deletions(-) diff --git a/kernel/module/main.c b/k

[PATCH 03/12] module: Factor out elf_validity_cache_sechdrs

2024-10-15 Thread Matthew Maurer
Factor out and document the validation of section headers. Because we now validate all section offsets and lengths before accessing them, we can remove the ad-hoc checks. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 125 --- 1 file changed

[PATCH 02/12] module: Factor out elf_validity_ehdr

2024-10-15 Thread Matthew Maurer
Factor out verification of the ELF header and document what is checked. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 70 +--- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index

[PATCH 01/12] module: Take const arg in validate_section_offset

2024-10-15 Thread Matthew Maurer
`validate_section_offset` doesn't modify the info passed in. Make this clear by adjusting the type signature. Signed-off-by: Matthew Maurer --- 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 ef54733

[PATCH 00/12] Module Validation Refactor

2024-10-15 Thread Matthew Maurer
://lore.kernel.org/all/20240925233854.90072-1-mmau...@google.com/ Matthew Maurer (12): module: Take const arg in validate_section_offset module: Factor out elf_validity_ehdr module: Factor out elf_validity_cache_sechdrs module: Factor out elf_validity_cache_secstrings module: Factor out

Re: [PATCH v5 14/16] modules: Support extended MODVERSIONS info

2024-10-11 Thread Matthew Maurer
On Fri, Oct 11, 2024 at 3:22 PM Luis Chamberlain wrote: > > On Wed, Sep 25, 2024 at 11:38:29PM +, Matthew Maurer wrote: > > Adds a new format for MODVERSIONS which stores each field in a separate > > ELF section. This initially adds support for variable length names, but

Re: [PATCH v5 13/16] export_report: Rehabilitate script

2024-10-11 Thread Matthew Maurer
On Fri, Oct 11, 2024 at 3:13 PM Luis Chamberlain wrote: > > On Wed, Sep 25, 2024 at 11:38:28PM +, Matthew Maurer wrote: > > * modules.order has .o files when in a build dir, support this > > The commit log is not clear, is it that it's always had *.o files, and > y

Re: [PATCH v4 14/16] modules: Support extended MODVERSIONS info

2024-09-25 Thread Matthew Maurer
Thanks for the catch. I've sent up v5 to include that fix. I've also added a changelog and made sure the patches make it to linux-modules@ as Daniel suggested. On Wed, Sep 25, 2024 at 4:00 PM Sami Tolvanen wrote: > > Hi Matt, > > On Tue, Sep 24, 2024 at 09:19:56PM +

[PATCH v5 16/16] export_report: Use new version info format

2024-09-25 Thread Matthew Maurer
The new version info format has a superset of symbols in the old format. Since this is a tool for in-tree modules, we don't need to parse the old one with this tool any longer. Signed-off-by: Matthew Maurer --- scripts/export_report.pl | 22 ++ 1 file changed, 10 inser

[PATCH v5 15/16] modpost: Produce extended modversion information

2024-09-25 Thread Matthew Maurer
Generate both the existing modversions format and the new extended one when running modpost. We no longer generate an error on long symbols in modpost, as they can now be appropriately encoded in the extended section. These symbols will be skipped in the previous encoding. Signed-off-by: Matthew

[PATCH v5 14/16] modules: Support extended MODVERSIONS info

2024-09-25 Thread Matthew Maurer
usage of this information. Signed-off-by: Matthew Maurer --- arch/powerpc/kernel/module_64.c | 23 - kernel/module/internal.h| 11 kernel/module/main.c| 92 ++--- kernel/module/version.c | 45 4 files changed

[PATCH v5 13/16] export_report: Rehabilitate script

2024-09-25 Thread Matthew Maurer
* modules.order has .o files when in a build dir, support this * .mod.c source layout has changed, update regexes to match * Add a stage 3, to be more robust against additional .mod.c content Signed-off-by: Matthew Maurer --- scripts/export_report.pl | 9 +++-- 1 file changed, 7 insertions

[PATCH v5 12/16] module: Reformat struct for code style

2024-09-25 Thread Matthew Maurer
Using commas to declare struct members makes adding new members to this struct not as nice with patch management. Signed-off-by: Matthew Maurer --- kernel/module/internal.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/module/internal.h b/kernel/module

[PATCH v5 11/16] module: Additional validation in elf_validity_cache_strtab

2024-09-25 Thread Matthew Maurer
e while reading). * All symbols names are inbounds of the string table. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 38 +- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index c082d5d41a8

[PATCH v5 10/16] module: Factor out elf_validity_cache_strtab

2024-09-25 Thread Matthew Maurer
This patch only moves the existing strtab population to a function. Validation comes in a following patch, this is split out to make the new validation checks more clearly separated. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 23 --- 1 file changed, 20

[PATCH v5 09/16] module: Group section index calculations together

2024-09-25 Thread Matthew Maurer
Group all the index detection together to make the parent function easier to read. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 68 +--- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/kernel/module/main.c b/kernel/module

[PATCH v5 08/16] module: Factor out elf_validity_cache_index_str

2024-09-25 Thread Matthew Maurer
Pull out index validation for the symbol string section. Note that this does not validate the *contents* of the string table, only shape and presence of the section. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 37 - 1 file changed, 28 insertions

[PATCH v5 07/16] module: Factor out elf_validity_cache_index_sym

2024-09-25 Thread Matthew Maurer
Centralize symbol table detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 73 ++-- 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index ec638187ffcf

[PATCH v5 06/16] module: Factor out elf_validity_cache_index_mod

2024-09-25 Thread Matthew Maurer
Centralize .gnu.linkonce.this_module detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 129 ++- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index

[PATCH v5 05/16] module: Factor out elf_validity_cache_index_info

2024-09-25 Thread Matthew Maurer
Centralize .modinfo detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 82 1 file changed, 68 insertions(+), 14 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 6a9159afca02

[PATCH v5 04/16] module: Factor out elf_validity_cache_secstrings

2024-09-25 Thread Matthew Maurer
w checked prior to the access, which could avoid bad accesses with malformed modules. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 106 --- 1 file changed, 69 insertions(+), 37 deletions(-) diff --git a/kernel/module/main.c b/k

[PATCH v5 03/16] module: Factor out elf_validity_cache_sechdrs

2024-09-25 Thread Matthew Maurer
Factor out and document the validation of section headers. Because we now validate all section offsets and lengths before accessing them, we can remove the ad-hoc checks. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 125 --- 1 file changed

[PATCH v5 02/16] module: Factor out elf_validity_ehdr

2024-09-25 Thread Matthew Maurer
Factor out verification of the ELF header and document what is checked. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 70 +--- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index

[PATCH v5 01/16] module: Take const arg in validate_section_offset

2024-09-25 Thread Matthew Maurer
`validate_section_offset` doesn't modify the info passed in. Make this clear by adjusting the type signature. Signed-off-by: Matthew Maurer --- 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 49b9bca

[PATCH v5 00/16] Extended MODVERSIONS Support

2024-09-25 Thread Matthew Maurer
025748.2778044-1-mmau...@google.com/ - Add loading/verification refactor before modifying, per Luis's request v1: https://lore.kernel.org/rust-for-linux/20231115185858.2110875-1-mmau...@google.com/ Matthew Maurer (16): module: Take const arg in validate_section_offset module: Factor ou

[PATCH v4 07/16] module: Factor out elf_validity_cache_index_sym

2024-09-24 Thread Matthew Maurer
Centralize symbol table detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 73 ++-- 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index ec638187ffcf

[PATCH v4 14/16] modules: Support extended MODVERSIONS info

2024-09-24 Thread Matthew Maurer
usage of this information. Signed-off-by: Matthew Maurer --- arch/powerpc/kernel/module_64.c | 24 - kernel/module/internal.h| 11 kernel/module/main.c| 92 ++--- kernel/module/version.c | 43 +++ 4 files changed

[PATCH v4 02/16] module: Factor out elf_validity_ehdr

2024-09-24 Thread Matthew Maurer
Factor out verification of the ELF header and document what is checked. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 70 +--- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index

[PATCH v4 09/16] module: Group section index calculations together

2024-09-24 Thread Matthew Maurer
Group all the index detection together to make the parent function easier to read. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 68 +--- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/kernel/module/main.c b/kernel/module

[PATCH v4 12/16] module: Reformat struct for code style

2024-09-24 Thread Matthew Maurer
Using commas to declare struct members makes adding new members to this struct not as nice with patch management. Signed-off-by: Matthew Maurer --- kernel/module/internal.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/module/internal.h b/kernel/module

[PATCH v4 11/16] module: Additional validation in elf_validity_cache_strtab

2024-09-24 Thread Matthew Maurer
e while reading). * All symbols names are inbounds of the string table. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 38 +- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index c082d5d41a8

[PATCH v4 04/16] module: Factor out elf_validity_cache_secstrings

2024-09-24 Thread Matthew Maurer
w checked prior to the access, which could avoid bad accesses with malformed modules. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 106 --- 1 file changed, 69 insertions(+), 37 deletions(-) diff --git a/kernel/module/main.c b/k

[PATCH v4 08/16] module: Factor out elf_validity_cache_index_str

2024-09-24 Thread Matthew Maurer
Pull out index validation for the symbol string section. Note that this does not validate the *contents* of the string table, only shape and presence of the section. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 37 - 1 file changed, 28 insertions

[PATCH v4 01/16] module: Take const arg in validate_section_offset

2024-09-24 Thread Matthew Maurer
`validate_section_offset` doesn't modify the info passed in. Make this clear by adjusting the type signature. Signed-off-by: Matthew Maurer --- 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 49b9bca

[PATCH v4 06/16] module: Factor out elf_validity_cache_index_mod

2024-09-24 Thread Matthew Maurer
Centralize .gnu.linkonce.this_module detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 129 ++- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index

[PATCH v4 10/16] module: Factor out elf_validity_cache_strtab

2024-09-24 Thread Matthew Maurer
This patch only moves the existing strtab population to a function. Validation comes in a following patch, this is split out to make the new validation checks more clearly separated. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 23 --- 1 file changed, 20

[PATCH v4 05/16] module: Factor out elf_validity_cache_index_info

2024-09-24 Thread Matthew Maurer
Centralize .modinfo detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 82 1 file changed, 68 insertions(+), 14 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 6a9159afca02

[PATCH v4 03/16] module: Factor out elf_validity_cache_sechdrs

2024-09-24 Thread Matthew Maurer
Factor out and document the validation of section headers. Because we now validate all section offsets and lengths before accessing them, we can remove the ad-hoc checks. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 125 --- 1 file changed

Re: [PATCH v2 16/19] gendwarfksyms: Add support for reserved structure fields

2024-08-20 Thread Matthew Maurer
> > The way `KAbiReserved` is implemented is via a `union` (maybe a bit > > ironic, considering what I said in my other replies, but in this case, > > we would provide a safe abstraction over this `union`, thus avoiding > > exposing users of this type to `unsafe`): > > > > #[repr(C)] > > pu

Re: [PATCH v3 14/16] modules: Support extended MODVERSIONS info

2024-08-19 Thread Matthew Maurer
On Fri, Aug 16, 2024 at 4:04 PM Michael Ellerman wrote: > > Matthew Maurer writes: > > Adds a new format for MODVERSIONS which stores each field in a separate > > ELF section. This initially adds support for variable length names, but > > could later be used to

[PATCH v3 14/16] modules: Support extended MODVERSIONS info

2024-08-06 Thread Matthew Maurer
usage of this information. Signed-off-by: Matthew Maurer --- arch/powerpc/kernel/module_64.c | 24 - kernel/module/internal.h| 11 kernel/module/main.c| 92 ++--- kernel/module/version.c | 43 +++ 4 files changed

[PATCH v3 12/16] module: Reformat struct for code style

2024-08-06 Thread Matthew Maurer
Using commas to declare struct members makes adding new members to this struct not as nice with patch management. Signed-off-by: Matthew Maurer --- kernel/module/internal.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/module/internal.h b/kernel/module

[PATCH v3 11/16] module: Additional validation in elf_validity_cache_strtab

2024-08-06 Thread Matthew Maurer
e while reading). * All symbols names are inbounds of the string table. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 38 +- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index d70d829b5ab

[PATCH v3 10/16] module: Factor out elf_validity_cache_strtab

2024-08-06 Thread Matthew Maurer
This patch only moves the existing strtab population to a function. Validation comes in a following patch, this is split out to make the new validation checks more clearly separated. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 23 --- 1 file changed, 20

[PATCH v3 09/16] module: Group section index calculations together

2024-08-06 Thread Matthew Maurer
Group all the index detection together to make the parent function easier to read. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 68 +--- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/kernel/module/main.c b/kernel/module

[PATCH v3 08/16] module: Factor out elf_validity_cache_index_str

2024-08-06 Thread Matthew Maurer
Pull out index validation for the symbol string section. Note that this does not validate the *contents* of the string table, only shape and presence of the section. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 37 - 1 file changed, 28 insertions

[PATCH v3 07/16] module: Factor out elf_validity_cache_index_sym

2024-08-06 Thread Matthew Maurer
Centralize symbol table detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 73 ++-- 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 281cc1a7dee6

[PATCH v3 06/16] module: Factor out elf_validity_cache_index_mod

2024-08-06 Thread Matthew Maurer
Centralize .gnu.linkonce.this_module detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 129 ++- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index

[PATCH v3 05/16] module: Factor out elf_validity_cache_index_info

2024-08-06 Thread Matthew Maurer
Centralize .modinfo detection and property validation. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 82 1 file changed, 68 insertions(+), 14 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 252cfa9eee67

[PATCH v3 04/16] module: Factor out elf_validity_cache_secstrings

2024-08-06 Thread Matthew Maurer
w checked prior to the access, which could avoid bad accesses with malformed modules. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 106 --- 1 file changed, 69 insertions(+), 37 deletions(-) diff --git a/kernel/module/main.c b/k

[PATCH v3 03/16] module: Factor out elf_validity_cache_sechdrs

2024-08-06 Thread Matthew Maurer
Factor out and document the validation of section headers. Because we now validate all section offsets and lengths before accessing them, we can remove the ad-hoc checks. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 125 --- 1 file changed

[PATCH v3 02/16] module: Factor out elf_validity_ehdr

2024-08-06 Thread Matthew Maurer
Factor out verification of the ELF header and document what is checked. Signed-off-by: Matthew Maurer --- kernel/module/main.c | 70 +--- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index

[PATCH v3 01/16] module: Take const arg in validate_section_offset

2024-08-06 Thread Matthew Maurer
`validate_section_offset` doesn't modify the info passed in. Make this clear by adjusting the type signature. Signed-off-by: Matthew Maurer --- 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 d959219

Re: [PATCH] kallsyms, livepatch: Fix livepatch with CONFIG_LTO_CLANG

2024-07-09 Thread Matthew Maurer
On Mon, Jul 8, 2024 at 5:07 PM Sami Tolvanen wrote: > > On Mon, Jul 8, 2024 at 2:33 PM Luis Chamberlain wrote: > > > > Looking at this again its not to me why Masahiro Yamada's suggestion on > > that old patch series to just increase the length and put long symbols > > names into its own section

Re: [PATCH v2 0/5] MODVERSIONS + RUST Redux

2023-11-27 Thread Matthew Maurer
> > > > > > > With regards to future directions that likely won't work for loosening > > > > it: > > > > Unfortunately, the .rmeta format itself is not stable, so I wouldn't > > > > want to > > > > teach genksyms to open it up and split out the pieces for specific > > > > functions. > > > > Exte

Re: [PATCH v2 0/5] MODVERSIONS + RUST Redux

2023-11-22 Thread Matthew Maurer
> So, even if you enable CONFIG_MODVERSIONS, > nothing is checked for Rust. > Genksyms computes a CRC from "int foo", and > the module subsystem confirms it is a "int" > variable. > > We know this check always succeeds. > > Why is this useful? The reason this is immediately useful is that it allows

[PATCH v2 3/5] modpost: Extended modversion support

2023-11-17 Thread Matthew Maurer
leading dots, we reproduce the munging for the new format. Other architectures do not appear to have architecture-specific usage of this information. Signed-off-by: Matthew Maurer --- arch/powerpc/kernel/module_64.c | 25 - kernel/module/internal.h| 11 kernel/module/main.c

[PATCH v2 5/5] export_report: Use new version info format

2023-11-17 Thread Matthew Maurer
The new version info format has a superset of symbols in the old format. Since this is a tool for in-tree modules, we don't need to parse the old one with this tool any longer. Signed-off-by: Matthew Maurer --- scripts/export_report.pl | 22 ++ 1 file changed, 10 inser

[PATCH v2 4/5] rust: Allow MODVERSIONS

2023-11-17 Thread Matthew Maurer
With variable length symbol names from extended modversions, we can enable MODVERSIONS alongside RUST due to support for its longer symbol names. Signed-off-by: Matthew Maurer --- init/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index 9ffb103fc927

[PATCH v2 2/5] modules: Refactor + kdoc elf_validity_cached_copy

2023-11-17 Thread Matthew Maurer
o ensure offsets are inbounds of strtab While some of these oversights would normally be worrying, all of the potentially unverified accesses occur after signature check, and only in response to a user who can load a kernel module. Signed-off-by: Matthew Maurer --- kernel/module/internal.h |

[PATCH v2 1/5] export_report: Rehabilitate script

2023-11-17 Thread Matthew Maurer
* modules.order has .o files when in a build dir, support this * .mod.c source layout has changed, update regexes to match * Add a stage 3, to be more robust against additional .mod.c content Signed-off-by: Matthew Maurer --- scripts/export_report.pl | 9 +++-- 1 file changed, 7 insertions

[PATCH v2 0/5] MODVERSIONS + RUST Redux

2023-11-17 Thread Matthew Maurer
the added clarity and checks were valuable. [1] https://lore.kernel.org/lkml/2023061155.1349375-1-g...@garyguo.net/ [2] https://lore.kernel.org/lkml/CAK7LNATsuszFR7JB5ZkqVS1W=hWr9=e7btf+mvgj+nxt3az...@mail.gmail.com/ [3] https://lore.kernel.org/lkml/zvznh%2fpa5hivr...@bombadil.infradead.org/ Matt

[PATCH 2/3] modpost: Extended modversion support

2023-11-15 Thread Matthew Maurer
possible to enable MODVERSIONS and RUST at the same time. Signed-off-by: Matthew Maurer --- arch/powerpc/kernel/module_64.c | 24 +- init/Kconfig| 1 - kernel/module/internal.h| 16 ++- kernel/module/main.c| 9 +++- kernel/module/version.c

[PATCH 3/3] rust: Require RUST_MODULES for module support

2023-11-07 Thread Matthew Maurer
that won't be used without Rust modules. Signed-off-by: Matthew Maurer --- init/Kconfig | 21 + kernel/module/Kconfig | 1 + rust/exports.c| 4 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 9f