Add patch 289: Fix for over-aligned GC info

This commit is contained in:
Petr Viktorin 2018-01-31 11:23:10 +01:00
parent 7143d8af3a
commit 96b18273ae
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,39 @@
Fix for over-aligned GC info
Patch by Florian Weimer
See: https://bugzilla.redhat.com/show_bug.cgi?id=1540316
Upstream discussion: https://mail.python.org/pipermail/python-dev/2018-January/152000.html
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 55e83eced6..aa906144dc 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -248,6 +248,18 @@ PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
/* for source compatibility with 2.2 */
#define _PyObject_GC_Del PyObject_GC_Del
+/* Former over-aligned definition of PyGC_Head, used to compute the
+ size of the padding for the new version below. */
+union _gc_head;
+union _gc_head_old {
+ struct {
+ union _gc_head *gc_next;
+ union _gc_head *gc_prev;
+ Py_ssize_t gc_refs;
+ } gc;
+ long double dummy;
+};
+
/* GC information is stored BEFORE the object structure. */
typedef union _gc_head {
struct {
@@ -255,7 +267,8 @@ typedef union _gc_head {
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
- long double dummy; /* force worst-case alignment */
+ double dummy; /* force worst-case alignment */
+ char dummy_padding[sizeof(union _gc_head_old)];
} PyGC_Head;
extern PyGC_Head *_PyGC_generation0;

View File

@ -768,6 +768,10 @@ Patch288: 00288-ambiguous-python-version-rpmbuild-warn.patch
# (we handle it it in Setup.dist, see Patch0)
Patch289: 00289-disable-nis-detection.patch
# 00293 #
# Fix over-alignment of _gc_head, the structure for GC information
# See https://bugzilla.redhat.com/show_bug.cgi?id=1540316
Patch293: 00293-fix-gc-alignment.patch
# (New patches go here ^^^)
#
@ -1094,6 +1098,7 @@ mv Modules/cryptmodule.c Modules/_cryptmodule.c
%patch287 -p1
%patch288 -p1
%patch289 -p1
%patch293 -p1
%if 0%{?_module_build}
@ -1977,6 +1982,7 @@ rm -fr %{buildroot}
* Tue Jan 30 2018 Petr Viktorin <pviktori@redhat.com> - 2.7.14-9
- Add patch 288: warn/fail if Python 2 is called as /usr/bin/python and
PYTHON_DISALLOW_AMBIGUOUS_VERSION is set
- Add patch 289: Fix for over-aligned GC info
* Sat Jan 20 2018 Björn Esser <besser82@fedoraproject.org> - 2.7.14-8
- Rebuilt for switch to libxcrypt