-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Open
Labels
Description
Describe the issue:
We tested some Python apps in anticipation of CET support being merged into upstream Linux kernel in the near future.
https://www.phoronix.com/news/Linux-6.4-Shadow-Stack-Coming
While testing CentOS Stream 9 with a custom kernel with shadow stack enabled and Glibc with CET support, we were not able to import "numpy".
Reproduce the code example:
$ python3
Python 3.9.17 (main, Jun 26 2023, 00:00:00)
[GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
...
Error message:
Traceback (most recent call last):
File "/home/bkc/.local/lib/python3.9/site-packages/numpy/core/__init__.py", line 23, in <module>
from . import multiarray
File "/home/bkc/.local/lib/python3.9/site-packages/numpy/core/multiarray.py", line 10, in <module>
from . import overrides
File "/home/bkc/.local/lib/python3.9/site-packages/numpy/core/overrides.py", line 8, in <module>
from numpy.core._multiarray_umath import (
ImportError: /home/bkc/.local/lib/python3.9/site-packages/numpy/core/../../numpy.libs/libquadmath-96973f99.so.0.0.0: rebuild shared object with SHSTK support enabled
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/bkc/.local/lib/python3.9/site-packages/numpy/__init__.py", line 139, in <module>
from . import core
File "/home/bkc/.local/lib/python3.9/site-packages/numpy/core/__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "/usr/bin/python3"
* The NumPy version is: "1.25.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: /home/bkc/.local/lib/python3.9/site-packages/numpy/core/../../numpy.libs/libquadmath-96973f99.so.0.0.0: rebuild shared object with SHSTK support enabled
Runtime information:
import sys
print(sys.version)
3.9.17 (main, Jun 26 2023, 00:00:00)
[GCC 11.4.1 20230605 (Red Hat 11.4.1-2)]
Context for the issue:
There is a workaround for this, setting the environmental variable:
GLIBC_TUNABLES=glibc.cpu.x86_shstk=permissive
will disable CET functionality and allows loading numpy shared libraries.
However, the prudent solution is to actually rebuild all numpy shared libraries with SHSTK support enabled.
Thanks.