Commit Graph

4 Commits

Author SHA1 Message Date
Kavon Farvardin
bfb4fc014f test: fix crash when using NCGenerics 2024-02-08 22:53:33 -08:00
Arnold Schwaighofer
679a4d8cc1 Add fixes test/SILOptimizer test 2023-06-20 13:15:31 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Andrew Trick
29b9e51cb6 Remove ReadNone attribute from runtime functions
The Swift compiler incorrectly sets the LLVM "ReadNone" attribute when
declaring swift_getObjCClassFromObject and swift_projectBox. This
means that the LLVM ARC optimizer will hoist ARC "release" operations
above these runtime calls. Since the implementation of the calls reads
the object, this causes a use-after-free crash.

This problem is easy to reproduce with
swift_getObjCClassFromObject. It was only exposed recently because the
SIL optimizer now shrinks object lifetimes, making it easier for LLVM
optimizations to kick in. It is difficult to expose the problem with
swift_projectBox, but the bug/fix is still obvious.

Fixes rdar://73820091: Use-after free application crash.
2021-02-08 14:53:24 -08:00