libobjc2: objc_msgSend test segfaults on 1.9 branch on aarch64 with clang 6

Both objc_msgSend and objc_msgSend_optimised are segfaulting in the libobjc2 fest on my aarch64 machine. I’m using the 1.9 branch and clang 6.

Those are the only two tests that fail.

Do you have recommendations on how to diagnose this?

Thank you.

70/70 Test #70: ObjCXXEHInterop_optimised ..................   Passed    0.02 sec

97% tests passed, 2 tests failed out of 70

Total Test time (real) =  89.19 sec

The following tests FAILED:
         49 - objc_msgSend (SEGFAULT)
         50 - objc_msgSend_optimised (SEGFAULT)
Errors while running CTest
Makefile:140: recipe for target 'test' failed
make: *** [test] Error 8

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (19 by maintainers)

Commits related to this issue

Most upvoted comments

So, it turned out that there were three things wrong with the AArch64 version of objc_msgSend that led to failures in this test. All of these are fixed now.

I think the newer clang is actually just masking the bug. It appears as if the stack pointer after the exception is thrown is 16 above where it should be.

With a fix to that code, the test now runs to the end, but crashes after the return. It looks as if there may have been some stack corruption along the way still…

Trying the same test with clang-8, it still crashes but much later. In particular, the exception-related stuff all appears to work correctly. The crash happens in the call in objc_msgSend.m:212. This is interesting, because that test should be hitting all of the fast paths in the assembly: it isn’t throwing an exception, the dtable is already installed, and so on. The only thing special in that example is the use of the small objects (requiring it to get the class from a small look-aside table instead of from the [nonexistent] isa pointer).

I’m tempted to write off the other failure as clang-6 generating broken unwind info…

This test checks a lot of things, can you see which assertion is failing?