Repository navigation
[AUTOMATED] importdata: a Mach-O data import slot read as a value prints &<import> - #1871
Merged
Merged
Conversation
…ort's address A Mach-O __got slot of a data import (a Swift witness table, type metadata or conformance descriptor, an Objective-C class object) holds the import's address. Code that passes that address on, to swift_getWitnessTable or as a message receiver, printed the slot as dat_<slot>. With importdata on, a read of the value the loader put in a slot machodataslots marks as data now renders &<import>; function-import slots and values the function stored are unchanged. [AUTOMATED]
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
A data-import slot's value read by a mask, shift, multiply or division printed `&OBJC_CLASS_$_NSObject >> 0x20` and `&Swift.Int.type_metadata | 1`, which C rejects. Such a read, and a read narrower than the slot, keep `dat_<slot>` as before; an addition still reads `&<import> + 8`. The check returns early when the image marked no data-import slot. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179iMKNhsvezm24JAGcKtoV
Contributor
|
[AUTOMATED] Pushed 71ed27e on top of your head: a clean merge of current main, plus one small guard in Repro: |
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.
[AUTOMATED]
A Mach-O
__gotslot of a data import holds the import's address. When code passes that address on, as Swift does with witness tables, type metadata and conformance descriptors, or Objective-C with a class object, kuna prints the slot as an anonymous global. Build the fixture added here (the two commands from its README entry) and decompile it:After:
use_addresses(&OBJC_CLASS_$_NSObject,&<SwiftUI.Color:SwiftUI.View>.protocol_witness_table);. On a 72 MB iOS app,swift_getWitnessTable(dat_103f7d4e8,v2,&v1)becomesswift_getWitnessTable(&<SwiftUI.ModifiedContent<A,B>:SwiftUI.View>.protocol_conformance_descriptor,v2,&v1)andobjc_msgSend$numberWithLongLong:(dat_103f79168,...)becomesobjc_msgSend$numberWithLongLong:(&OBJC_CLASS_$_NSNumber,...).The fix
machodataslotsalready tells a data import from its mangling and names the slot. It now also hands the engine the list of those slots.importdata(default on), a read of such a slot's own value prints&<import>. A read through it (*slot) still prints the import, as before.if (dat_<slot>), pinned by thenullable-relocationsandmipsgot-weakstage tests) reads as before.Tests
kuna-console/tests/verify_machodataslots.rsgets one case on the new fixture, checkingdat_withimportdata offand&<import>with it on; it fails without the change. Stage and datatest corpora are unchanged. On 390 sampled functions of the app, 74 change, and 119dat_references become&<import>(33 type metadata, 21 witness tables, 35 conformance descriptors, 29OBJC_CLASS_$_*); every changed line differs only in those tokens.Model:
anthropic/claude-opus-5-5:high