rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Matthew Maurer <mmaurer@google.com>,
	masahiroy@kernel.org, ndesaulniers@google.com, ojeda@kernel.org,
	gary@garyguo.net, mcgrof@kernel.org,
	Michael Ellerman <mpe@ellerman.id.au>,
	Alex Gaynor <alex.gaynor@gmail.com>,
	Benjamin Gray <bgray@linux.ibm.com>,
	Naveen N Rao <naveen@kernel.org>
Cc: rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, neal@gompa.dev, marcan@marcan.st,
	j@jannau.net, asahi@lists.linux.dev,
	linux-modules@vger.kernel.org,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	"Petr Pavlu" <petr.pavlu@suse.com>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Daniel Gomez" <da.gomez@samsung.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v5 14/16] modules: Support extended MODVERSIONS info
Date: Thu, 26 Sep 2024 14:22:39 +0200	[thread overview]
Message-ID: <b31c74c1-0c19-4bc4-b1af-db817977748d@csgroup.eu> (raw)
In-Reply-To: <20240925233854.90072-15-mmaurer@google.com>



Le 26/09/2024 à 01:38, Matthew Maurer a écrit :
> 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.
> 
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
> ---
>   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, 161 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
> index e9bab599d0c2..4e7b156dd8b2 100644
> --- a/arch/powerpc/kernel/module_64.c
> +++ b/arch/powerpc/kernel/module_64.c
> @@ -355,6 +355,23 @@ static void dedotify_versions(struct modversion_info *vers,
>   		}
>   }
>   
> +static void dedotify_ext_version_names(char *str_seq, unsigned long size)
> +{
> +	unsigned long out = 0;
> +	unsigned long in;
> +	char last = '\0';
> +
> +	for (in = 0; in < size; in++) {
> +		/* Skip one leading dot */
> +		if (last == '\0' && str_seq[in] == '.')
> +			in++;
> +		last = str_seq[in];
> +		str_seq[out++] = last;
> +	}

Why do you need a loop here ?

Can't you just do something like:

	if (str_seq[0] == '.')
		memmove(str_seq, str_seq + 1, size);


> +	/* Zero the trailing portion of the names table for robustness */
> +	memset(&str_seq[out], 0, size - out);

This seems unneeded.

> +}
> +
>   /*
>    * Undefined symbols which refer to .funcname, hack to funcname. Make .TOC.
>    * seem to be defined (value set later).



Christophe

  reply	other threads:[~2024-09-26 12:22 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25 23:38 [PATCH v5 00/16] Extended MODVERSIONS Support Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 01/16] module: Take const arg in validate_section_offset Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 02/16] module: Factor out elf_validity_ehdr Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 03/16] module: Factor out elf_validity_cache_sechdrs Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 04/16] module: Factor out elf_validity_cache_secstrings Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 05/16] module: Factor out elf_validity_cache_index_info Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 06/16] module: Factor out elf_validity_cache_index_mod Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 07/16] module: Factor out elf_validity_cache_index_sym Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 08/16] module: Factor out elf_validity_cache_index_str Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 09/16] module: Group section index calculations together Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 10/16] module: Factor out elf_validity_cache_strtab Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 11/16] module: Additional validation in elf_validity_cache_strtab Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 12/16] module: Reformat struct for code style Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 13/16] export_report: Rehabilitate script Matthew Maurer
2024-10-11 22:13   ` Luis Chamberlain
2024-10-11 22:22     ` Matthew Maurer
2024-10-11 22:29       ` Luis Chamberlain
2024-09-25 23:38 ` [PATCH v5 14/16] modules: Support extended MODVERSIONS info Matthew Maurer
2024-09-26 12:22   ` Christophe Leroy [this message]
2024-09-26 18:36     ` Sami Tolvanen
2024-10-11 22:22   ` Luis Chamberlain
2024-10-11 22:27     ` Matthew Maurer
2024-10-11 22:33       ` Luis Chamberlain
2024-10-11 23:45         ` Luis Chamberlain
2024-10-11 23:46           ` Luis Chamberlain
2024-10-15 23:22             ` Matthew Maurer
2024-10-16 23:21               ` Luis Chamberlain
2024-10-17  4:41                 ` Christophe Leroy
2024-10-17 12:08                 ` Helge Deller
2024-10-19 20:45                   ` Luis Chamberlain
2024-10-21 19:35                     ` Luis Chamberlain
2024-09-25 23:38 ` [PATCH v5 15/16] modpost: Produce extended modversion information Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 16/16] export_report: Use new version info format Matthew Maurer
2024-09-26 22:53 ` [PATCH v5 00/16] Extended MODVERSIONS Support Sami Tolvanen
2024-09-28 21:35 ` Neal Gompa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b31c74c1-0c19-4bc4-b1af-db817977748d@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=asahi@lists.linux.dev \
    --cc=benno.lossin@proton.me \
    --cc=bgray@linux.ibm.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=da.gomez@samsung.com \
    --cc=gary@garyguo.net \
    --cc=j@jannau.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=marcan@marcan.st \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mmaurer@google.com \
    --cc=mpe@ellerman.id.au \
    --cc=naveen@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=neal@gompa.dev \
    --cc=npiggin@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).