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

Use QEMU v8 for emulated platforms #125

Merged
merged 1 commit into from
Feb 3, 2025
Merged

Conversation

nightlark
Copy link
Contributor

@nightlark nightlark commented Jan 24, 2025

Something has changed, potentially related to some piece of software installed on the standard GitHub Actions runner image that is causing arbitrary programs running under qemu emulation to segfault. It doesn't look like there was any update to the manylinux images for these platforms that would cause this, so the root cause is still a mystery.

Switching to using the binfmt QEMU v8 images seems to resolve the issue. Or at least using v8 makes the segfaults infrequent enough that builds are at least able to finish (builds with v7 of QEMU segfault consistently, v8 is at least able to run builds to completion and I haven't seen segfaults yet... there's just not enough data yet to say conclusively that there will never be intermittent segfaults).

Resolves #124

josephleekl added a commit to PennyLaneAI/pennylane-lightning that referenced this pull request Jan 29, 2025
### Before submitting

Please complete the following checklist when submitting a PR:

- [ ] All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to
the
      [`tests`](../tests) directory!

- [ ] All new functions and code must be clearly commented and
documented.
If you do make documentation changes, make sure that the docs build and
      render correctly by running `make docs`.

- [ ] Ensure that the test suite passes, by running `make test`.

- [x] Add a new entry to the `.github/CHANGELOG.md` file, summarizing
the
      change, and including a link back to the PR.

- [ ] Ensure that code is properly formatted by running `make format`. 

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


------------------------------------------------------------------------------------------------------------

**Context:**
The [aarch64 wheel build CI action has been
failing](https://github.com/PennyLaneAI/pennylane-lightning/actions/workflows/wheel_linux_aarch64.yml)
since circa 24 Jan 2025. They fail with a segmentation fault during the
CIBW process. This has also been observed for similar wheel builds with
QEMU with other repositories:
docker/setup-qemu-action#188
ssciwr/clang-format-wheel#124
tonistiigi/binfmt#215
tonistiigi/binfmt#165
and fix attempt:
ssciwr/clang-format-wheel#125

It is due to using an old version (v7) of qemu that comes with binfmt.
`setup-qemu-action` by default uses `binfmt:latest` image which has not
been updated in 2 years.

**Description of the Change:**
Use a newer QEMU image (v8) from binfmt.

**Benefits:**
aarch64 wheel builds will succeed again,
[e.g.](https://github.com/PennyLaneAI/pennylane-lightning/actions/runs/13019772888?pr=1056)
**Possible Drawbacks:**

**Related GitHub Issues:**

[sc-83297]

---------

Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>
@nightlark
Copy link
Contributor Author

Hi @lkeegan, anything else you want to see here (and the other open PR)?

The underlying cause of the qemu segfaults seems to be a change to the OS/kernel used by the GitHub runner VMs and qemu being built with --disable-pie which isn't happy with aslr (tonistiigi/binfmt#215 (comment)) on Ubuntu systems. Newer versions of qemu after 8.1 appear to have a patch that mitigates the issue. From the looks of it, there aren't any plans to update the tonistiigi/binfmt:latest tag to point to qemu v8 instead of v7, and setup-action-qemu doesn't seem to have plans of switching their default label to anything newer.

@lkeegan
Copy link
Member

lkeegan commented Feb 3, 2025

@nightlark thanks lgtm!

@lkeegan lkeegan merged commit 478012f into ssciwr:main Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segfaults for builds using QEMU
2 participants