From 484bdc183af0b3165fc4f5a32ec50d5df0a404e1 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Thu, 19 Nov 2026 20:36:11 -0500 Subject: [PATCH] fix(elf): preserve truncated kernel config evidence at the inflate limit (#12653) --- src/native/elf/KernelBuildConfig.ts | 6 ++++++ .../filesystem/kernelBuildConfig.test.ts | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/native/elf/KernelBuildConfig.ts b/src/native/elf/KernelBuildConfig.ts index 0434020497..0647f3eebd 100644 --- a/src/native/elf/KernelBuildConfig.ts +++ b/src/native/elf/KernelBuildConfig.ts @@ -450,6 +450,12 @@ const findConfig = async ( const limit = Math.min(maxOutput, remaining); const member = await inflateGzipMember(bytes, gzipAt, limit, signal); if (member.kind === "limit") { + // Without an end marker, the stopped inflate cannot establish an + // oversized config. No later candidate can be framed either. + if (closing < 0) { + truncated = true; + break; + } if (limit < maxOutput) return "exhausted"; // A member past max_config_bytes may be a decoy, so a later framed // config can still win; the budget failure is raised only if none does. diff --git a/tests/boundary/filesystem/kernelBuildConfig.test.ts b/tests/boundary/filesystem/kernelBuildConfig.test.ts index bedc0676b8..cbd02eb996 100644 --- a/tests/boundary/filesystem/kernelBuildConfig.test.ts +++ b/tests/boundary/filesystem/kernelBuildConfig.test.ts @@ -71,6 +71,26 @@ describe("kernel build config stable filesystem boundary", () => { } }); + it("retains partial framing evidence under the config inflate limit", async () => { + const root = await createTestTempDirectory("rea-kernel-config-framing-"); + const path = join(root, "vmlinux"); + await writeFile(path, kernelBuildConfigFixture().subarray(0, -1)); + const service = createKernelBuildConfigService(); + try { + for (const max_config_bytes of [4096, 64]) { + const result = await service.inspect({ path, max_config_bytes }); + if (!result.ok) throw result.error; + expect(result.value.normalized_result).toMatchObject({ + banner: { status: "present", version: "6.6.0" }, + config: { status: "incomplete", reason: "config_gzip_truncated" }, + coverage: { status: "partial" }, + }); + } + } finally { + await service.close(); + } + }); + it("reports an ordinary IKCFG_ST string as no config with file Evidence", async () => { const root = await createTestTempDirectory("rea-kernel-config-plain-"); const path = join(root, "vmlinux");