all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: 結友 <miagetegorann@gmail.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-kernel v4 1/2] d/scripts: correctly compare namespaced ABI exports
Date: Mon, 16 Nov 2026 22:48:40 +0100	[thread overview]
Message-ID: <aa154653-9aa2-4554-be6a-d14253e34237@proxmox.com> (raw)
In-Reply-To: <20261024052438.1274-2-miagetegorann@gmail.com>

Am 24.10.26 um 07:25 schrieb 結友:
> abi-generate emits a different field order for namespaced exports. Parse
> both layouts explicitly so the module name does not become part of the
> symbol name. Otherwise, building hv_vmbus into vmlinux falsely reports
> three existing namespaced exports as missing.
> 
> Compare the actual export type and namespace, preserving hash and missing
> symbol checks and symbol/module blacklists. Reject added or changed
> namespace requirements, malformed entries and duplicate symbols. Fix the
> export-type diagnostic's printf argument separator.
> 
> Add 12 ABI regression tests, including end-to-end abi-generate output,
> relocation, hash changes, GPL restrictions, namespaces and skip handling.
> Document the check and test command, and ignore Python bytecode caches.
> 
> All 12 tests pass under WSL2 Ubuntu 24.04. Rechecking the existing
> 7.0.14-26-pve build artifacts with SKIPABI=0 preserves all 32,726 symbols,
> their CRCs and export types, with only the expected 47 VMBus relocations.
> 
> Signed-off-by: 結友 <miagetegorann@gmail.com>
> ---
>  .gitignore                     |   1 +
>  README                         |   8 ++
>  debian/scripts/abi-check       |  56 ++++++++++---
>  debian/tests/test_abi_check.py | 140 +++++++++++++++++++++++++++++++++
>  4 files changed, 192 insertions(+), 13 deletions(-)
>  create mode 100644 debian/tests/test_abi_check.py
> 
> diff --git a/.gitignore b/.gitignore
> index 295de11..aa1d4e1 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -3,6 +3,7 @@
>  *.deb
>  *.dsc
>  *.prepared
> +__pycache__/
>  /abi-tmp*
>  /config*.org
>  /proxmox-kernel-[0-9]*/
> diff --git a/README b/README
> index 9dd855a..00564c8 100644
> --- a/README
> +++ b/README
> @@ -167,6 +167,14 @@ variable in the Makefile, rebuilding the packages and running 'make abiupdate'
>  (the 'abiupdate' target in 'Makefile' contains the steps for consistently
>  updating the repository).
>  
> +The ABI check reads both ordinary and namespaced exports. Moving an export
> +between a module and vmlinux is reported without failing the check. Missing
> +symbols, hash changes and stricter export or namespace requirements fail it
> +unless an applicable blacklist or the ABI skip mode permits them.
> +
> +Run the ABI checker regression tests on a Debian build host with
> +'python3 -B -m unittest discover -s debian/tests -v'.
> +
>  The source package-name is proxmox-kernel-MAJ.MIN, the version of the package
>  defaults to MAJ.MIN.PATCH-KREL - but this can be adapted to contain a suffix
>  for test-packages (e.g. ~test01). The version in the Makefile needs to be equal
> diff --git a/debian/scripts/abi-check b/debian/scripts/abi-check
> index 9987d04..ff000c3 100755
> --- a/debian/scripts/abi-check
> +++ b/debian/scripts/abi-check
> @@ -89,17 +89,35 @@ sub is_ignored($$) {
>      return 0;
>  }
>  
> +# abi-generate emits four fields for ordinary exports, and five fields for
> +# namespaced exports (namespace, type, hash, symbol, module). In the latter
> +# format the trailing module must not become part of the symbol name.
> +sub parse_symbol {
> +    my ($line, $file, $number) = @_;
> +    chomp $line;
> +    $line =~ s/\r$//;
> +
> +    if ($line =~ /^(EXPORT_SYMBOL(?:_[A-Z0-9_]+)?)\s+(\S+)\s+(0x[0-9a-f]+)\s+(\S+)$/) {
> +	return ($4, $1, $2, $3, '');
> +    }
> +    if ($line =~ /^(\S+)\s+(EXPORT_SYMBOL(?:_[A-Z0-9_]+)?)\s+(0x[0-9a-f]+)\s+(\S+)\s+(\S+)$/) {
> +	return ($4, $2, $5, $3, $1);
> +    }
> +    die "EE: $file:$number: malformed ABI entry: '$line'\n";
> +}
> +
>  # Read new syms first
>  print "    Reading new symbols ($abistr)...";
>  $count = 0;
>  open(my $NEW_FH, '<', $abinew) or die "Could not open $abinew - $!";
>  while (<$NEW_FH>) {
> -    chomp;
> -    m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
> -    $symbols{$4}{'type'} = $1;
> -    $symbols{$4}{'loc'} = $2;
> -    $symbols{$4}{'hash'} = $3;
> -    $module_syms{$2} = 0;
> +    my ($sym, $type, $loc, $hash, $namespace) = parse_symbol($_, $abinew, $.);
> +    die "EE: $abinew:$.: duplicate symbol '$sym'\n" if defined($symbols{$sym}{'type'});
> +    $symbols{$sym}{'type'} = $type;
> +    $symbols{$sym}{'loc'} = $loc;
> +    $symbols{$sym}{'hash'} = $hash;
> +    $symbols{$sym}{'namespace'} = $namespace;
> +    $module_syms{$loc} = 0;
>      $count++;
>  }
>  close($NEW_FH);
> @@ -110,11 +128,12 @@ print "    Reading old symbols...";
>  $count = 0;
>  open(my $OLD_FH, '<', $abiold) or die "Could not open $abiold - $!";
>  while (<$OLD_FH>) {
> -    chomp;
> -    m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
> -    $symbols{$4}{'old_type'} = $1;
> -    $symbols{$4}{'old_loc'} = $2;
> -    $symbols{$4}{'old_hash'} = $3;
> +    my ($sym, $type, $loc, $hash, $namespace) = parse_symbol($_, $abiold, $.);
> +    die "EE: $abiold:$.: duplicate symbol '$sym'\n" if defined($symbols{$sym}{'old_type'});
> +    $symbols{$sym}{'old_type'} = $type;
> +    $symbols{$sym}{'old_loc'} = $loc;
> +    $symbols{$sym}{'old_hash'} = $hash;
> +    $symbols{$sym}{'old_namespace'} = $namespace;
>      $count++;
>  }
>  close($OLD_FH);
> @@ -158,6 +177,7 @@ $count = 0;
>  my $moved = 0;
>  my $changed_type = 0;
>  my $changed_hash = 0;
> +my $changed_namespace = 0;
>  for my $sym (keys(%symbols)) {
>      if (!defined($symbols{$sym}{'old_type'}) or !defined($symbols{$sym}{'type'})) {
>  	next;
> @@ -172,12 +192,21 @@ for my $sym (keys(%symbols)) {
>      # Changes to export type are only bad if new type isn't
>      # EXPORT_SYMBOL. Changing things to GPL are bad.
>      if ($symbols{$sym}{'type'} ne $symbols{$sym}{'old_type'}) {
> -	printf("    TYPE : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_type'}.
> +	printf("    TYPE : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_type'},
>  	    $symbols{$sym}{'type'}, is_ignored($symbols{$sym}{'loc'}, $sym)
>  	    ? " (ignored)" : "");
>  	$changed_type++ if $symbols{$sym}{'type'} ne "EXPORT_SYMBOL" and !is_ignored($symbols{$sym}{'loc'}, $sym);
>      }
>  
> +    # Adding or changing a namespace requires consumers to change their imports.
> +    # Removing a namespace relaxes that requirement and is compatible.
> +    if ($symbols{$sym}{'namespace'} ne $symbols{$sym}{'old_namespace'}) {
> +	printf("    NS   : %-40s : %s => %s%s\n", $sym,
> +	    $symbols{$sym}{'old_namespace'} || '(none)', $symbols{$sym}{'namespace'} || '(none)',
> +	    is_ignored($symbols{$sym}{'loc'}, $sym) ? " (ignored)" : "");
> +	$changed_namespace++ if $symbols{$sym}{'namespace'} ne '' && !is_ignored($symbols{$sym}{'loc'}, $sym);
> +    }
> +
>      # Changes to the hash are always bad
>      if ($symbols{$sym}{'hash'} ne $symbols{$sym}{'old_hash'}) {
>  	printf("    HASH : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_hash'},
> @@ -191,8 +220,9 @@ for my $sym (keys(%symbols)) {
>  print "WW: $moved symbols changed location\n" if $moved;
>  print "$EE $changed_type symbols changed export type and weren't ignored\n" if $changed_type;
>  print "$EE $changed_hash symbols changed hash and weren't ignored\n" if $changed_hash;
> +print "$EE $changed_namespace symbols changed namespace and weren't ignored\n" if $changed_namespace;
>  
> -$errors++ if $changed_hash or $changed_type;
> +$errors++ if $changed_hash or $changed_type or $changed_namespace;
>  if ($changed_hash) {
>      print "II: Module hash change summary...\n";
>      for my $mod (sort { $module_syms{$b} <=> $module_syms{$a} } keys %module_syms) {
> diff --git a/debian/tests/test_abi_check.py b/debian/tests/test_abi_check.py
> new file mode 100644
> index 0000000..928c64a
> --- /dev/null
> +++ b/debian/tests/test_abi_check.py

why python tests and not perl, like the script doing the abi export is using? Could be
probably also a simpler array of input, expected tuples to iterate over, but not a must.

Also, these tests don't really give us any coverage for the real ABI output? if that
diverges (again) we still just miss that? Some actual check and error on unexpected
input above would be probably more helpful.




  reply	other threads:[~2026-11-16 21:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24  5:24 [PATCH pve-kernel v4 0/2] fix #8027: restore built-in Hyper-V VMBus 結友
2026-10-24  5:24 ` [PATCH pve-kernel v4 1/2] d/scripts: correctly compare namespaced ABI exports 結友
2026-11-16 21:48   ` Thomas Lamprecht [this message]
2026-11-16 23:50     ` 結友
2026-10-24  5:24 ` [PATCH pve-kernel v4 2/2] fix #8027: config: enable CONFIG_HYPERV_VMBUS 結友
2026-11-16 23:54   ` Thomas Lamprecht
2026-11-17  0:03     ` 結友
2026-11-09 18:39 ` [PATCH pve-kernel v4 0/2] fix #8027: restore built-in Hyper-V VMBus 山﨑結友

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=aa154653-9aa2-4554-be6a-d14253e34237@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=miagetegorann@gmail.com \
    --cc=pve-devel@lists.proxmox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal