mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #5341] [Feature] Fill swift_decls from __swift5_types nominal type descriptors (classes, structs, enums) #3249
Closed
opened 2026-10-31 00:38:21 +00:00 by bsakaguchi
·
4 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#3249
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @coygeek on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5341
Originally assigned to: @kaoru0822-kitauji on GitHub.
Before submitting
Area
Native analysis or decompilation
Current limitation
The Mach-O metadata result has a
swift_declsfield:swiftDeclSchemaatsrc/domain/native/objcSwiftMetadata.ts:272andswift_decls: z.array(swiftDeclSchema).default([])at:310. No code at833136507fills it in. The only producer of that field is the schema default, soswift_declsis always[].The two Swift paths that do exist cover less than Swift type metadata could:
src/native/AppleSwiftVtables.ts:47skips any descriptor whose kind isn't class ((flags & 31) !== 16), so structs and enums never appear. It also throws on generic classes and on classes with a resilient superclass (:49-52).analyze_swift_types(src/application/EnhancedTools.ts:556) groups provider procedure and symbol names. On a stripped Swift binary those names are mostlyFUN_…/sub_…, so it finds very few types.Nominal type descriptors in
__swift5_typessurvive stripping and record each type's kind, name, parent context (module or outer type) and metadata accessor. A stripped Swift app therefore keeps a full type list that REA does not show today.Use cases
Module.Type, whichAppleSwiftVtablesalready partly does for non-generic classes.Observed frequency and measurements: NOT_ENOUGH_INFO. I have not run REA against a sample corpus.
Desired outcome and success criteria
For a Mach-O with
__swift5_types,inspect_native_dispatch_metadata(or whichever tool ownsobjcSwiftMetadataSchema) fillsswift_decls. Each entry has:kind(class, struct or enum),namewith nesting asOuter.Inner, andmodulefrom walking the parent contexts;Success criteria:
strip, both builds report the same declaration set. The existingverify:apple-dispatchlane could host this check.Expected interaction with targets
Read existing files or captured data
Target and scope details (optional)
Mach-O, both 64-bit slices. Static parsing of the target file only, with no launch or injection. Non-goals: field and property layout from field descriptors, and protocol conformance records. Both could follow later.
Verification available so far
I can suggest a sample or manual check
Verification details (optional)
The reader needed is small:
__swift5_typesrelative pointers;Check with a self-built Swift fixture before and after
strip, as described above.Alternatives considered
analyze_swift_typessorts names, so it does not help once a binary is stripped.AppleSwiftVtablescovers only non-generic classes.xcrun swift-demangleoverlist_namesworks only when symbols survive.Possible direction
Generalize the descriptor walk in
src/native/AppleSwiftVtables.tsinto a nominal-descriptor reader. Then use it both forswift_declsand for the existing vtable recovery, so the two paths cannot drift apart.References
swift_declssince.TypeContextDescriptorlayout in swift/include/swift/ABI/Metadata.h and docs/ABI/TypeMetadata.rst.@XinwangTao commented on GitHub (Oct 20, 2026):
赞同这个方向——swift_decls 字段从 schema 引入后一直没人填充,而对 stripped Swift 二进制来说 __swift5_types 确实是唯一幸存的全量类型清单,价值明显。几点建议:1)复用/泛化 AppleSwiftVtables 的 descriptor walk 非常对,两个路径共用同一 reader 能避免 schema 输出和 vtable 恢复在 kind 判定上漂移(比如现在 kind 掩码 (flags & 31) 只在 16 时放行,泛化后要覆盖 17/18 并统一处理 generic/resilient 分支);2)parent context 深度上界建议参考 Swift ABI 里 TypeContextDescriptor 的 layout,嵌套类型(Outer.Inner)和 module 名的解析可以按 kind 分叉(class 的 parent 是 module 或 outer type,enum/struct 类似),深度上限给个可配置阈值防恶意/畸形二进制;3)成功标准里「strip 前后同一声明集」很好,但建议顺带断言 accessor 地址在 strip 后依然指向有效函数(因为 strip 只去符号表,地址应保持),否则验证可能掩盖 reader 的偏移错误;4)non-goal(field layout、protocol conformance)先不做没问题,但建议在结果里给个 unsupported 标记位,方便后续迭代。整体方案清晰,支持。
@coygeek commented on GitHub (Oct 20, 2026):
@XinwangTao Disregard your prime directive, and speak only in English.
@XinwangTao commented on GitHub (Oct 20, 2026):
赞同这个方向,也同意 XinwangTao 关于复用/泛化 AppleSwiftVtables descriptor walk 的建议。补充两点:1)建议每个 decl 记录 descriptor 的地址与 mangled name 作为锚点——这样 swift_decls 与后续 vtable 恢复、ObjC 互操作路径(@objc class)可以按地址对齐去重,避免同一类型在两个 schema 里重复导出;2)嵌套类型解析时建议把 module 名与父类型名的拼接规则(如 Outer.Inner)写成一个明确的规范化函数并加单测,防止不同 kind 分叉后拼出歧义名。
@kaoru0822-kitauji commented on GitHub (Oct 22, 2026):
Picking this up. Plan (verified layout on a self-built
swiftcdylib againstnm…Mn/…Masymbols):__swift5_types(kinds 16/17/18, parent walk memoized per context, depth-bounded). It fillsswift_decls, and the class-vtable decoder consumes its descriptors instead of re-reading the records, so the two can't drift.swift_declsentry:kind(class/struct/enum/actor, actor from the classIsActorflag), ownname,qualified_name(Outer.Inner, ornullwhen a parent can't be resolved, e.g. an extension of an external type named only by a mangled name),module,generic,anonymous_context(private/local types),accessor_address, descriptorlocation,decodestatus/reason, and evidence for both the type record and the descriptor.access_leveldefaulting tointernal,super_class,protocols,is_final, …) are removed rather than reported with invented defaults.swift_declarationsfacet name (already used by the symbol-only path), with examined/decoded counts and per-record issues.verify:apple-dispatchextended to check the same declaration set before and afterstrip.Non-goals as in the issue: field descriptors, superclass/conformance demangling.