Uh oh!
There was an error while loading. Please reload this page.
JIT: Disallow mismatched GC-ness for physical promotions - #90694
Conversation
Physical promotion was working under the assumption that reinterpreting
GC pointers is undefined behavior, and would happily promote GC pointers
as integers if it saw such accesses. However, physical promotion is
function wide while the UB accesses can be happening in a restricted
(dynamically unreachable) scope. This exact situation happens in
MemoryExtensions.Contains. The issue was uncovered under jit stress
where we did not fold away the guard early enough, meaning that
promotion then saw a `TYP_LONG` access of a `struct { object, int }` and
proceeded to promote it as such.
Fixdotnet#90602ghost
commented
Aug 16, 2023
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsPhysical promotion was working under the assumption that reinterpreting GC pointers is undefined behavior, and would happily promote GC pointers as integers if it saw such accesses. However, physical promotion is function wide while the UB accesses can be happening in a restricted (dynamically unreachable) scope. This exact situation happens in MemoryExtensions.Contains. The issue was uncovered under jit stress where we did not fold away the guard early enough, meaning that promotion then saw a Fix #90602 No diffs are expected.
|
Uh oh!
There was an error while loading. Please reload this page.
jakobbotsch
commented
Aug 17, 2023
jakobbotsch
commented
Aug 17, 2023
Can't hurt to add it to the general helper function. |
jakobbotsch
commented
Aug 17, 2023
/azp backport to release/8.0 |
jakobbotsch
commented
Aug 17, 2023
/backport to release/8.0 |
Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/5892120122 |
Physical promotion was working under the assumption that reinterpreting GC pointers is undefined behavior, and would happily promote GC pointers as integers if it saw such accesses. However, physical promotion is function wide while the UB accesses can be happening in a restricted (dynamically unreachable) scope. This exact situation happens in MemoryExtensions.Contains. The issue was uncovered under jit stress where we did not fold away the guard early enough, meaning that promotion then saw a
TYP_LONGaccess of astruct { object, int }and proceeded to promote it as such.Fix#90602
No diffs are expected.