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

Fix illegal instruction on RPi 4 #2223

Merged
merged 3 commits into from
Feb 19, 2024
Merged

Fix illegal instruction on RPi 4 #2223

merged 3 commits into from
Feb 19, 2024

Conversation

julianoes
Copy link
Collaborator

The absl library tries to make use of the crypto libraries on arm64 platforms. However, it turns out that the RPi 4 chip does not have the crypto extensions. Hence, we need to patch absl to refrain from using the hardware crypto stuff and fallback to slower software implementations. This is only required for a random back-off timer at the moment, so shouldn't matter too much.

Note that the RPi 5 has the crypto extensions but our build is the same for both.

Fixes mavlink/MAVSDK-Python#654.
Fixes mavlink/MAVSDK-Python#651.

Just doing this before applying a patch.

Signed-off-by: Julian Oes <[email protected]>
The absl library tries to make use of the crypto libraries on arm64
platforms. However, it turns out that the RPi 4 chip does not have
the crypto extensions. Hence, we need to patch absl to refrain from
using the hardware crypto stuff and fallback to slower software
implementations. This is only required for a random back-off timer at
the moment, so shouldn't matter too much.

Note that the RPi 5 has the crypto extensions but our build is the same
for both.

Signed-off-by: Julian Oes <[email protected]>
@JonasVautherin
Copy link
Collaborator

JonasVautherin commented Feb 16, 2024

Isn't it the same as abseil/abseil-cpp#662? Weird that they seem to have fixed it 🤔.

In any case, if there really is a need for a patch, I would do it only for the relevant platform. But I wonder if that could not be solved somehow with ABSL_RANDOM_HWAES_ARM64_FLAGS, which is apparently used here 🤔. Or could it be the case that nobody uses absl with the RPi4? That would surprise me 😅. E.g. here they seem to have made it work for RPi4...

@akrv
Copy link

akrv commented Feb 16, 2024

waiting for this fix 🤞

@julianoes
Copy link
Collaborator Author

@JonasVautherin it looks related. I'm not sure. What I found is that hardware crypto is enabled for aarch64, and that might make sense for most platforms, but the Broadcom BCM2711 chip is lacking the crypto extensions.

@julianoes
Copy link
Collaborator Author

Of course updating absl was a mistake and it breaks the build. Gosh I hate dependencies.

@julianoes julianoes merged commit 07d2433 into main Feb 19, 2024
27 checks passed
@julianoes julianoes deleted the pr-absl-fix branch February 19, 2024 21:51
@ilysec
Copy link

ilysec commented Feb 20, 2024

Seems to work, thanks a lot!

@alltilla
Copy link

Thank you, we faced the exact same issue in AxoSyslog running in an alpine based container on an RPi4. This PR was a good confirmation for us. :)

P.S.: OpenSSL does runtime checks in init time to determine which CPU features are available on the runner host for certain operations, it would be nice to have something similar in the upstream libabseil, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Illegal instruction (core dumped) 1.4.9 to 2.x
5 participants