Skip to content

Commit 21ef687

Browse files
[release/10.0] [mono][sgen] Fix card scanning in LOS non-array objects (#125213)
Backport of #125116 to release/10.0 ## Customer Impact - [x] Customer reported - [ ] Found internally In some cases, cards marked for non-array LOS objects (objects with size greater than 8K) were being ignored. This means that the GC could fail to observe that some object refs were stored inside these large objects. This can result in GC crashes or other undefined behavior. This can impact all mono workloads. This issue was confirmed to be hit by a customer who also investigated it via a GC debug flag. There are other undiagnosed GC crashes that might hopefully be fixed by this. ## Regression - [ ] Yes - [x] No ## Testing Was able to create a console app reproducing this bug. Validated the fix. ## Risk Low. The fix just does an address alignment, in order to scan correctly an additional card. Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
1 parent aa66570 commit 21ef687

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/mono/mono/sgen/sgen-cardtable.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ sgen_card_table_region_begin_scanning (mword start, mword size)
203203
{
204204
mword end = start + size;
205205
/*XXX this can be improved to work on words and have a single loop induction var */
206+
start = SGEN_ALIGN_DOWN_TO (start, CARD_SIZE_IN_BYTES);
206207
while (start < end) {
207208
if (sgen_card_table_card_begin_scanning (start))
208209
return TRUE;

0 commit comments

Comments
 (0)