Skip to content

Avoid use of _umul128 on Windows ARM64 (VC-WIN64-ARM)#20235

Closed
jbekkema wants to merge 1 commit intoopenssl:masterfrom
thesparklabs:vs-win64-arm-umul128
Closed

Avoid use of _umul128 on Windows ARM64 (VC-WIN64-ARM)#20235
jbekkema wants to merge 1 commit intoopenssl:masterfrom
thesparklabs:vs-win64-arm-umul128

Conversation

@jbekkema
Copy link

@jbekkema jbekkema commented Feb 8, 2023

_umul128 is unavailable for ARM64 when building using Visual Studio, causing a linker failure when attempting to build for VC-WIN64-ARM. This limits the use of _umul128 to AMD64 builds.

This applies to both OpenSSL 3.0 and OpenSSL 1.1.1.

CLA: trivial

_umul128 is unavailable for ARM64 when building using Visual Studio, causing a linker failure when attempting to build for VC-WIN64-ARM. This limits the use of _umul128 to AMD64 builds.
@openssl-machine openssl-machine added the hold: cla required The contributor needs to submit a license agreement label Feb 8, 2023
@paulidale
Copy link
Contributor

The CLA: trivial needs to be in the commit body on a line by itself. git commit --amend and git push -f recommended.

@paulidale paulidale added branch: master Applies to master branch approval: review pending This pull request needs review by a committer branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) triaged: bug The issue/pr is/fixes a bug cla: trivial One of the commits is marked as 'CLA: trivial' branch: 3.0 Applies to openssl-3.0 branch branch: 3.1 Applies to openssl-3.1 (EOL) tests: exempted The PR is exempt from requirements for testing labels Feb 8, 2023
Copy link
Contributor

@paulidale paulidale left a comment

Choose a reason for hiding this comment

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

Happy to call this trivial.

@paulidale paulidale added the branch: 1.0.2 Applies to OpenSSL_1_0_2-stable branch (EOL) label Feb 8, 2023
@github-actions github-actions bot added the severity: fips change The pull request changes FIPS provider sources label Feb 8, 2023
@levitte levitte added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Feb 8, 2023
@beldmit
Copy link
Member

beldmit commented Feb 8, 2023

CI failure seems irrelevant but needs to be fixed.

Do we consider this fix as urgent?

Copy link
Member

@beldmit beldmit left a comment

Choose a reason for hiding this comment

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

LGTM

@t8m
Copy link
Member

t8m commented Feb 8, 2023

Do we consider this fix as urgent?

It is not a CI breakage, so no, not urgent.

@t8m t8m closed this Feb 8, 2023
@t8m t8m reopened this Feb 8, 2023
@t8m
Copy link
Member

t8m commented Feb 8, 2023

We can amend the commit message when merging. I am OK with CLA: trivial for this.

@t8m t8m removed hold: cla required The contributor needs to submit a license agreement branch: 1.0.2 Applies to OpenSSL_1_0_2-stable branch (EOL) labels Feb 8, 2023
@t8m
Copy link
Member

t8m commented Feb 8, 2023

@paulidale There is no VC-WIN64-ARM target on 1.0.2. I do not think this needs to be backported there.

@paulidale
Copy link
Contributor

paulidale commented Feb 8, 2023

x86 Win has the same problem. So does ARM32 Win.

@jbekkema
Copy link
Author

jbekkema commented Feb 8, 2023

x86 Win has the same problem. So does ARM32 Win.

I don't believe this is the case. The BN_BYTES == 8 confirms it is a 64 bit platform (so x86 is fine), and the _MSC_VER limits it to Visual Studio builds only. I can confirm x86 builds fine without the fix. I have not tested ARM32.

@paulidale
Copy link
Contributor

Yes, x86 32 bit is okay. My mistake. This only impacts AARCH64.

Copy link
Contributor

@tomato42 tomato42 left a comment

Choose a reason for hiding this comment

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

r-, the correct fix is to change the code to use __umulh instead

@tomato42
Copy link
Contributor

tomato42 commented Feb 8, 2023

I've proposed an alternative fix in #20244

@slproweb
Copy link

slproweb commented Feb 8, 2023

@tomato42 This pull request that specifically and narrowly includes one supported/adopted platform and thus keeping other platforms from attempting to use an unsupported intrinsic is, IMO, the better, more immediate solution to getting the build fixed and working even if it doesn't result in the most performant solution. This minor change has also already been signed off on. I think getting the build working for the target is a higher priority while performance related adjustments like your proposed change can be applied in a future release.

@tomato42
Copy link
Contributor

tomato42 commented Feb 8, 2023

@slproweb: I'm the original author of the buggy code. The proper fix, that handles both X64 and ARM64 is not really complex, and the difference in performance of the fallback code vs native instructions is a factor of 5 to 10 (if ARM64 is anything like x86_64 CPUs), you really don't want to use it.

@openssl-machine
Copy link
Collaborator

24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually.

Copy link

@MonkeybreadSoftware MonkeybreadSoftware left a comment

Choose a reason for hiding this comment

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

Works for us.

@mattcaswell
Copy link
Member

Looks like #20244 has been merged in preference. Closing this.

@jbekkema jbekkema deleted the vs-win64-arm-umul128 branch February 12, 2023 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: done This pull request has the required number of approvals branch: master Applies to master branch branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) branch: 3.0 Applies to openssl-3.0 branch branch: 3.1 Applies to openssl-3.1 (EOL) cla: trivial One of the commits is marked as 'CLA: trivial' severity: fips change The pull request changes FIPS provider sources tests: exempted The PR is exempt from requirements for testing triaged: bug The issue/pr is/fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants