Fixed undefined behaviour in faulthandler
This commit is contained in:
parent
9d940a7ac5
commit
aca03e4c3a
41
00202-fix-undefined-behaviour-in-faulthandler.patch
Normal file
41
00202-fix-undefined-behaviour-in-faulthandler.patch
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
# HG changeset patch
|
||||
# User Victor Stinner <victor.stinner@gmail.com>
|
||||
# Date 1423661015 -3600
|
||||
# Node ID 689092296ad31951f8f919fc06b49450e648e93d
|
||||
# Parent 645f3d750be139ce0198e15e221da07b22289a92
|
||||
Issue #23433: Fix faulthandler._stack_overflow()
|
||||
|
||||
Fix undefined behaviour: don't compare pointers. Use Py_uintptr_t type instead
|
||||
of void*. It fixes test_faulthandler on Fedora 22 which now uses GCC 5.
|
||||
|
||||
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
|
||||
--- a/Modules/faulthandler.c
|
||||
+++ b/Modules/faulthandler.c
|
||||
@@ -911,12 +911,12 @@ faulthandler_fatal_error_py(PyObject *se
|
||||
}
|
||||
|
||||
#if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION)
|
||||
-static void*
|
||||
-stack_overflow(void *min_sp, void *max_sp, size_t *depth)
|
||||
+static Py_uintptr_t
|
||||
+stack_overflow(Py_uintptr_t min_sp, Py_uintptr_t max_sp, size_t *depth)
|
||||
{
|
||||
/* allocate 4096 bytes on the stack at each call */
|
||||
unsigned char buffer[4096];
|
||||
- void *sp = &buffer;
|
||||
+ Py_uintptr_t sp = (Py_uintptr_t)&buffer;
|
||||
*depth += 1;
|
||||
if (sp < min_sp || max_sp < sp)
|
||||
return sp;
|
||||
@@ -929,7 +929,8 @@ static PyObject *
|
||||
faulthandler_stack_overflow(PyObject *self)
|
||||
{
|
||||
size_t depth, size;
|
||||
- char *sp = (char *)&depth, *stop;
|
||||
+ Py_uintptr_t sp = (Py_uintptr_t)&depth;
|
||||
+ Py_uintptr_t stop;
|
||||
|
||||
depth = 0;
|
||||
stop = stack_overflow(sp - STACK_OVERFLOW_MAX_SIZE,
|
||||
|
@ -140,7 +140,7 @@
|
||||
Summary: Version 3 of the Python programming language aka Python 3000
|
||||
Name: python3
|
||||
Version: %{pybasever}.2
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
License: Python
|
||||
Group: Development/Languages
|
||||
|
||||
@ -722,6 +722,8 @@ Patch200: 00200-gettext-plural-fix.patch
|
||||
# Note: Backported from scl
|
||||
Patch201: 00201-fix-memory-leak-in-gdbm.patch
|
||||
|
||||
Patch202: 00202-fix-undefined-behaviour-in-faulthandler.patch
|
||||
|
||||
|
||||
# (New patches go here ^^^)
|
||||
#
|
||||
@ -1002,6 +1004,7 @@ done
|
||||
%patch196 -p1
|
||||
# 00197: upstream as of Python 3.4.2
|
||||
%patch199 -p1
|
||||
%patch202 -p1
|
||||
|
||||
# Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
|
||||
# are many differences between 2.6 and the Python 3 library.
|
||||
@ -1894,6 +1897,10 @@ rm -fr %{buildroot}
|
||||
# ======================================================
|
||||
|
||||
%changelog
|
||||
* Wed Feb 25 2015 Matej Stuchlik <mstuchli@redhat.com> - 3.4.2-7
|
||||
- Fixed undefined behaviour in faulthandler which caused test to hang on x86_64
|
||||
(http://bugs.python.org/issue23433)
|
||||
|
||||
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 3.4.2-6
|
||||
- Rebuilt for Fedora 23 Change
|
||||
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
|
||||
|
Loading…
Reference in New Issue
Block a user