Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
20fbf8ac
Commit
20fbf8ac
authored
Mar 23, 2017
by
Christophe Zeitouny
Committed by
Victor Stinner
Mar 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
faulthandler: Restore the old sigaltstack during teardown (#777)
parent
0b3ec192
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/faulthandler.c
Modules/faulthandler.c
+16
-1
No files found.
Misc/ACKS
View file @
20fbf8ac
No preview for this file type
Misc/NEWS
View file @
20fbf8ac
...
...
@@ -287,6 +287,9 @@ Extension Modules
Library
-------
- bpo-29884: faulthandler: Restore the old sigaltstack during teardown.
Patch by Christophe Zeitouny.
- bpo-25455: Fixed crashes in repr of recursive buffered file-like objects.
- bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords
...
...
Modules/faulthandler.c
View file @
20fbf8ac
...
...
@@ -124,6 +124,7 @@ static const size_t faulthandler_nsignals = \
#ifdef HAVE_SIGALTSTACK
static
stack_t
stack
;
static
stack_t
old_stack
;
#endif
...
...
@@ -1317,7 +1318,7 @@ int _PyFaulthandler_Init(void)
stack
.
ss_size
=
SIGSTKSZ
;
stack
.
ss_sp
=
PyMem_Malloc
(
stack
.
ss_size
);
if
(
stack
.
ss_sp
!=
NULL
)
{
err
=
sigaltstack
(
&
stack
,
NULL
);
err
=
sigaltstack
(
&
stack
,
&
old_stack
);
if
(
err
)
{
PyMem_Free
(
stack
.
ss_sp
);
stack
.
ss_sp
=
NULL
;
...
...
@@ -1373,6 +1374,20 @@ void _PyFaulthandler_Fini(void)
faulthandler_disable
();
#ifdef HAVE_SIGALTSTACK
if
(
stack
.
ss_sp
!=
NULL
)
{
/* Fetch the current alt stack */
stack_t
current_stack
;
if
(
sigaltstack
(
NULL
,
&
current_stack
)
==
0
)
{
if
(
current_stack
.
ss_sp
==
stack
.
ss_sp
)
{
/* The current alt stack is the one that we installed.
It is safe to restore the old stack that we found when
we installed ours */
sigaltstack
(
&
old_stack
,
NULL
);
}
else
{
/* Someone switched to a different alt stack and didn't
restore ours when they were done (if they're done).
There's not much we can do in this unlikely case */
}
}
PyMem_Free
(
stack
.
ss_sp
);
stack
.
ss_sp
=
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment