Attached altstack.c mimicks faulthandler unit test test_register_chain(), except that faulthandler_user() uses almost no stack memory. This test should check if SIGSTKSZ is big enough to call a second signal handler from a first signal handler.
Example of my Fedora 30 with "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz" model name in /proc/cpuinfo and Linux kernel 5.1.18-300.fc30.x86_64:
$ gcc altstack.c -o altstack && ./altstack
SIGSTKSZ = 8192
our signal handler
User defined signal 1
Note: the follow gdb command didn't work for me:
> (gdb) p _rtld_local_ro._dl_x86_cpu_features.xsave_state_size
> $1 = 896
How can I get xsave_state_size for my glibc/kernel/CPU? |