Skip to content

Tidy up aarch64 feature detection code in armcap.c - #20948

Closed
oraluben wants to merge 1 commit into
openssl:openssl-3.1from
oraluben:cherry-pick-probe-3.1
Closed

oraluben wants to merge 1 commit into
openssl:openssl-3.1from
oraluben:cherry-pick-probe-3.1

Conversation

@oraluben

@oraluben oraluben commented May 12, 2023 •

Copy link
Copy Markdown

Cherry-picked from 52a3814.

Fixes #20188 for version 3.1.

The preliminary probe is not in 3.0 yet, so there's no need to cherry-pick this "fix" yet.
If applying all the changes in 3.0 is another topic.

Also: #20188 (comment)

Make the SIGILL-based code easier to read, and don't use it on Apple Silicon.

Also fix "error: 'HWCAP(2)_*' macro redefined" warnings on FreeBSD.

Fixes openssl#20188

Change-Id: I5618bbe9444cc40cb5705c6ccbdc331c16bab794

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
(Merged from openssl#20305)

(cherry picked from commit openssl@52a3814)
@oraluben
oraluben marked this pull request as ready for review May 12, 2023 09:58

@tom-cosgrove-arm tom-cosgrove-arm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM (but I am the author of the original change!)

@tom-cosgrove-arm tom-cosgrove-arm added approval: otc review pending hold: discussion The community needs to establish a consensus how to move forward with the issue or PR severity: fips change The pull request changes FIPS provider sources branch: 3.1 Applies to openssl-3.1 (EOL) tests: exempted The PR is exempt from requirements for testing labels May 12, 2023
@tom-cosgrove-arm

tom-cosgrove-arm commented May 12, 2023 •

Copy link
Copy Markdown
Contributor

Not sure if this should be triaged: bug, triaged: feature or triaged: refactor, (and it's not severity: fips change)

@github-actions github-actions Bot removed the severity: fips change The pull request changes FIPS provider sources label May 12, 2023
@t8m t8m added the triaged: refactor The issue/pr requests/implements refactoring label May 12, 2023
@paulidale

paulidale commented May 14, 2023 •

Copy link
Copy Markdown
Contributor

OTC: should this be back ported to 3.1?

Is any of this relevant to 3.0 as well? It's not entirely clear from the discussion.

@h-vetinari

Copy link
Copy Markdown
Contributor

@paulidale: Is any of this relevant to 3.0 as well? It's not entirely clear from the discussion.

@oraluben posted an analysis in the python issue:

tldr: now, and hopefully only openssl 3.1.0 is affected.

Some instruction probing logic breaks debugging in darwin-aarch64, these commits are in the dev branch of openssl (master, SVE: b1b2146, RNG: efa1f22), and have been cherry-picked to 3.1 release branch (openssl-3.1, SVE: a14eff6, RNG: 45c74dea). They haven't been cherry-picked to 3.0, so openssl 3.0.x is not affected.

The fix (52a3814) is also in master, I submitted a PR to cherry-pick it in 3.1 (#20948), if it's merged, the only affected version would be 3.1.0. I guess 3.0.x would be ok forever, if openssl decided to apply those instruction tests I expect they won't forget the corresponding fix.

@oraluben

oraluben commented May 15, 2023 •

Copy link
Copy Markdown
Author

@paulidale: OTC: should this be back ported to 3.1?

I don't know the policies that OTC follow to make such decision. From the perspective of a developer, darwin-aarch64 is a noticeable platform that should not be ignored. Debugging is also a rather normal use case. OpenSSL 3.1 will be the default version shipped by brew in most case (openssl@3 points to [email protected] by default in brew).

So it's definitely not so hard to run into this. I do think it is worth back-porting.

I just found https://www.openssl.org/policies/technical/stable-release-updates.html. Although it's a refactor, I think it should be merged as a bug fix (of a crash)?

@t8m

t8m commented May 15, 2023

Copy link
Copy Markdown
Member

The SIGILLs are not detected on Apple platforms with 3.0, because the features tested in that version are supported on Apple HW and thus they do not trigger SIGILLs.

@t8m

t8m commented May 16, 2023

Copy link
Copy Markdown
Member

OTC: This is major refactoring of the CPU feature detection code. We are not inclined to merge this to 3.1 unless this is having a major impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch: 3.1 Applies to openssl-3.1 (EOL) hold: discussion The community needs to establish a consensus how to move forward with the issue or PR tests: exempted The PR is exempt from requirements for testing triaged: refactor The issue/pr requests/implements refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants