Closed Supereg closed 2 years ago
Reading through the ABI docs, might this be related to the following change: https://github.com/apple/swift/commit/38fc849a1fc8ea703de2fd1f280b43c682b70257#diff-22fb9f1513d9c05f34d493826b4553bba65a4336a41ae4413678feec549db3a5?
It reads like that on platforms without Objective-C interoperability the objCRuntimeReserve
and rodataPointer
fields are not present anymore.
Judging by the git tags, this change was introduced with swift 5.4
Alright, I think I got it fixed. Successfully passes on all swift versions on all linux platforms (see my Action Run, note the swiftlang/swift:nightly-xenial
which is failing. The tag is actually 9 months old and contains a swift 5.3 dev version which seemingly has the changed class metadata layout).
Hello,
wanted to report that the Runtime framework crashes (segfault) when used on linux platforms using a swift compiler >= 5.4. To my analysis, it comes from calling
typeInfo(of:)
for any class type.I noticed this in the environment of our own project https://github.com/Apodini/Apodini/pull/294, but could also easily reproduce it with the provided test cases of the Runtime framework.
The following test cases fail:
GetSetClassTests
: all test cases failMetadataTests
: onlytestClass()
failsFactoryTests
:testClass()
,testGenericClass()
(those fail on all line based swift 5 versions, see #49 and Actions Run)I found that any call to
typeInfo(of:)
with a class type will result in a segfault (see backtrace below). Specifically, it will most certainly fail when evaluating themangledName()
method (inside theClassMetadata.toTypeInfo()
call): https://github.com/wickwirew/Runtime/blob/5b82a3e74bd9fd5dfcad8e6ab8cc3f907aa4e235/Sources/Runtime/Metadata/NominalMetadataType.swift#L43If you uncomment that line it will fail on the next access to the
pointer.pointee.typeDescriptor.pointee
chain (e.g. inNominalMetadataType.numberOfFields
).For context, I created some extensive GitHub Ci (see Supereg/Runtime feature/github-ci branch) which runs the tests cases in all swift 5 version for all common linux distributions available on the Swift DockerHub: GitHub CI Run Overview. It shows that since swift 5.4 every swift release on all linux platforms are affected. I'll plan to create a pull request for that later as well.
Below is an exemplary backtrace of the segfault happening when running the shown command under
xenial
.Happy to help if I can provide any further assistance.