Skip to content
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

Call the Copy Constructor for stack arguments in C++/CLI on x86 #100050

Merged
merged 12 commits into from
Mar 24, 2024

Conversation

jkoritzinsky
Copy link
Member

Fixes #100033

@jkotas
Copy link
Member

jkotas commented Mar 21, 2024

I'll look at writing the assembly stub for Linux_x86

I do not think we want to be enabling any of this on Linux x86. This is Windows-only feature to support IJW.

@jkoritzinsky
Copy link
Member Author

I'll look at writing the assembly stub for Linux_x86

I do not think we want to be enabling any of this on Linux x86. This is Windows-only feature to support IJW.

If we're looking at backporting this to .NET 8 (which I believe we are given where this issue originated, I really don't want to break back-compat here as we already know that customers do strange things and are prone to using features we never thought they would. I'd rather write the 5 lines of code to get this to compile equally everywhere than remove what currently exists.

@AaronRobinsonMSFT
Copy link
Member

AaronRobinsonMSFT commented Mar 21, 2024 via email

@AaronRobinsonMSFT
Copy link
Member

@jkotas I am good with this change based on Jeremy's response in #100050 (comment). Do you have concerns moving forward, for now, as is or is removing the non-Windows support a hard requirement?

@AaronRobinsonMSFT AaronRobinsonMSFT self-assigned this Mar 22, 2024
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 9.0.0 milestone Mar 22, 2024
@jkotas
Copy link
Member

jkotas commented Mar 23, 2024

The change includes Linux x86 specific code. What kind of testing have we done on this change on Linux x86? If we have not tested it, we should not be pushing it to servicing and limit it to Windows x86 instead (e.g. find&replace the ifdefs around the changes with TARGET_X86 && TARGET_WINDOWS).

I am fine with cleaning up IJW-specific features that leaked to non-Windows later. It may be nice to introduce a FEATURE_ define for it (we used to have one in the old days).

@AaronRobinsonMSFT
Copy link
Member

The change includes Linux x86 specific code. What kind of testing have we done on this change on Linux x86?

There is a test case that runs on all platforms. I'm not convinced it should be there, but it does exist and runs/passes.

@jkotas
Copy link
Member

jkotas commented Mar 23, 2024

There is a test case that runs on all platforms. I'm not convinced it should be there, but it does exist and runs/passes.

The CI does not run any tests on Linux x86.

@AaronRobinsonMSFT
Copy link
Member

AaronRobinsonMSFT commented Mar 23, 2024

There is a test case that runs on all platforms. I'm not convinced it should be there, but it does exist and runs/passes.

The CI does not run any tests on Linux x86.

Shoot. I saw Linux x86 and assumed it was testing too, the leg is just build. Well this sucks. Let me see what I can do here.

@AaronRobinsonMSFT
Copy link
Member

@jkotas PTAL

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AaronRobinsonMSFT
Copy link
Member

/backport to release/8.0-staging

Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/8412095170

Copy link
Contributor

@AaronRobinsonMSFT backporting to release/8.0-staging failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Add repro test case
Applying: Directly load the argument address using ldarga to avoid making a copy
Using index info to reconstruct a base tree...
M	src/coreclr/vm/ilmarshalers.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/vm/ilmarshalers.cpp
Applying: Reimplement the "Copy Constructor Cookie" logic in a more modern and maintainable style to get the test passing again
error: sha1 information is lacking or useless (src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 Reimplement the "Copy Constructor Cookie" logic in a more modern and maintainable style to get the test passing again
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

@AaronRobinsonMSFT an error occurred while backporting to release/8.0-staging, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

AaronRobinsonMSFT added a commit that referenced this pull request Mar 30, 2024
…n C++/CLI on x86 (#100221)

* Call the Copy Constructor for stack arguments in C++/CLI on Windows-x86 (#100050)

* Add repro test case

* Directly load the argument address using ldarga to avoid making a copy

* Reimplement the "Copy Constructor Cookie" logic in a more modern and maintainable style to get the test passing again

* Narrow support to Windows only

---------

Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C++/CLI x86 marshalling misses copy ctor/dtor calls resulting in C++ STL iterator debugging breaking
3 participants