From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 501791FF0AA for ; Tue, 17 Nov 2026 00:50:25 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2AFDA21596; Tue, 17 Nov 2026 00:50:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794872998; x=1795477798; darn=lists.proxmox.com; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qzyBeRTBzLSwJyHzNjXopBvtrpqjQJ85T9nX6wPiGtE=; b=c10evoCaSppOj9nmfh4HrOU4QYo1cUNPPINxrOJ59zHpXplvcb+Rt69os4v//89UFd pWi/BukFjDlo8E2j/nwtDoXR7vug+mrJoPENo28V4sYLZvL7DJsKycVsADcvWAVB0Lf1 xseM3EcbDb0OzeneAgadRg50cWeovZiOGrDYBnFR9HWcHcDVsOFsX30zhGnN01Jjdmj7 cbWfDiU5QZeFvFgfSrq0SC/b7bYCRizqJVOzjS09C2DhyehFH9MxXCtJspXqMG5xB/S0 8rlp5hyl1zBHJxASqXDcBZtHN4pQTDjGQY7Bqh1kFgRFD9CNpstwxY9i/i4hXnrri8/h tBMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794872998; x=1795477798; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=qzyBeRTBzLSwJyHzNjXopBvtrpqjQJ85T9nX6wPiGtE=; b=g6cpGfEhzcwqoBHc4jwkCfTzYflxiwqdJF18rAIexH1POmze6eywNp0vbbhDr95w9N tooU6FYKR5t4b5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TP id a92af1059eb24-1b503121292mr9615561c88.32.1794872997588; Mon, 16 Nov 2026 15:49:57 -0800 (PST) From: =?UTF-8?q?=E7=B5=90=E5=8F=8B?= To: pve-devel@lists.proxmox.com Subject: [PATCH pve-kernel v5 1/2] d/scripts: correctly compare namespaced ABI exports Date: Tue, 17 Nov 2026 08:49:52 +0900 Message-ID: <20261116234953.1476-2-miagetegorann@gmail.com> X-Mailer: git-send-email 2.56.0.windows.4 In-Reply-To: <20261116234953.1476-1-miagetegorann@gmail.com> References: <20261116234953.1476-1-miagetegorann@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.600 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: HWMODMZV7PFRMO6JLCFPBI2F3HAUV2T3 X-Message-ID-Hash: HWMODMZV7PFRMO6JLCFPBI2F3HAUV2T3 X-MailFrom: miagetegorann@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: abi-generate emits a different field order for namespaced exports, as awk skips the empty namespace column of ordinary ones: TYPE MODULE HASH SYMBOL (ordinary) NAMESPACE TYPE HASH SYMBOL MODULE (namespaced) abi-check parses both with a single pattern made for the first layout. For the 2557 namespaced entries of the current amd64 ABI file it thus takes the namespace as export type, the export type as location and "SYMBOLMODULE" as symbol name. This has two consequences: - Moving a namespaced export between a module and vmlinux is reported as one missing and one new symbol. Building hv_vmbus into vmlinux falsely fails the check with three missing symbols that way. - A namespaced export changing from EXPORT_SYMBOL to EXPORT_SYMBOL_GPL is not detected at all. Parse both layouts explicitly and compare the actual export type and namespace. Adding or changing a namespace is an error like a stricter export type, as consumers need to change their imports for it, while dropping one is not. Abort on entries matching neither layout and on duplicate symbols, so that a future change in the generated format fails the build instead of silently weakening the check again. This also applies when the ABI check is skipped or runs in no-fail mode after an ABI bump, as the result cannot be trusted at all in that case. While at it, fix the argument separator in the printf of the export type diagnostic. Checked against abi-prev-7.0.14-29-pve-amd64: all 32727 entries are parsed, comparing the file with itself reports no changes, and moving the hv_vmbus exports to vmlinux in a copy reports 47 changed locations and nothing else. Signed-off-by: 結友 --- README | 7 +++++ debian/scripts/abi-check | 56 ++++++++++++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/README b/README index 9dd855a..d2e1af2 100644 --- a/README +++ b/README @@ -167,6 +167,13 @@ 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. Entries +matching neither layout and duplicate symbols always abort the check, so that +a change in the generated format cannot go unnoticed. + 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) { -- 2.56.0.windows.4