You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[mono][s390x] Wrong implementation of OP_CHECK_THIS #76915
As described here #75996 (comment) I've seen frequent crashes with rc1 on s390x (Mono-based big-endian platform) - these were all segmentation faults in SpanHelpers.IndexOfValueType called from various different places, caused by accessing beyond the end of a page into an unmapped page.
The symptom disappeared after the SpanHelper changes were reverted on Mono, so I initially thought it was somehow a problem in those changes. However, as it turns out, the real underlying problem is a Mono codegen bug on s390x.
The accesses that span the page boundary turn out to be emitted from the implementation of the OP_CHECK_THIS opcode. This is intended to perform a memory access, just to see if this triggers a segmentation fault if the incoming pointer was invalid. However, the OP_CHECK_THIS implementation currently always emits an 8-byte memory access - potentially resulting in a false positive if the pointer was valid, but only to access less than 8 bytes.
This should be fixed by changing OP_CHECK_THIS to only access a single byte. I'll submit a PR to that effect shortly.
This should probably be backported to .NET 7 as well, even though ithe bug no longer triggers in the runtime itself - it could still be triggered by other code.
This should probably be backported to .NET 7 as well, even though ithe bug no longer triggers in the runtime itself - it could still be triggered by other code.
I've opened the backport PR but as far as I know it's too late for 7.0 release so it'll have to wait for 7.0.1 servicing
Activity
[mono][s390x] Fix wrong implementation of OP_CHECK_THIS (#76916)
akoeplinger commentedon Oct 12, 2022
I've opened the backport PR but as far as I know it's too late for 7.0 release so it'll have to wait for 7.0.1 servicing
[mono][s390x] Fix wrong implementation of OP_CHECK_THIS
[mono][s390x] Fix wrong implementation of OP_CHECK_THIS (#76920)