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

Restore OpenConsoleProxyStub's dependency on the CRT to fix QI #13254

Merged
5 commits merged into from
Jun 9, 2022

Conversation

DHowett
Copy link
Member

@DHowett DHowett commented Jun 9, 2022

When #13160 introduced a new interface to the IConsoleHandoff idl, it
changed midl's RPC proxy stub lookup algorithm from a direct GUID
comparison to an unrolled binary search. Now, that would ordinarily not
be a problem...

However, in #11610, we took a shortcut and replaced memcmp -- used
only by RPC for GUID comparison -- with a direct GUID-only equality
comparator. This worked totally fine, and ordinarily would not be a
problem...

The unrolled binary search unfortunately relies on memcmp's contract:
it uses memcmp to match against a fully sorted set. Our memcmp only
returned 0 or 1 (equal or not), and it knew nothing about ordering.

When a package that contains a PackagedCOM proxy stub is installed, it
is selected as the primary proxy stub for any interfaces it can proxy.
After all, interfaces are immutable, so it doesn't matter whose proxy
you're using. Now, given that we installed a broken proxy... all
IIDs that got whacked by our memcmp issue broke for every consumer.

To fix it: instead of implementing memcmp ourselves, we're just going to
take a page out of WinAppSDK's book and link this binary using the
"Hybrid CRT" model. It will statically link any parts of the STL it uses
(none) and dynamically link the ucrt (which is guaranteed to be present
on Windows.)

Sure, the binary size goes up from 8k to 24k, but... the cost is never
having to worry about this again.

Closes #13251

@github-actions

This comment was marked as outdated.

supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
than they would otherwise be if the CRT, runtime, and STL were all statically linked in. -->
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrt.lib</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrt.lib</AdditionalOptions>
Copy link
Member

@lhecker lhecker Jun 9, 2022

Choose a reason for hiding this comment

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

The only symbol we need is memcmp on ARM64. The linker would tell us otherwise right?
As such I believe we only need to link ucrt.lib?

Edit: Seems like this doesn't work on ARM64 again.

Copy link
Member

Choose a reason for hiding this comment

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

Edit: Seems like this doesn't work on ARM64 again

Wait, in like, a breaking kind of way? Should we hold this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I think Leonard means his fix doesn't work on ARM64. I've tested this one 😄

Copy link
Member

Choose a reason for hiding this comment

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

okay just wanted to make sure

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

waking up and reading this thread like
200

@ghost ghost added Area-DefApp Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree. labels Jun 9, 2022
@DHowett DHowett marked this pull request as ready for review June 9, 2022 17:24
@DHowett DHowett changed the title WIP Dev/duhowett/fix the proxy stub Restore OpenConsoleProxyStub's dependency on the CRT to fix QI Jun 9, 2022
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jun 9, 2022
@ghost
Copy link

ghost commented Jun 9, 2022

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@DHowett

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@DHowett

This comment was marked as resolved.

@carlos-zamora
Copy link
Member

Do we need to mark this up for servicing at all or nah?

@DHowett
Copy link
Member Author

DHowett commented Jun 9, 2022

Nah, this change isn't in any of our releases yet.

@ghost ghost merged commit cd35bc5 into main Jun 9, 2022
@ghost ghost deleted the dev/duhowett/fix-the-proxy-stub branch June 9, 2022 19:48
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-DefApp AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The DxD markers broke defterm entirely
4 participants