-
Notifications
You must be signed in to change notification settings - Fork 227
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
Unit tests segfault on s390x #338
Comments
I have tried to narrow down the problem, and it appears that the segfault is caused in Python itself, and not in unsafe Rust code from this project. I found at least one instance of hard-coded constants that are only valid on little-endian systems:
The values of these bitmasks dressed up as u32s is only correct on little-endian systems but wrong on big-endian systems. I have seen bugs like this one cause crashes of Python before in both rust-python and pyo3:
Both issues are still unresolved (the https://github.com/python/cpython/blob/v3.11.2/Include/cpython/unicodeobject.h#L149-L204 The exact positions of these flags will be different on little-endian and big-endian architectures, but I think it should be possible to map this C bitfield to a Rust bitmask correctly (the indices for the different fields will just be different depending on LE or BE). EDIT: Oh, and of course, what's even worse: The memory layout of bitfields is not standardized, with most aspects being "implementation defined" in the C standards. |
Thanks for the report. The problem is shown by adding |
This is still not fixed with 3.8.7. The tests segfault at the exact same place. Please reopen the issue. |
Hi. I'm trying to build an orjson RPM package for Fedora Linux. We build for x86_64, i686, powerpc64le, aarch64, and s390x with rustc 1.67.0. orjson's wheel builds successfully for all these arches in our build environment, but its unit tests segfault and crash pytest on s390x. This is likely an endianness issue.
Here is the relevant portion from the full build log. Any help is appreciated.
The text was updated successfully, but these errors were encountered: