-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix Sve test templates to avoid buffer overrun #113113
Conversation
/azp run runtime-coreclr gcstress-extra |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-coreclr gcstress-extra |
Azure Pipelines successfully started running 1 pipeline(s). |
windows-arm64 leg is passing. There is currently linux infra issue because of which other linux are failing. I will wait for it to resolve before scheduling another run, but the changes in this PR should fix the original issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
@dotnet/arm64-contrib |
/azp run runtime-coreclr gcstress-extra |
Azure Pipelines successfully started running 1 pipeline(s). |
This one uses a different template?
I was looking at So there might be more to fix. |
This doesn't have problems because it is operating on correct size. Latest gcstress runs are passing. |
@amanasifkhalid @dotnet/jit-contrib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I'm guessing the Unsafe.SizeOf
result was including padding or something?
not really. The destination was sometimes just 4 bytes (e.g. array of |
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{RetVectorType}<{Op2BaseType}>>()); | ||
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>()); | ||
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)(sizeof({Op2BaseType}) * RetElementCount)); | ||
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)(sizeof({RetBaseType}) * RetElementCount)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why the test should've used the safe Span.CopyTo
🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree. There are 1000+ places where we are using Unsafe.CopyBlockUnaligned
and should change to something reliable.
Fixes: #112463