linux, linux-esx: make canister_build work against the current kernel - #1675
Open
dcasota wants to merge 2 commits into
Open
linux, linux-esx: make canister_build work against the current kernel#1675dcasota wants to merge 2 commits into
dcasota wants to merge 2 commits into
Conversation
dcasota
force-pushed
the
fix/canister-build-against-current-kernel
branch
2 times, most recently
from
September 2, 2026 08:10
5167f6a to
2110644
Compare
dcasota
force-pushed
the
fix/canister-build-against-current-kernel
branch
3 times, most recently
from
September 3, 2026 16:36
7390b86 to
3a0b9a5
Compare
…g.inc
linux.spec and linux-esx.spec implemented the same canister Kconfig handling
in two different idioms, and they disagreed on one constellation.
linux-esx.spec used %if 0%{?fips} / %else, and its %else branch cleaned the
GCC_PLUGIN_{MATCH,PAD}_CANISTER_STRUCTS comments out of .config. linux.spec
instead used two independent %if canister_build / %if canister_usage blocks
with no %else, so when fips=0 nothing ran: the shipped .config kept the
"is not set" comments, make olddefconfig dropped them, and the
check_for_config_applicability.inc diff guard failed %prep. That is the
generic aarch64 kernel - fips is set by %global inside %ifarch, so it is
unconditionally 1 on x86_64 and cannot be overridden with -D, and
acvp_build/kat_build force fips=1 even on aarch64.
Move the three conditional blocks into SPECS/linux/canister_config.inc,
pulled in by both specs as Source5 + %include, the same mechanism both
already use for check_for_config_applicability.inc. Divergence between the
two flavours is now impossible by construction.
linux-esx.spec additionally gains the derived-flag block linux.spec already
had (canister_build=0, canister_usage=fips), nested inside the existing
%if fips so it does not shadow -D. esx never builds a canister - it untars a
prebuilt one - so fips=1 implies canister_usage=1, reproducing the old
branch exactly.
Tested across 112 cells: 2 specs x {x86_64, aarch64} x subrelease {91, 92} x
14 flag combinations of fips / canister_build / canister_usage / acvp_build /
kat_build. All x86_64 cells are byte-identical apart from the release string.
The aarch64 fips=0 cells replace PR#14's broad sed with linux-esx's narrower
pair; the two forms produce byte-identical output on all five shipped config
files, because no config contains a CANISTER_STRUCTS=y form - only the
"is not set" comment form. The esx aarch64 reordering is likewise a no-op:
the canister and jitterentropy seds touch disjoint symbols.
Change-Id: If4107c14d8f15752dff0c0f25c6b4dee504e3041
Signed-off-by: Daniel Casota <dcasota@gmail.com>
canister_build could not build against the shipping kernel at all. %prep died
at --fuzz=0 with
1 out of 2 hunks FAILED -- saving rejects to crypto/rsa-pkcs1pad.c.rej
Upstream dropped the WARN_ON() wrapper around !digest_size in
pkcs1pad_verify(), and that single line is context for both 1004 and 1010. In
1004 the conversion is not cosmetic: WARN_ON emits a __bug_table entry, and
keeping __bug_table out of the canister is the entire point of that patch.
Verified with rpmbuild -bp on a staged topdir: the whole series applies with
no rejects and pkcs1pad_verify() comes out as
if (fcw_warn_on(req->dst) || !digest_size ||
!ctx->key_size || sig_size != ctx->key_size ||
pkcs1pad_invalid_hash_len(digest_size, digest_info))
Stacked on the canister_config.inc change, which took -12; this takes -13. The
two are stacked in fact, not just in numbering: a tree carrying only the
include refactor has a spec that claims canister support the patch series
cannot deliver.
An earlier version of this change also made fips_canister_version and
fips_certified_kernel_version overridable via a %{!?name: ...} guard. That is
dropped. rpm expands the guarded form correctly, but Photon's own SpecParser
does not: _isDefinition() matches only a line STARTING with %define/%global,
so the guard is invisible to it and ExtraBuildRequiresSansSnapshot kept
%{fips_canister_version} literal - the build then asked tdnf for a package
called "linux-fips-canister-%{fips_canister_version}" and both kernel flavours
failed to build. Overridability needs a mechanism that parser understands, and
is not needed for this fix.
Change-Id: Ifae87ab0fbfc289436a62b91bdfbff00e9d98b6c
Signed-off-by: Daniel Casota <dcasota@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JW73JTCUGRcaNTUEQcAMtf
dcasota
force-pushed
the
fix/canister-build-against-current-kernel
branch
from
September 7, 2026 12:13
3a0b9a5 to
2590191
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
canister_build=1fails in%prepagainst Photon 5.0's own current kernel. The canister-creation series is maintained against the certified kernel 6.12.60, and upstream has since dropped theWARN_ON()wrapper around!digest_sizeinpkcs1pad_verify():rpm applies at
--fuzz=0, so pure context drift is fatal:It looks worse than it is
%prepstops at the first failure, so this reads like a diverged patch series. It is not. Applying1000–1016to the 6.12.103 tree and forcing through failures to see the whole picture:16 of 18 applications succeed unmodified. The only two rejects are the same line, in the same function, in the same file — patch
1004(which converts it) and patch1010(which carries it as context). With both hunks rebased, the series applies clean at--fuzz=0with zero rejects.Why 1004 matters beyond compiling
WARN_ONexpands to a__bug_tableentry, and1004-Move-__bug_table-section-to-fips_canister_wrapper.patchexists specifically to keep__bug_tableout of the canister. Leaving that call unconverted would embed a bug-table entry in the frozen blob.Also: the version pins
Both canister version pins were bare
%defines with no%{!?...}guard, so no build could be pointed at anything but the certified canister without editing the spec:fips_canister_version(both flavours) — so a build can link a canister produced locally for the kernel under test.fips_certified_kernel_version— so a build that creates a new canister can stamp the kernel it was really built from, rather than inherit a certification it does not carry. The spec's own comment already asked for this: "Remove below line when building a new canister."linux-esxdeliberately keepscanister_build 0. The canister is one artifact, built once and consumed by both flavours — which is exactly how the prebuilt path already works. Making the pin overridable is all that flavour needs.Verification
fips-canister-6.12.60-18.2.ph5.tar.bz2exactly as before, so a normal build is byte-identical.-D 'fips_canister_version 6.12.103-12.ph5'→ both specs resolve the local canister.-D 'canister_build 1'→linux-fips-canistersubpackage still emitted.--fuzz=0, verified from a true pre-series tree (original1004reverse-applied first, so the result is not an artefact of the partial application).Not verified
A full canister kernel build has not completed — the rebase was validated at patch and spec level. The
%build-stage struct comparator (check_kernel_struct_in_canister.inc) has not been exercised against 6.12.103.