-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[release/7.0-rc2] Fixing SpanHelpers.LastIndexOfAnyValueType to no longer create out of bounds GC refs #75885
[release/7.0-rc2] Fixing SpanHelpers.LastIndexOfAnyValueType to no longer create out of bounds GC refs #75885
Conversation
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Tagging subscribers to this area: @dotnet/area-system-memory Issue DetailsBackport of #75857 to release/7.0-rc2 /cc @tannergooding Customer ImpactTestingRiskIMPORTANT: Is this backport for a servicing release? If so and this change touches code that ships in a NuGet package, please make certain that you have added any necessary package authoring and gotten it explicitly reviewed.
|
@rainersigwald does the stack below simply mean that a child process couldn't start for some reason (not necessarily MSBuild issue)?
|
That is a good question. @rokonec / @AR-May / @MichalPavlik? I'm not super familiar with this area but it looks to me like this is before we even try to create a new process. I don't know why creating a mutex would fail with a timeout--that's not one of the common failures in the docs. |
cc @mmitche - We still have the above failure to figure out. This is the last RC2 PR backport to merge today. |
Is the failure happening consistently? And is that MSBuild running on a just-built runtime, or the "LKG" one from the SDK? |
I just remembered that the failure mentioned above in MSBuild is happening in other PRs. I had already opened this issue yesterday: #75867 So we can consider it unrelated to this change.
|
This other failure is also unrelated to this change. It's being tracked in this issue: #75391
|
CI failures are unrelated, pre-existing: #75391 |
* Fix querying L3 cache size on osx-x64 (#75870) Co-authored-by: Filip Navara <navara@emclient.com> * KeyChar should be preserved for Ctrl+Letter (#75861) Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com> * Try re-enabling System.Transactions.Local tests on Arm64 (#75703) Co-authored-by: Jan Kotas <jkotas@microsoft.com> * Updating inbox source generators to Roslyn 4.4 and removing polyfill approach (#75717) (#75875) * Removed internalProperties group from proxy and tests. (#75906) Co-authored-by: Ilona Tomkowicz <itomkowicz@microsoft.com> * [release/7.0-rc2] Fixing SpanHelpers.LastIndexOfAnyValueType to no longer create out of bounds GC refs (#75885) * Fixing SpanHelpers.LastIndexOfAnyValueType to no longer create out of bounds GC refs * Apply suggestions from code review Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com> * Adjusting the comment as per PR review feedback Co-authored-by: Tanner Gooding <tagoo@outlook.com> Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com> * Bump intellisense package for RC2 to include latest comments for Numerics (#75938) Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com> * [release/7.0-rc2] [Mono] Restore old code to solve the recent SpanHelpers regressions (#75996) * bring back the old code... * bring back more old code * Use an ifdef around clr code instead of a separate file * Delete SpanHelpers.Clr.cs * Remove a remaining INumber<T> helper from mono Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com> Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Filip Navara <navara@emclient.com> Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com> Co-authored-by: Jan Kotas <jkotas@microsoft.com> Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com> Co-authored-by: Ilona Tomkowicz <itomkowicz@microsoft.com> Co-authored-by: Tanner Gooding <tagoo@outlook.com> Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com> Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com> Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
Backport of #75857 to release/7.0-rc2
/cc @tannergooding
Customer Impact
Customers utilizing the
Span<T>.LastIndexOf
APIs may get invalid results. This is due to a "GC Hole" in the algorithm caused by creating abyref
that points to before the managed object it was originally meant to be tracking.Testing
In addition to the existing tests, additional manual testing was done to validate the logic no longer causes a crash under
GCStress=0xC
Risk
The new logic avoids the GC hole by tracking a byref + offset rather than mutating the byref each iteration. This ensures we don't end up with an exterior byref and thus avoids the GC hole entirely.