summaryrefslogtreecommitdiffstats
path: root/tests/012/stack.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-24 22:01:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-24 22:01:38 -0700
commit817cd5991d6304a2368824acbfc0b0e95c2aa7a7 (patch)
tree4aa5e7b112cdf41d2a713e42562f9699c8839dd3 /tests/012/stack.tl
parent1c1685861e0d304f60f0669c6dbd5005349262e4 (diff)
downloadtxr-817cd5991d6304a2368824acbfc0b0e95c2aa7a7.tar.gz
txr-817cd5991d6304a2368824acbfc0b0e95c2aa7a7.tar.bz2
txr-817cd5991d6304a2368824acbfc0b0e95c2aa7a7.zip
signals: disable stack overflow in handler.
* signal.c (sig_handler): For a is_cpu_exception signal, we temporarily disable the stack limit. It might be executing on the sigaltstack buffer, which is almost certainly below the stack limit. * tests/012/stack.tl: New test case. We raise a SIGSEGV and check that in the handler, the stack limit is disabled, and that we can executed code.
Diffstat (limited to 'tests/012/stack.tl')
-rw-r--r--tests/012/stack.tl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/012/stack.tl b/tests/012/stack.tl
index a8d06487..879d3d27 100644
--- a/tests/012/stack.tl
+++ b/tests/012/stack.tl
@@ -29,3 +29,14 @@
(set-stack-limit orig) nil
(set-stack-limit 65536) orig
(set-stack-limit orig) 65536)
+
+(set-sig-handler sig-segv
+ (lambda (signal async-p)
+ (assert (null (get-stack-limit)))
+ (throw 'out)))
+
+(test
+ (catch
+ (raise sig-segv)
+ (out () :sig))
+ :sig)