Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dotnet/runtime
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5a2df34
Choose a base ref
...
head repository: dotnet/runtime
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5d0817a
Choose a head ref
  • 4 commits
  • 17 files changed
  • 4 contributors

Commits on Apr 13, 2021

  1. Configuration menu
    Copy the full SHA
    dc7571c View commit details
    Browse the repository at this point in the history
  2. Fix card mark stealing issue (#51104)

    Fix issue with card marking stealing where getting a new chunk caused the "card" variable to go backwards. This caused an extra call to card_transition, which in turn caused cards to be cleared that should be set. The ultimate result is memory corruption.
    
    Here are the conditions that cause the bug to surface:
    - an object containing pointers that straddles a 2 MB boundary
    - the objects contains just value types (i.e. no pointers) for at least 256 bytes after the 2 MB boundary
    - there is a generation-crossing pointer afterwards in the same object
    - but that is the only generation-crossing pointer in that 256 byte range
    
    The bug comes about because of the following sequence of events:
    - in mark_through_cards_for_segments, we scan an object at the end of a 2 MB chunk
    - we encounter a pointer location that is already outside of that chunk (it belongs to card 2 in the next chunk)
    - we call card_transition, which advances the card to the card of the pointer location (i.e., to card 2 in the next chunk)
    - we realize that we need to get a new chunk
    - when we get the chunk, we set the card to card 0 in the chunk
    - we return to mark_through_cards_for_segments
    - as the next chunk is adjacent to the current one, we continue processing the current object
    - when we encounter the next pointer location in the object, we trigger a card_transition again
    - this will erroneously not clear cards 0 and 1 because we think it there is a cross-gen pointer
    - it will also reset the cross-gen generation pointer counter
    - thus, if there are no other cross-generation pointers in the 256 bytes described by card 2, card 2 will be erroneously cleared
    - having cards cleared erroneously ultimately leads to heap corruption
    
    The fix simply makes sure the "card" variable doesn't go backwards in find_next_chunk.
    
    It fixes the issue because it avoids the double card_transition.
    
    It is safe because during iteration of a segment, the "card" variable must always increase. When we switch to another segment, it may decrease, but that is fine because in this case it will be re-initialized by the logic in mark_through_cards_segments.
    PeterSolMS authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    b1f7ca4 View commit details
    Browse the repository at this point in the history
  3. Separate GetResourceString method with defaultString value. (#51073)

    It's not used in Release build and it injects ununsed null value to every callsite
    marek-safar authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    5a3da7d View commit details
    Browse the repository at this point in the history
  4. Return iOS version in Environment.OSVersion on Mac Catalyst (#50990)

    * Return iOS version in Environment.OSVersion on Mac Catalyst.
    Implement OperatingSystem.IsMacCatalyst and OperatingSystem.IsMacCatalystVersionAtLeast.
    
    * Address feedback
    
    * Ensure NSThread is in multi-threaded mode before using autorelease pool
    filipnavara authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    5d0817a View commit details
    Browse the repository at this point in the history
Loading