Repository navigation
Insufficient sigaltstack size used by CPython prevents extensions from using new ISA #91124
Description
Activity
oleksandr-pavlyk commented
on Mar 9, 2022 oleksandr-pavlykmannequinMannequinAuthorMore actionsThe following snippet illustrates request by an extension to use AMX registers:
// no increase sigaltstack size fix will not wark till we fix python void enable_amx_no_fix() { unsigned long bitmask; long rc; rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA); if (rc) { printf("The kernel rejects the AMX use.\n"); printf("errno %d\n",errno); } else { printf("The kernel allows to use AMX.\n"); } rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_PERM, &bitmask); if (rc) { printf("rc error\n"); } else { if (( bitmask & XFEATURE_MASK_XTILEDATA) == 0){ printf("verify AMX permission faild bitmask %ld\n",bitmask); } } }This request fails on the account of too small a size for sigaltstack used by CPython allocated in Modules/faulthandler.c
The stack size used is 2*SIGSTKSZ, and does not take hardware capabilities into account.
Linux kernel 5.14 adds support to query minimum size of sigaltstack dynamically via getauxval(AT_MINSIGSTKSZ).
AMX support is added in Linux kernel 5.16
CPython should make use of this when built against more recent Linux kernels.
- added3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifeextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Mar 9, 2022 20 remaining items
The configure file is checking for "linux/auxvec.h"
checking linux/auxvec.h usability... yes
but the code is including "sys/auxvec.h"
The code is assuming that if linux/auxvec.h then sys/auxv.h will be available, which is wrong.
This may be quite bad, because this means that 3.10 and 3.9 doesn't build in CentOS 6, which is used for manylinux2010 wheels
Commit 393e2bf has broken CPython in RedHat 6
Too bad that we want to support RHEL 6 but have no buildbot for that.
Thanks for the fix Pablo.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: