Repository navigation
feat(elf): inspect Linux kernel module metadata - #7010
Merged
Merged
Conversation
Adds inspect-kernel-module and inspect_kernel_module for ELF32/ELF64 ET_REL Linux kernel modules, read statically without executing them. Reports ordered .modinfo entries with duplicates preserved, __versions symbol CRCs, the presence of .gnu.linkonce.this_module and __ksymtab, .init.text and .exit.text sizes, and an appended module signature trailer with its PKCS#7 byte range and SHA-256. gzip, xz and zstd containers are reported unsupported with external decompression as the next probe. Malformed headers and exhausted entry budgets return no partial success. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016y53PdpyMAp9RSW65fatHe
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The reviewed changes appear safe to merge; both numbered previous findings are fixed. SummaryAdds static Linux kernel-module inspection through CLI and MCP, with ordered metadata, symbol CRCs, section facts, and signature ranges and hashes.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[CLI or MCP] --> B[KernelModuleService]
B --> C[KernelModuleProvider]
C --> D[Stable regular-file read]
D --> E[KernelModuleParser]
E --> F[Metadata and explicit limitations]
F --> B
B --> G[Validated Evidence]
Reviews (4) · Last reviewed commit: "fix: resolve merge integration errors" · Reviewed by Greptile |
Charge listed __ksymtab* sections against max_entries, omit section names longer than 256 bytes with ksymtab_name_exceeds_limit, and aggregate the non-file-backed limitation so repeated huge names cannot inflate Evidence. Use fixedTupleSchema for the signature pad bytes with projection parity tests, and assert the late-cancellation reason and retained observation. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016y53PdpyMAp9RSW65fatHe
This comment has been minimized.
This comment has been minimized.
3 tasks done
3 tasks done
This was referenced Oct 26, 2026
Closed
2 tasks done
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.
Summary
Linux kernel modules (
.ko) carry their identity in ELF sections:.modinfokey/value strings,__versionssymbol CRCs, and an appended PKCS#7 signature trailer. REA admits relocatable ELF but had no static reader for this metadata. This addsinspect-kernel-module(CLI) andinspect_kernel_module(MCP) for ELF32/ELF64ET_RELmodules, read without loading the module or opening a disassembler. No related issue; this is a new static inspection within existing native authority.Problem and expected behavior
An analyst triaging a driver today needs
modinfo,readelfand a separate signature script. Expected: REA reports ordered.modinfoentries with duplicates preserved (alias,softdep,parm),__versionsCRCs, presence of.gnu.linkonce.this_moduleand__ksymtab,.init.text/.exit.textsizes, and the signature trailer'smodule_signaturefields with the PKCS#7 byte range and SHA-256.Change and scope
src/native/elf/KernelModuleParser.tsreads section headers through the shared ELF reader, decodes.modinfoand__versionsfor both word sizes and byte orders, and parses the~Module signature appended~trailer. A missing section is observed absence when section names are known.gzip, xz and zstd containers are reported
unsupportedwithexternal_decompressionas the next probe; neither this tool norextract_artifactdecodes those codecs. Malformed headers and exhausted entry budgets return no partial success. Not included: decodingstruct module, validating the signature or certificate chain. AI was used for assistance.Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
src/native/elf/) and the binary diagnostics service.inspect-kernel-modulecommand andinspect_kernel_moduletool.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): catalog builder entry, a capability row in each translated README (as in feat(pe): inspect import and delay-load tables #6509), and authored skill guidance in.agents/skills/reverse-engineer-anything/. No committed build outputs.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/native/elf/KernelModuleParser.test.ts(ELF32/ELF64, both byte orders, duplicate keys,__versionslayouts, signature trailers, compressed containers, truncation and budgets),kernelModule.test.ts,KernelModuleService.test.ts,BinaryDiagnosticsCancellation.test.ts,tests/acceptance/kernelModuleCli.test.ts,tests/boundary/mcp/kernelModuleMcp.test.ts,tests/boundary/filesystem/kernelModule.test.ts, and the shared path-admission, tool-contract and stable-artifact lists. Fixtures are synthetic; no binaries are committed.vfat.koandbtrfs.ko(not committed) and compared withmodinfooutput.modinfo vfat.koandmodinfo btrfs.kolist the same keys and values in the same order.For evidence-bearing changes:
Validation performed
Head
2cb558d21on maind361c53c5; macOS arm64, Node 26.5.0, npm 12.2.0:npx --no-install vitest run src/application/binaryDiagnostics/BinaryDiagnosticsCancellation.test.ts src/application/binaryDiagnostics/KernelModuleService.test.ts src/contracts/toolEffects.test.ts src/domain/native/kernelModule.test.ts src/native/elf/KernelModuleParser.test.ts tests/acceptance/kernelModuleCli.test.ts tests/acceptance/localPathAdmissionCli.test.ts tests/acceptance/tools/localToolContracts.test.ts tests/boundary/filesystem/kernelModule.test.ts tests/boundary/mcp/kernelModuleMcp.test.ts tests/process-global/stableArtifactConsumers.test.ts- passed.vfat.ko,btrfs.koandvfat.ko.xzinspected as shown above.Compatibility, safety, and release
Author readiness
Human owner: @mvanhorn
Before merge
type(scope): outcome.Demo