Port #22775 into release/2.1#24858
Conversation
…dotnet#22775) * Set flag in comp info to signal that a caller has >8 byte struct args This will be used by fgCanFastTailCall to correctly determine whether an arm64 or x64 linux caller/callee can fastTailCall. It is also a workaround to #12468 to catch early any slot shuffling that would happen in LowerFastTailCall. Which currently assumes all parameters are one slot size. * Address feedback * Apply format patch * Add comment * apply new format patch
DescriptionWhen running on x64 unix, in code that creates a valid fastTailCall candidate which has a >8 byte <17 byte struct and requires the caller to use stack space, we will correctly setup the incoming and outgoing arguments to pass an 8 byte struct in two registers. However, due to #12468, an algorithm which relies on properties of the Windows ABI we will incorrectly setup setup the outgoing arguments to the callee. Customer ImpactThis bug causes a crash in Automapper running x64 *nix on .Net Core 2.1 and .Net Core 2.2 Regression?This is not a regression, the bug has existed since release/1.0. It was an bug that was not caught during x64 unix bringup. RiskThis bug in release will at best crash, at worse it will produce silent bad codegen. Which would most likely copy in junk off the frame into random arguments passed to the caller. Worst case is it would copy in somewhat valid junk and produce unexpected results. That being said it requires a few unique things to create the error:
|
|
/cc @RussKeldorph @AndyAyersMS note I am currently manually testing the fix on Windows x64 and Unix x64. This change technically affects arm64, but I am opting to not test on the platform as it is not supported for release/2.1 |
|
Windows testing is not currently possible in 2.1 due to https://github.com/dotnet/coreclr/issues/24922. This change has little risk to regress Windows, and has been tested in master. I will continue working on https://github.com/dotnet/coreclr/issues/24922 and run the tests manually after. |
|
Windows has been tested, no regressions from this change. Will merge to 2.2 |
* Set flag in comp info to signal that a caller has >8 byte struct args (#22775) * Set flag in comp info to signal that a caller has >8 byte struct args This will be used by fgCanFastTailCall to correctly determine whether an arm64 or x64 linux caller/callee can fastTailCall. It is also a workaround to #12468 to catch early any slot shuffling that would happen in LowerFastTailCall. Which currently assumes all parameters are one slot size. * Address feedback * Apply format patch * Add comment * apply new format patch * Address feedback and add header
Port #22775 into release/2.1
Fixes #24676
Set flag in comp info to signal that a caller has >8 byte struct args
This will be used by fgCanFastTailCall to correctly determine whether an arm64
or x64 linux caller/callee can fastTailCall. It is also a workaround to #12468 to catch early any slot shuffling that would happen in LowerFastTailCall. Which currently assumes all parameters are one slot size.