diff options
| author | Matthew Maurer <mmaurer@google.com> | 2025-01-03 17:37:01 +0000 |
|---|---|---|
| committer | Masahiro Yamada <masahiroy@kernel.org> | 2025-01-11 01:25:26 +0900 |
| commit | 54ac1ac8edeb74ff87fc880d1ee58785bdcbe323 (patch) | |
| tree | c1ea69d5a25023c70bc3165d69ba46a5fc5b8715 /kernel/module/internal.h | |
| parent | 8c6d7b417f0fe69d7e29501db801838a54c6764b (diff) | |
modules: Support extended MODVERSIONS info
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 add additional fields to MODVERSIONS in a
backwards compatible way if needed. Any new fields will be ignored by
old user tooling, unlike the current format where user tooling cannot
tolerate adjustments to the format (for example making the name field
longer).
Since PPC munges its version records to strip leading dots, we reproduce
the munging for the new format. Other architectures do not appear to
have architecture-specific usage of this information.
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Matthew Maurer <mmaurer@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'kernel/module/internal.h')
| -rw-r--r-- | kernel/module/internal.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/module/internal.h b/kernel/module/internal.h index f10dc3ea7ff8..887838589020 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -86,6 +86,8 @@ struct load_info { unsigned int vers; unsigned int info; unsigned int pcpu; + unsigned int vers_ext_crc; + unsigned int vers_ext_name; } index; }; @@ -389,6 +391,15 @@ void module_layout(struct module *mod, struct modversion_info *ver, struct kerne struct kernel_symbol *ks, struct tracepoint * const *tp); int check_modstruct_version(const struct load_info *info, struct module *mod); int same_magic(const char *amagic, const char *bmagic, bool has_crcs); +struct modversion_info_ext { + size_t remaining; + const u32 *crc; + const char *name; +}; +void modversion_ext_start(const struct load_info *info, struct modversion_info_ext *ver); +void modversion_ext_advance(struct modversion_info_ext *ver); +#define for_each_modversion_info_ext(ver, info) \ + for (modversion_ext_start(info, &ver); ver.remaining > 0; modversion_ext_advance(&ver)) #else /* !CONFIG_MODVERSIONS */ static inline int check_version(const struct load_info *info, const char *symname, |