Author justbennet
Recipients bkabrda, justbennet, markmcclain, opoplawski, peadar, vstinner
Date 2019-08-14.13:26:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565789179.05.0.894140639007.issue21131@roundup.psfhosted.org>
In-reply-to
Content
I just tested the proposed change in

Aha, that's interesting: SIGSTKSZ should be enough for 1 signal handler, but test_register_chain calls 2 signal handlers using the same stack. Can you please try the following patch?

```
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 2331051f79..e7d13f2b2d 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
. . . .
-    stack.ss_size = SIGSTKSZ;
+    stack.ss_size = SIGSTKSZ * 2;
```

and the segfault no longer occurs at the faulthandler test.

Compiling and running the altstack.c using the system installed GCC 4.8.5 on CentOS 7.6.1810, kernel version 3.10.0-957.10.1.el7.x86_64 running on Dell R640 Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz results in this output.

```
$ gcc -o altstack altstack.c 
$ ./altstack 
SIGSTKSZ = 8192
our signal handler
User defined signal 1
```

It does seem to me that relying on a statically set stack size when using dynamically loaded libraries is inviting similar problems in the future for the reasons that Peter enumerated:  There is no telling now what the requirements will be for some new chip family, and one cannot predict now what additional (if any) memory requirements might be needed by the linker in the future.

But, I think getting _some_ patch accepted and pushed to the main Python releases should have some priority, as the current state does seem undesirable.
History
Date User Action Args
2019-08-14 13:26:19justbennetsetrecipients: + justbennet, vstinner, bkabrda, opoplawski, markmcclain, peadar
2019-08-14 13:26:19justbennetsetmessageid: <1565789179.05.0.894140639007.issue21131@roundup.psfhosted.org>
2019-08-14 13:26:19justbennetlinkissue21131 messages
2019-08-14 13:26:18justbennetcreate