Skip to content

Conversation

@dlibby-
Copy link
Contributor

@dlibby- dlibby- commented Nov 21, 2017

(courtesy of Bo Cupp)

Fixing two issues in marking.

  1. If there are only precisely traced objects allocated, the markStack used for non-precisely traced objects will be empty and crash when Pop is called. An IsEmpty check was added to prevent popping from an empty stack.
  2. A race between allocating and background marking can lead to calling a virtual Trace method on an object that has a null v-table pointer. It isn't possible to call trace until after a flag has been set by the allocator, so prior to that happening a dummy v-table pointer is now installed until control returns to the caller of the recycler's alloc method where a final v-table pointer will overwrite the dummy one. This must be done with a MemoryBarrier on ARM to guarantee the writing of the v-table happens before the attribute updates.

We also need to fixup the address in FillCheckPad
We were tripping an assert that the v-table doesn't match the padding pattern. Because we install
the v-table earlier, there's a new mode for FillCheckPad where the first void* bytes should be skipped.
The object is not initialized, but already has a valid v-table that doesn't need to be verified and shouldn't
be 0-filled.

(courtesy of Bo Cupp)

Fixing two issues in marking.

1. If there are only precisely traced objects allocated, the markStack used for non-precisely traced objects will be empty and crash when Pop is called.  An IsEmpty check was added to prevent popping from an empty stack.
2. A race between allocating and background marking can lead to calling a virtual Trace method on an object that has a null v-table pointer.  It isn't possible to call trace until after a flag has been set by the allocator, so prior to that happening a dummy v-table pointer is now installed until control returns to the caller of the recycler's alloc method where a final v-table pointer will overwrite the dummy one. This must be done with a MemoryBarrier on ARM to guarantee the writing of the v-table happens before the attribute updates.

We also need to fixup the address in FillCheckPad
We were tripping an assert that the v-table doesn't match the padding pattern. Because we install
the v-table earlier, there's a new mode for FillCheckPad where the first void* bytes should be skipped.
The object is not initialized, but already has a valid v-table that doesn't need to be verified and shouldn't
be 0-filled.
@dlibby- dlibby- requested a review from curtisman November 21, 2017 22:25
@chakrabot chakrabot merged commit f7c815a into chakra-core:release/1.8 Nov 22, 2017
chakrabot pushed a commit that referenced this pull request Nov 22, 2017
…king

Merge pull request #4290 from dlibby-:build/dlibby/dummyvtable_fix_1.8

(courtesy of Bo Cupp)

Fixing two issues in marking.

1. If there are only precisely traced objects allocated, the markStack used for non-precisely traced objects will be empty and crash when Pop is called.  An IsEmpty check was added to prevent popping from an empty stack.
2. A race between allocating and background marking can lead to calling a virtual Trace method on an object that has a null v-table pointer.  It isn't possible to call trace until after a flag has been set by the allocator, so prior to that happening a dummy v-table pointer is now installed until control returns to the caller of the recycler's alloc method where a final v-table pointer will overwrite the dummy one. This must be done with a MemoryBarrier on ARM to guarantee the writing of the v-table happens before the attribute updates.

We also need to fixup the address in FillCheckPad
We were tripping an assert that the v-table doesn't match the padding pattern. Because we install
the v-table earlier, there's a new mode for FillCheckPad where the first void* bytes should be skipped.
The object is not initialized, but already has a valid v-table that doesn't need to be verified and shouldn't
be 0-filled.
chakrabot pushed a commit that referenced this pull request Nov 22, 2017
…es during marking

Merge pull request #4290 from dlibby-:build/dlibby/dummyvtable_fix_1.8

(courtesy of Bo Cupp)

Fixing two issues in marking.

1. If there are only precisely traced objects allocated, the markStack used for non-precisely traced objects will be empty and crash when Pop is called.  An IsEmpty check was added to prevent popping from an empty stack.
2. A race between allocating and background marking can lead to calling a virtual Trace method on an object that has a null v-table pointer.  It isn't possible to call trace until after a flag has been set by the allocator, so prior to that happening a dummy v-table pointer is now installed until control returns to the caller of the recycler's alloc method where a final v-table pointer will overwrite the dummy one. This must be done with a MemoryBarrier on ARM to guarantee the writing of the v-table happens before the attribute updates.

We also need to fixup the address in FillCheckPad
We were tripping an assert that the v-table doesn't match the padding pattern. Because we install
the v-table earlier, there's a new mode for FillCheckPad where the first void* bytes should be skipped.
The object is not initialized, but already has a valid v-table that doesn't need to be verified and shouldn't
be 0-filled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants