[PATCH v3] virtio: reject shm region if length is zero

2025-05-11 Thread Sami
From: Sami Uddin Prevent usage of shared memory regions where the length is zero, as such configurations are not valid and may lead to unexpected behavior. Signed-off-by: Sami Uddin --- v3: - Use idiomatic 'if (!region->len)' as suggested by reviewer v2: - Fixed coding style issue

[PATCH v2] virtio: reject shm region if length is zero

2025-05-11 Thread Sami
From: Sami Uddin Prevent usage of shared memory regions where the length is zero, as such configurations are not valid and may lead to unexpected behavior. Signed-off-by: Sami Uddin --- v2: - Fixed coding style issue: added space after 'if' statement include/linux/virtio_config.h

[PATCH] virtio: reject shm region if length is zero

2025-05-11 Thread Sami
From: Sami Uddin Prevent usage of shared memory regions where the length is zero, as such configurations are not valid and may lead to unexpected behavior. Signed-off-by: Sami Uddin --- include/linux/virtio_config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux

[PATCH v3 5/5] Documentation/kbuild: Add new gendwarfksyms kABI rules

2025-05-07 Thread Sami Tolvanen
Document the "byte_size" and "type_string" kABI stability rules. Signed-off-by: Sami Tolvanen --- Documentation/kbuild/gendwarfksyms.rst | 97 -- 1 file changed, 92 insertions(+), 5 deletions(-) diff --git a/Documentation/kbuild/gendwarfksyms.rst b/

[PATCH v3 2/5] gendwarfksyms: Add a kABI rule to override byte_size attributes

2025-05-07 Thread Sami Tolvanen
iginal and therefore, won't change versions for symbols that reference the changed structure. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c| 14 - scripts/gendwarfksyms/examples/kabi.h| 7 +++ scripts/gendwarfksym

[PATCH v3 4/5] Documentation/kbuild: Drop section numbers

2025-05-07 Thread Sami Tolvanen
Change the gendwarfksyms documentation to use proper chapter, section, and subsection adornments instead of fragile section numbers. Suggested-by: Masahiro Yamada Signed-off-by: Sami Tolvanen --- Documentation/kbuild/gendwarfksyms.rst | 44 +- 1 file changed, 22

[PATCH v3 3/5] gendwarfksyms: Add a kABI rule to override type strings

2025-05-07 Thread Sami Tolvanen
lating versions. Suggested-by: Giuliano Procida Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/examples/kabi.h| 14 ++- scripts/gendwarfksyms/examples/kabi_ex.c | 5 + scripts/gendwarfksyms/examples/kabi_ex.h | 79 - scripts/gendwarfk

[PATCH v3 1/5] gendwarfksyms: Clean up kABI rule look-ups

2025-05-07 Thread Sami Tolvanen
Reduce code duplication by moving kABI rule look-ups to separate functions. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/kabi.c | 101 +++ 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/scripts/gendwarfksyms

[PATCH v3 0/5] gendwarfksyms: Add more kABI rules

2025-05-07 Thread Sami Tolvanen
used for version calculation. Sami --- v3: - Added a patch to drop documentation section numbers based on Masahiro's suggestion. v2: https://lore.kernel.org/r/20250505212401.3379699-6-samitolva...@google.com/ - Cleaned up type string parsing based on Petr's feedback. v1: https://lo

Re: [PATCH v2 4/4] Documentation/kbuild: Add new gendwarfksyms kABI rules

2025-05-07 Thread Sami Tolvanen
;ll send v3 that drops the section numbers. Sami

[PATCH v2 4/4] Documentation/kbuild: Add new gendwarfksyms kABI rules

2025-05-05 Thread Sami Tolvanen
Document byte_size and type_string kABI stability rules. Also fix the section numbers while we're at it. Signed-off-by: Sami Tolvanen --- Documentation/kbuild/gendwarfksyms.rst | 103 +++-- 1 file changed, 95 insertions(+), 8 deletions(-) diff --git a/Documentation/k

[PATCH v2 3/4] gendwarfksyms: Add a kABI rule to override type strings

2025-05-05 Thread Sami Tolvanen
lating versions. Suggested-by: Giuliano Procida Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/examples/kabi.h| 14 ++- scripts/gendwarfksyms/examples/kabi_ex.c | 5 + scripts/gendwarfksyms/examples/kabi_ex.h | 79 - scripts/gendwarfksyms/gendwarfksyms.h

[PATCH v2 2/4] gendwarfksyms: Add a kABI rule to override byte_size attributes

2025-05-05 Thread Sami Tolvanen
iginal and therefore, won't change versions for symbols that reference the changed structure. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c| 14 - scripts/gendwarfksyms/examples/kabi.h| 7 +++ scripts/gendwarfksym

[PATCH v2 1/4] gendwarfksyms: Clean up kABI rule look-ups

2025-05-05 Thread Sami Tolvanen
Reduce code duplication by moving kABI rule look-ups to separate functions. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/kabi.c | 101 +++ 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/scripts/gendwarfksyms

[PATCH v2 0/4] gendwarfksyms: Add more kABI rules

2025-05-05 Thread Sami Tolvanen
used for version calculation. Sami --- v2: - Cleaned up type string parsing based on Petr's feedback. v1: https://lore.kernel.org/r/20250430214049.2658716-6-samitolva...@google.com/ --- Sami Tolvanen (4): gendwarfksyms: Clean up kABI rule look-ups gendwarfksyms: Add a kABI rule t

Re: [PATCH 3/4] gendwarfksyms: Add a kABI rule to override type strings

2025-05-05 Thread Sami Tolvanen
Hi Petr, On Mon, May 5, 2025 at 5:17 AM Petr Pavlu wrote: > > On 4/30/25 23:40, Sami Tolvanen wrote: > > +static void type_parse(const char *name, const char *str, > > +struct type_expansion *type) > > +{ > > + char *fragment; > > +

[PATCH 3/4] gendwarfksyms: Add a kABI rule to override type strings

2025-04-30 Thread Sami Tolvanen
lating versions. Suggested-by: Giuliano Procida Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/examples/kabi.h| 14 ++- scripts/gendwarfksyms/examples/kabi_ex.c | 5 + scripts/gendwarfksyms/examples/kabi_ex.h | 79 - scripts/gendwarfksyms/gendwarfksyms.h

[PATCH 2/4] gendwarfksyms: Add a kABI rule to override byte_size attributes

2025-04-30 Thread Sami Tolvanen
iginal and therefore, won't change versions for symbols that reference the changed structure. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/dwarf.c| 14 - scripts/gendwarfksyms/examples/kabi.h| 7 +++ scripts/gendwarfksyms/examples/kabi_ex.c | 2 ++ scrip

[PATCH 4/4] Documentation/kbuild: Add new gendwarfksyms kABI rules

2025-04-30 Thread Sami Tolvanen
Document byte_size and type_string kABI stability rules. Also fix the section numbers while we're at it. Signed-off-by: Sami Tolvanen --- Documentation/kbuild/gendwarfksyms.rst | 103 +++-- 1 file changed, 95 insertions(+), 8 deletions(-) diff --git a/Documentation/k

[PATCH 0/4] gendwarfksyms: Add more kABI rules

2025-04-30 Thread Sami Tolvanen
used for version calculation. Sami --- Sami Tolvanen (4): gendwarfksyms: Clean up kABI rule look-ups gendwarfksyms: Add a kABI rule to override byte_size attributes gendwarfksyms: Add a kABI rule to override type strings Documentation/kbuild: Add new gendwarfksyms kABI rules Document

[PATCH 1/4] gendwarfksyms: Clean up kABI rule look-ups

2025-04-30 Thread Sami Tolvanen
Reduce code duplication by moving kABI rule look-ups to separate functions. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/kabi.c | 101 +++ 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/scripts/gendwarfksyms/kabi.c b/scripts

[PATCH v2] kbuild: Require pahole v1.29 with GENDWARFKSYMS on X86

2025-04-10 Thread Sami Tolvanen
e module [$module] BTF: -22 As the issue occurs in pahole v1.28 and the fix was merged after v1.29 was released, require pahole v1.29 when GENDWARFKSYMS is enabled with DEBUG_INFO_BTF on X86. Reported-by: Paolo Pisati Signed-off-by: Sami Tolvanen --- Changes in v2: - Also allow pahole 129

Re: [PATCH] kbuild: Require pahole >v1.29 with GENDWARFKSYMS and BTF on X86

2025-04-07 Thread Sami Tolvanen
Hi Masahiro, On Sun, Apr 6, 2025 at 1:21 PM Masahiro Yamada wrote: > > On Fri, Mar 21, 2025 at 8:28 AM Sami Tolvanen wrote: > > > > With CONFIG_GENDWARFKSYMS, __gendwarfksyms_ptr variables are added > > to the kernel in EXPORT_SYMBOL() to ensure DWARF type informat

[PATCH] kbuild: Require pahole >v1.29 with GENDWARFKSYMS and BTF on X86

2025-03-27 Thread Sami Tolvanen
on was merged after v1.29 was released, so later versions of pahole shouldn't have this issue. Require pahole >v1.29 when GENDWARFKSYMS is enabled with DEBUG_INFO_BTF on X86. Reported-by: Paolo Pisati Signed-off-by: Sami Tolvanen --- kernel/module/Kconfig | 4 1 file changed, 4 i

Re: [PATCH v2 3/3] module: Make .static_call_sites read-only after init

2025-03-12 Thread Sami Tolvanen
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 à 14:13, Petr Pavlu a écrit : > >>> Section .static_call_sites hold

Re: [PATCH v2 3/3] module: Make .static_call_sites read-only after init

2025-03-06 Thread Sami Tolvanen
ns in the module linker script feels cleaner than having an array of section names in the code. To be fair, I think this code predates v5.10, where scripts/module.lds.S was first added. Sami

[PATCH] gendwarfksyms: Add a separate pass to resolve FQNs

2025-02-03 Thread Sami Tolvanen
ild with gendwarfksyms and Rust is 14.8% faster with this patch applied on my test system. Without Rust, there's still a 10.4% improvement in build time when gendwarfksyms is used. Note that symbol versions are unchanged with this patch. Suggested-by: Giuliano Procida Signed-off-by:

Re: [syzbot] linux-next build error (19)

2025-01-30 Thread Sami Tolvanen
em, I assume libdw-dev would be required to build with CONFIG_GENDWARFKSYMS. Sami

Re: Unaligned accesses when loading modules

2025-01-14 Thread Sami Tolvanen
ou're testing with something newer? $ hppa64-linux-gnu-ld.bfd --version GNU ld (GNU Binutils for Debian) 2.42.50.20240625 $ hppa64-linux-gnu-objdump -h configs.ko | grep -E '(format|this_module)' configs.ko: file format elf64-hppa-linux 17 .gnu.linkonce.this_module 0300 5c50 2**4 Sami

Re: [PATCH v2 28/28] cfi: Use RCU while invoking __module_address().

2025-01-06 Thread Sami Tolvanen
Hi, On Mon, Jan 6, 2025 at 10:00 AM Elliot Berman wrote: > > On Thu, Jan 02, 2025 at 04:24:22PM -0800, Sami Tolvanen wrote: > > Hi Elliot, > > > > On Mon, Dec 30, 2024 at 7:33 PM Elliot Berman > > wrote: > > > > > > On Fri, Dec 20, 2024 at 0

[PATCH v8 01/18] tools: Add gendwarfksyms

2025-01-03 Thread Sami Tolvanen
Add a basic DWARF parser, which uses libdw to traverse the debugging information in an object file and looks for functions and variables. In follow-up patches, this will be expanded to produce symbol versions for CONFIG_MODVERSIONS from DWARF. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu

[PATCH v8 18/18] Documentation/kbuild: Add DWARF module versioning

2025-01-03 Thread Sami Tolvanen
Add documentation for gendwarfksyms changes, and the kABI stability features that can be useful for distributions even though they're not used in mainline kernels. Signed-off-by: Sami Tolvanen --- Documentation/kbuild/gendwarfksyms.rst | 308 + Documentation/k

[PATCH v8 17/18] kbuild: Add gendwarfksyms as an alternative to genksyms

2025-01-03 Thread Sami Tolvanen
When MODVERSIONS is enabled, allow selecting gendwarfksyms as the implementation, but default to genksyms. Signed-off-by: Sami Tolvanen --- kernel/module/Kconfig | 22 ++ scripts/Makefile | 2 +- scripts/Makefile.build | 35 +-- 3

[PATCH v8 16/18] export: Add __gendwarfksyms_ptr_ references to exported symbols

2025-01-03 Thread Sami Tolvanen
igned-off-by: Sami Tolvanen --- include/linux/export.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/include/linux/export.h b/include/linux/export.h index 2633df4d31e6..a8c23d945634 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -52,9 +52,24 @@

[PATCH v8 14/18] gendwarfksyms: Add support for reserved and ignored fields

2025-01-03 Thread Sami Tolvanen
truct { int b; int v; }; }; Here gendwarfksyms --stable replaces the union with the type of the placeholder field when calculating versions. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c

[PATCH v8 12/18] gendwarfksyms: Add symbol versioning

2025-01-03 Thread Sami Tolvanen
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 --- scripts/gendwarfksyms/Makefile| 2 +- scripts/gendwarfksyms/dwarf.c | 25

[PATCH v8 15/18] gendwarfksyms: Add support for symbol type pointers

2025-01-03 Thread Sami Tolvanen
xternal_symbol); Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 55 +- scripts/gendwarfksyms/examples/symbolptr.c | 33 + scripts/gendwarfksyms/gendwarfksyms.h | 7 +++ scripts/gendwarfksyms/symbols.c

[PATCH v8 08/18] gendwarfksyms: Expand structure types

2025-01-03 Thread Sami Tolvanen
type { base_type u8 byte_size(1) encoding(7) } data_ptr data_member_location(0) , member base_type usize byte_size(8) encoding(7) length data_member_location(8) } byte_size(16) alignment(8) msg ) -> base_type void Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu ---

[PATCH v8 13/18] gendwarfksyms: Add support for kABI rules

2025-01-03 Thread Sami Tolvanen
umerator values when calculating versions. This may be needed when the last field of the enum is used as a sentinel and new fields must be added before it. Add examples for using the rules under the examples/ directory. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/Makefile

[PATCH v8 10/18] gendwarfksyms: Add die_map debugging

2025-01-03 Thread Sami Tolvanen
Debugging the DWARF processing can be somewhat challenging, so add more detailed debugging output for die_map operations. Add the --dump-die-map flag, which adds color coded tags to the output for die_map changes. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms

[PATCH v8 11/18] gendwarfksyms: Add symtypes output

2025-01-03 Thread Sami Tolvanen
references are wrapped in single quotes. E.g.: s#'core::result::Result' 2. The actual type definition is the simple parsed DWARF format we output with --dump-dies, not the preprocessed C-style format genksyms produces. Signed-off-by: Sami Tolvanen Reviewed-by:

[PATCH v8 09/18] gendwarfksyms: Limit structure expansion

2025-01-03 Thread Sami Tolvanen
t the ABI. Consider type definitions in .c files to be declarations to prevent opaque types from changing symbol versions. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/cache.c | 51 +++ sc

[PATCH v8 07/18] gendwarfksyms: Expand array_type

2025-01-03 Thread Sami Tolvanen
(8) } Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c index 7d8a4eb6c387..46ce17b2459b 100644 --- a/scripts

[PATCH v8 06/18] gendwarfksyms: Expand subroutine_type

2025-01-03 Thread Sami Tolvanen
) } } ) -> base_type unsigned long byte_size(8) encoding(7) Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 84 ++- scripts/gendwarfksyms/gendwarfksyms.h | 4 ++ 2 files changed, 85 insertions(+), 3 deletions(-) d

[PATCH v8 04/18] gendwarfksyms: Add a cache for processed DIEs

2025-01-03 Thread Sami Tolvanen
Basic types in DWARF repeat frequently and traversing the DIEs using libdw is relatively slow. Add a simple hashtable based cache for the processed DIEs. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/die.c

[PATCH v8 05/18] gendwarfksyms: Expand type modifiers and typedefs

2025-01-03 Thread Sami Tolvanen
-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/die.c | 12 + scripts/gendwarfksyms/dwarf.c | 67 +++ scripts/gendwarfksyms/gendwarfksyms.h | 5 ++ 3 files changed, 84 insertions(+) diff --git a/scripts/gendwarfksyms/die.c b

[PATCH v8 03/18] gendwarfksyms: Expand base_type

2025-01-03 Thread Sami Tolvanen
variable base_type unsigned long byte_size(8) encoding(7) ... Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 160 ++ 1 file changed, 160 insertions(+) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts

[PATCH v8 02/18] gendwarfksyms: Add address matching

2025-01-03 Thread Sami Tolvanen
d-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/gendwarfksyms.c | 2 + scripts/gendwarfksyms/gendwarfksyms.h | 13 +++ scripts/gendwarfksyms/symbols.c | 161 ++ 3 files changed, 176 insertions(+) diff --git a/scripts/gendwarf

[PATCH v8 00/18] Implement DWARF modversions

2025-01-03 Thread Sami Tolvanen
ps://github.com/samitolvanen/linux/commits/gendwarfksyms-v8 If you also want to test the series with actual Rust modules, this branch adds v13 of Matt's modversion_info series: https://github.com/samitolvanen/linux/commits/rustmodversions-v8 Sami [1] https://lore.kernel.or

Re: [PATCH v2 28/28] cfi: Use RCU while invoking __module_address().

2025-01-02 Thread Sami Tolvanen
esn't use this code since v6.1. > - Your series as-is (no recurisve loop) Note that this patch only adds a comment to is_module_cfi_trap(), so I wouldn't expect a functional change. Sami

Re: [PATCH v2 28/28] cfi: Use RCU while invoking __module_address().

2025-01-02 Thread Sami Tolvanen
rcu_read_lock() will introduce the regression that > > has been fixed in commit 14c4c8e41511a ("cfi: Use > > rcu_read_{un}lock_sched_notrace"). > > > > Cc: Elliot Berman > > Cc: Kees Cook > > Cc: Nathan Chancellor > > Cc: Sami Tolvanen &g

Re: [PATCH v7 02/18] gendwarfksyms: Add address matching

2025-01-02 Thread Sami Tolvanen
Hi, On Sat, Dec 28, 2024 at 4:29 PM Masahiro Yamada wrote: > > On Fri, Dec 20, 2024 at 6:07 AM Sami Tolvanen wrote: > > > > diff --git a/scripts/gendwarfksyms/symbols.c > > b/scripts/gendwarfksyms/symbols.c > > index 7adf2ed9b89b..98febb524dd5 100644 > > -

Re: [PATCH v7 01/18] tools: Add gendwarfksyms

2025-01-02 Thread Sami Tolvanen
Hi Masahiro, On Fri, Dec 27, 2024 at 6:02 AM Masahiro Yamada wrote: > > On Fri, Dec 20, 2024 at 6:07 AM Sami Tolvanen wrote: > > > +int main(int argc, char **argv) > > +{ > > + unsigned int n; > > + int opt; > > + > > + st

[PATCH v7 18/18] Documentation/kbuild: Add DWARF module versioning

2024-12-19 Thread Sami Tolvanen
Add documentation for gendwarfksyms changes, and the kABI stability features that can be useful for distributions even though they're not used in mainline kernels. Signed-off-by: Sami Tolvanen --- Documentation/kbuild/gendwarfksyms.rst | 308 + Documentation/k

[PATCH v7 17/18] kbuild: Add gendwarfksyms as an alternative to genksyms

2024-12-19 Thread Sami Tolvanen
When MODVERSIONS is enabled, allow selecting gendwarfksyms as the implementation, but default to genksyms. Signed-off-by: Sami Tolvanen --- kernel/module/Kconfig | 22 ++ scripts/Makefile | 2 +- scripts/Makefile.build | 35 +-- 3

[PATCH v7 16/18] export: Add __gendwarfksyms_ptr_ references to exported symbols

2024-12-19 Thread Sami Tolvanen
igned-off-by: Sami Tolvanen --- include/linux/export.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/include/linux/export.h b/include/linux/export.h index 2633df4d31e6..a8c23d945634 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -52,9 +52,24 @@

[PATCH v7 15/18] gendwarfksyms: Add support for symbol type pointers

2024-12-19 Thread Sami Tolvanen
xternal_symbol); Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 55 +- scripts/gendwarfksyms/examples/symbolptr.c | 33 + scripts/gendwarfksyms/gendwarfksyms.h | 7 +++ scripts/gendwarfksyms/symbols.c

[PATCH v7 14/18] gendwarfksyms: Add support for reserved and ignored fields

2024-12-19 Thread Sami Tolvanen
truct { int b; int v; }; }; Here gendwarfksyms --stable replaces the union with the type of the placeholder field when calculating versions. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c

[PATCH v7 13/18] gendwarfksyms: Add support for kABI rules

2024-12-19 Thread Sami Tolvanen
umerator values when calculating versions. This may be needed when the last field of the enum is used as a sentinel and new fields must be added before it. Add examples for using the rules under the examples/ directory. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/Makefile

[PATCH v7 12/18] gendwarfksyms: Add symbol versioning

2024-12-19 Thread Sami Tolvanen
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 --- scripts/gendwarfksyms/Makefile| 2 +- scripts/gendwarfksyms/dwarf.c | 25

[PATCH v7 11/18] gendwarfksyms: Add symtypes output

2024-12-19 Thread Sami Tolvanen
references are wrapped in single quotes. E.g.: s#'core::result::Result' 2. The actual type definition is the simple parsed DWARF format we output with --dump-dies, not the preprocessed C-style format genksyms produces. Signed-off-by: Sami Tolvanen Reviewed-by:

[PATCH v7 10/18] gendwarfksyms: Add die_map debugging

2024-12-19 Thread Sami Tolvanen
Debugging the DWARF processing can be somewhat challenging, so add more detailed debugging output for die_map operations. Add the --dump-die-map flag, which adds color coded tags to the output for die_map changes. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms

[PATCH v7 09/18] gendwarfksyms: Limit structure expansion

2024-12-19 Thread Sami Tolvanen
t the ABI. Consider type definitions in .c files to be declarations to prevent opaque types from changing symbol versions. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/cache.c | 51 +++ sc

[PATCH v7 07/18] gendwarfksyms: Expand array_type

2024-12-19 Thread Sami Tolvanen
(8) } Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c index 7d8a4eb6c387..46ce17b2459b 100644 --- a/scripts

[PATCH v7 08/18] gendwarfksyms: Expand structure types

2024-12-19 Thread Sami Tolvanen
type { base_type u8 byte_size(1) encoding(7) } data_ptr data_member_location(0) , member base_type usize byte_size(8) encoding(7) length data_member_location(8) } byte_size(16) alignment(8) msg ) -> base_type void Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu ---

[PATCH v7 06/18] gendwarfksyms: Expand subroutine_type

2024-12-19 Thread Sami Tolvanen
) } } ) -> base_type unsigned long byte_size(8) encoding(7) Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 84 ++- scripts/gendwarfksyms/gendwarfksyms.h | 4 ++ 2 files changed, 85 insertions(+), 3 deletions(-) d

[PATCH v7 05/18] gendwarfksyms: Expand type modifiers and typedefs

2024-12-19 Thread Sami Tolvanen
-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/die.c | 12 + scripts/gendwarfksyms/dwarf.c | 67 +++ scripts/gendwarfksyms/gendwarfksyms.h | 5 ++ 3 files changed, 84 insertions(+) diff --git a/scripts/gendwarfksyms/die.c b

[PATCH v7 04/18] gendwarfksyms: Add a cache for processed DIEs

2024-12-19 Thread Sami Tolvanen
Basic types in DWARF repeat frequently and traversing the DIEs using libdw is relatively slow. Add a simple hashtable based cache for the processed DIEs. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/die.c

[PATCH v7 03/18] gendwarfksyms: Expand base_type

2024-12-19 Thread Sami Tolvanen
variable base_type unsigned long byte_size(8) encoding(7) ... Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 160 ++ 1 file changed, 160 insertions(+) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts

[PATCH v7 02/18] gendwarfksyms: Add address matching

2024-12-19 Thread Sami Tolvanen
d-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/gendwarfksyms.c | 2 + scripts/gendwarfksyms/gendwarfksyms.h | 13 ++ scripts/gendwarfksyms/symbols.c | 163 ++ 3 files changed, 178 insertions(+) diff --git a/scripts/gendwarf

[PATCH v7 01/18] tools: Add gendwarfksyms

2024-12-19 Thread Sami Tolvanen
Add a basic DWARF parser, which uses libdw to traverse the debugging information in an object file and looks for functions and variables. In follow-up patches, this will be expanded to produce symbol versions for CONFIG_MODVERSIONS from DWARF. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu

[PATCH v7 00/18] Implement DWARF modversions

2024-12-19 Thread Sami Tolvanen
ps://github.com/samitolvanen/linux/commits/gendwarfksyms-v7 If you also want to test the series with actual Rust modules, this branch adds Matt's latest modversion_info series: https://github.com/samitolvanen/linux/commits/rustmodversions-v7 Sami [1] https://lore.kernel.or

Re: [PATCH v6 18/18] Documentation/kbuild: Add DWARF module versioning

2024-12-16 Thread Sami Tolvanen
Hi, On Sat, Dec 14, 2024 at 3:34 AM Masahiro Yamada wrote: > > On Fri, Nov 22, 2024 at 5:43 AM Sami Tolvanen wrote: > > > > +When a symbol pointer is found in DWARF, gendwarfksyms can use its > > +type for calculating symbol versions even if the symbol is defined > &g

Re: [PATCH v6 01/18] tools: Add gendwarfksyms

2024-12-05 Thread Sami Tolvanen
rote: > > > > > > > > On Thu, Nov 21, 2024 at 08:42:22PM +, Sami Tolvanen wrote: > > > > > Add a basic DWARF parser, which uses libdw to traverse the debugging > > > > > information in an object file and looks for functions and variables. >

Re: [PATCH v6 00/18] Implement DWARF modversions

2024-11-25 Thread Sami Tolvanen
make you feel unwelcomed. Thank you for putting this more eloquently than I could, Miguel. Neal, I do appreciate your feedback, and I'm sorry if I didn't make it clear enough in my previous emails. I would very much welcome your Tested-by, or another suitable tag that's acceptable to both you and Masahiro. Sami

Re: [PATCH v6 00/18] Implement DWARF modversions

2024-11-25 Thread Sami Tolvanen
mber of attributes we look up depending on the DIE type, but I haven't had time to look into it yet. I'll take a closer look when I'm back from my vacation in about three weeks. Sami

Re: [PATCH v6 00/18] Implement DWARF modversions

2024-11-25 Thread Sami Tolvanen
Hi Sedat, On Fri, Nov 22, 2024 at 3:51 AM Sedat Dilek wrote: > > Thanks for the update, Sami. > > What are your plans to get this upstream? Once everything has been reviewed, I'm suspect it would be up to Masahiro to decide if he wants to pick this up. > Is Linux 6.13 the

[PATCH v6 17/18] kbuild: Add gendwarfksyms as an alternative to genksyms

2024-11-21 Thread Sami Tolvanen
When MODVERSIONS is enabled, allow selecting gendwarfksyms as the implementation, but default to genksyms. Signed-off-by: Sami Tolvanen --- kernel/module/Kconfig | 25 - scripts/Makefile | 2 +- scripts/Makefile.build | 35 +-- 3

[PATCH v6 13/18] gendwarfksyms: Add support for kABI rules

2024-11-21 Thread Sami Tolvanen
umerator values when calculating versions. This may be needed when the last field of the enum is used as a sentinel and new fields must be added before it. Add examples for using the rules under the examples/ directory. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/Makefile

[PATCH v6 07/18] gendwarfksyms: Expand array_type

2024-11-21 Thread Sami Tolvanen
(8) } Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c index 7e6b477d7c12..ade9b3b7b119 100644 --- a/scripts

[PATCH v6 03/18] gendwarfksyms: Expand base_type

2024-11-21 Thread Sami Tolvanen
variable base_type unsigned long byte_size(8) encoding(7) ... Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 159 ++ 1 file changed, 159 insertions(+) diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts

[PATCH v6 04/18] gendwarfksyms: Add a cache for processed DIEs

2024-11-21 Thread Sami Tolvanen
Basic types in DWARF repeat frequently and traversing the DIEs using libdw is relatively slow. Add a simple hashtable based cache for the processed DIEs. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/die.c

[PATCH v6 18/18] Documentation/kbuild: Add DWARF module versioning

2024-11-21 Thread Sami Tolvanen
Add documentation for gendwarfksyms changes, and the kABI stability features that can be useful for distributions even though they're not used in mainline kernels. Signed-off-by: Sami Tolvanen --- Documentation/kbuild/gendwarfksyms.rst | 308 + Documentation/k

[PATCH v6 14/18] gendwarfksyms: Add support for reserved and ignored fields

2024-11-21 Thread Sami Tolvanen
truct { int b; int v; }; }; Here gendwarfksyms --stable replaces the union with the type of the placeholder field when calculating versions. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c

[PATCH v6 10/18] gendwarfksyms: Add die_map debugging

2024-11-21 Thread Sami Tolvanen
Debugging the DWARF processing can be somewhat challenging, so add more detailed debugging output for die_map operations. Add the --dump-die-map flag, which adds color coded tags to the output for die_map changes. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms

[PATCH v6 16/18] export: Add __gendwarfksyms_ptr_ references to exported symbols

2024-11-21 Thread Sami Tolvanen
igned-off-by: Sami Tolvanen --- include/linux/export.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/include/linux/export.h b/include/linux/export.h index 0bbd02fd351d..cf71d3202e5b 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -52,9 +52,24 @@

[PATCH v6 08/18] gendwarfksyms: Expand structure types

2024-11-21 Thread Sami Tolvanen
type { base_type u8 byte_size(1) encoding(7) } data_ptr data_member_location(0) , member base_type usize byte_size(8) encoding(7) length data_member_location(8) } byte_size(16) alignment(8) msg ) -> base_type void Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu ---

[PATCH v6 01/18] tools: Add gendwarfksyms

2024-11-21 Thread Sami Tolvanen
Add a basic DWARF parser, which uses libdw to traverse the debugging information in an object file and looks for functions and variables. In follow-up patches, this will be expanded to produce symbol versions for CONFIG_MODVERSIONS from DWARF. Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu

[PATCH v6 06/18] gendwarfksyms: Expand subroutine_type

2024-11-21 Thread Sami Tolvanen
) } } ) -> base_type unsigned long byte_size(8) encoding(7) Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 84 ++- scripts/gendwarfksyms/gendwarfksyms.h | 4 ++ 2 files changed, 85 insertions(+), 3 deletions(-) d

[PATCH v6 02/18] gendwarfksyms: Add address matching

2024-11-21 Thread Sami Tolvanen
d-off-by: Sami Tolvanen --- scripts/gendwarfksyms/gendwarfksyms.c | 2 + scripts/gendwarfksyms/gendwarfksyms.h | 13 +++ scripts/gendwarfksyms/symbols.c | 161 ++ 3 files changed, 176 insertions(+) diff --git a/scripts/gendwarfksyms/gendwarfksyms.c b/sc

[PATCH v6 15/18] gendwarfksyms: Add support for symbol type pointers

2024-11-21 Thread Sami Tolvanen
xternal_symbol); Signed-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/dwarf.c | 55 +- scripts/gendwarfksyms/examples/symbolptr.c | 33 + scripts/gendwarfksyms/gendwarfksyms.h | 7 +++ scripts/gendwarfksyms/symbols.c

[PATCH v6 12/18] gendwarfksyms: Add symbol versioning

2024-11-21 Thread Sami Tolvanen
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 --- scripts/gendwarfksyms/Makefile| 2 +- scripts/gendwarfksyms/dwarf.c | 25 +- scripts/gendwarfksyms

[PATCH v6 11/18] gendwarfksyms: Add symtypes output

2024-11-21 Thread Sami Tolvanen
references are wrapped in single quotes. E.g.: s#'core::result::Result' 2. The actual type definition is the simple parsed DWARF format we output with --dump-dies, not the preprocessed C-style format genksyms produces. Signed-off-by: Sami Tolvanen --- scripts/gen

[PATCH v6 09/18] gendwarfksyms: Limit structure expansion

2024-11-21 Thread Sami Tolvanen
t the ABI. Consider type definitions in .c files to be declarations to prevent opaque types from changing symbol versions. Signed-off-by: Sami Tolvanen --- scripts/gendwarfksyms/Makefile| 1 + scripts/gendwarfksyms/cache.c | 51 +++ scripts/gendwarfksyms/dwarf.c

[PATCH v6 05/18] gendwarfksyms: Expand type modifiers and typedefs

2024-11-21 Thread Sami Tolvanen
-off-by: Sami Tolvanen Reviewed-by: Petr Pavlu --- scripts/gendwarfksyms/die.c | 12 + scripts/gendwarfksyms/dwarf.c | 67 +++ scripts/gendwarfksyms/gendwarfksyms.h | 5 ++ 3 files changed, 84 insertions(+) diff --git a/scripts/gendwarfksyms/die.c b

[PATCH v6 00/18] Implement DWARF modversions

2024-11-21 Thread Sami Tolvanen
v6 If you also want to test the series with actual Rust modules, this branch adds Matt's latest modversion_info series: https://github.com/samitolvanen/linux/commits/rustmodversions-v6 Sami [1] https://lore.kernel.org/lkml/znizetkkqweig...@bombadil.infradead.org/ [2] https://lore.kernel.o

Re: [PATCH v5 10/19] gendwarfksyms: Limit structure expansion

2024-11-20 Thread Sami Tolvanen
On Wed, Oct 30, 2024 at 05:01:17PM +, Sami Tolvanen wrote: > > For pointers, limit structure expansion after the first pointer > in the symbol type. This should be plenty for detecting ABI > differences, but it stops us from pulling in half the kernel for > types that cont

Re: [PATCH v5 01/19] scripts: move genksyms crc32 implementation to a common include

2024-11-19 Thread Sami Tolvanen
Hi Darrick, On Tue, Nov 19, 2024 at 12:48 PM Darrick J. Wong wrote: > > On Mon, Nov 18, 2024 at 09:58:09PM +, Sami Tolvanen wrote: > > Hi, > > > > On Sat, Nov 16, 2024 at 9:09 AM Masahiro Yamada > > wrote: > > > > > > On Thu, Nov

Re: [PATCH v5 01/19] scripts: move genksyms crc32 implementation to a common include

2024-11-18 Thread Sami Tolvanen
Hi, On Sat, Nov 16, 2024 at 9:09 AM Masahiro Yamada wrote: > > On Thu, Nov 14, 2024 at 2:54 AM Sami Tolvanen wrote: > > > > Hi, > > > > On Mon, Nov 11, 2024 at 8:06 PM Masahiro Yamada > > wrote: > > > > > > On Thu, Oct 31, 2024 at 2:01 AM

Re: [PATCH v5 01/19] scripts: move genksyms crc32 implementation to a common include

2024-11-13 Thread Sami Tolvanen
Hi, On Mon, Nov 11, 2024 at 8:06 PM Masahiro Yamada wrote: > > On Thu, Oct 31, 2024 at 2:01 AM Sami Tolvanen wrote: > > > > To avoid duplication between host programs, move the crc32 code to a > > shared header file. > > > Only the motivation to use this lo

  1   2   3   4   5   6   7   8   9   10   >