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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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@xxxxxxxxxx>
---
  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




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux