Compare commits

...

13 Commits
master ... f25

Author SHA1 Message Date
Miro Hrončok 6ae2400c18 Fix bugzilla number in comment 2017-12-05 12:41:35 +01:00
Miro Hrončok 6827170b24 Fix for CVE-2017-1000158 (#1519604) 2017-12-01 10:46:40 +01:00
Charalampos Stratakis 4e033a4931 Apply the patch 279 correctly. 2017-10-09 13:32:46 +02:00
Charalampos Stratakis 6937b68312 Fix memory corruption due to allocator mix (rhbz#1498207) 2017-10-09 13:32:09 +02:00
Petr Viktorin f7d3d35029 Update to 3.5.4
See https://docs.python.org/3.5/whatsnew/changelog.html#python-3-5-4

Remove patch 259 - workaround for magic number bump (upstream commit 93602e3).
Remove patch 267 - pip option --system-site-packages (upstream commit db6322c).
Remove patch 269 - multiple compilation issue with PGO (upstream commit 8489409).
Rebase patch 55 - systemtap (for upstream commit a5c62a8e).
2017-08-23 10:19:05 +02:00
Charalampos Stratakis 50e4bfa0d1 Enable profile guided optimizations for x86_64 and i686 architectures
Added patch for fixing recompilation of Python when using common
build commands and the --enable-optimizations flag.
2017-05-10 15:04:27 +02:00
Charalampos Stratakis 6b23e951bc Make pip installable in a new venv when using the --system-site-packages flag 2017-04-24 13:35:25 +02:00
Tomas Orsava ef0529a8c3 Fix syntax error in %py_byte_compile macro (rhbz#1433569) 2017-03-21 14:58:05 +01:00
Iryna Shcherbina 7940f6d56d Replace patch 259 with a backported upstream patch 2017-03-08 18:38:08 +01:00
Iryna Shcherbina b8de731942 Add patch to work around magic number bump in Python 3.5.3 source code
Issue: http://bugs.python.org/issue27286
2017-02-10 15:28:44 +01:00
Iryna Shcherbina a0dada937f Upload sources for Python-3.5.3 2017-02-01 12:04:54 +01:00
Iryna Shcherbina d614eca5a8 Rebased to version 3.5.3
- Removed patches 184, 209, 242 as the changes are already in Python 3.5.3
- Updated patches 55, 146, 170, 180 to work with the new Python codebase
2017-01-31 17:03:22 +01:00
Charalampos Stratakis f98e4c1fdb Always include the rewheel patch at the SRPM 2017-01-10 22:13:10 +01:00
12 changed files with 235 additions and 296 deletions

View File

@ -1,7 +1,8 @@
diff -up Python-3.3.0rc2/configure.ac.systemtap Python-3.3.0rc2/configure.ac
--- Python-3.3.0rc2/configure.ac.systemtap 2012-09-09 05:11:14.000000000 -0400
+++ Python-3.3.0rc2/configure.ac 2012-09-10 09:17:21.114511781 -0400
@@ -2678,6 +2678,23 @@ if test "$with_valgrind" != no; then
diff --git a/configure.ac b/configure.ac
index f50a6c8..b0650a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3288,6 +3288,23 @@ if test "$with_valgrind" != no; then
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
fi
@ -25,10 +26,11 @@ diff -up Python-3.3.0rc2/configure.ac.systemtap Python-3.3.0rc2/configure.ac
# -I${DLINCLDIR} is added to the compile rule for importdl.o
AC_SUBST(DLINCLDIR)
DLINCLDIR=.
diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
--- Python-3.3.0rc2/configure.systemtap 2012-09-09 05:11:14.000000000 -0400
+++ Python-3.3.0rc2/configure 2012-09-10 09:17:21.116511780 -0400
@@ -618,6 +618,8 @@ TRUE
diff --git a/configure b/configure
index 0906ae0..4acd1cd 100755
--- a/configure
+++ b/configure
@@ -642,6 +642,8 @@ TRUE
MACHDEP_OBJS
DYNLOADFILE
DLINCLDIR
@ -37,7 +39,7 @@ diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
THREADOBJ
LDLAST
USE_THREAD_MODULE
@@ -779,6 +781,7 @@ with_doc_strings
@@ -834,6 +836,7 @@ with_doc_strings
with_tsc
with_pymalloc
with_valgrind
@ -45,7 +47,7 @@ diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
with_fpectl
with_libm
with_libc
@@ -1456,6 +1459,7 @@ Optional Packages:
@@ -1528,6 +1531,7 @@ Optional Packages:
--with(out)-tsc enable/disable timestamp counter profile
--with(out)-pymalloc disable/enable specialized mallocs
--with-valgrind Enable Valgrind support
@ -53,7 +55,7 @@ diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
--with-fpectl enable SIGFPE catching
--with-libm=STRING math library
--with-libc=STRING C library
@@ -10065,6 +10069,31 @@ fi
@@ -11180,6 +11184,31 @@ fi
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
fi
@ -85,18 +87,21 @@ diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
# -I${DLINCLDIR} is added to the compile rule for importdl.o
DLINCLDIR=.
diff -up Python-3.3.0rc2/Doc/howto/index.rst.systemtap Python-3.3.0rc2/Doc/howto/index.rst
--- Python-3.3.0rc2/Doc/howto/index.rst.systemtap 2012-09-09 05:10:51.000000000 -0400
+++ Python-3.3.0rc2/Doc/howto/index.rst 2012-09-10 09:17:21.117511779 -0400
@@ -29,4 +29,5 @@ Currently, the HOWTOs are:
diff --git a/Doc/howto/index.rst b/Doc/howto/index.rst
index de65950..593341c 100644
--- a/Doc/howto/index.rst
+++ b/Doc/howto/index.rst
@@ -28,4 +28,5 @@ Currently, the HOWTOs are:
argparse.rst
ipaddress.rst
clinic.rst
+ instrumentation.rst
diff -up Python-3.3.0rc2/Doc/howto/instrumentation.rst.systemtap Python-3.3.0rc2/Doc/howto/instrumentation.rst
--- Python-3.3.0rc2/Doc/howto/instrumentation.rst.systemtap 2012-09-10 09:17:21.117511779 -0400
+++ Python-3.3.0rc2/Doc/howto/instrumentation.rst 2012-09-10 09:17:21.117511779 -0400
diff --git a/Doc/howto/instrumentation.rst b/Doc/howto/instrumentation.rst
new file mode 100644
index 0000000..b6924e1
--- /dev/null
+++ b/Doc/howto/instrumentation.rst
@@ -0,0 +1,295 @@
+.. _instrumentation:
+
@ -393,9 +398,11 @@ diff -up Python-3.3.0rc2/Doc/howto/instrumentation.rst.systemtap Python-3.3.0rc2
+ delete fn_calls;
+ }
+
diff -up Python-3.3.0rc2/Lib/test/test_systemtap.py.systemtap Python-3.3.0rc2/Lib/test/test_systemtap.py
--- Python-3.3.0rc2/Lib/test/test_systemtap.py.systemtap 2012-09-10 09:17:21.117511779 -0400
+++ Python-3.3.0rc2/Lib/test/test_systemtap.py 2012-09-10 09:17:21.117511779 -0400
diff --git a/Lib/test/test_systemtap.py b/Lib/test/test_systemtap.py
new file mode 100644
index 0000000..a669064
--- /dev/null
+++ b/Lib/test/test_systemtap.py
@@ -0,0 +1,234 @@
+# Verify that systemtap static probes work
+#
@ -631,10 +638,11 @@ diff -up Python-3.3.0rc2/Lib/test/test_systemtap.py.systemtap Python-3.3.0rc2/Li
+
+if __name__ == "__main__":
+ test_main()
diff -up Python-3.3.0rc2/Makefile.pre.in.systemtap Python-3.3.0rc2/Makefile.pre.in
--- Python-3.3.0rc2/Makefile.pre.in.systemtap 2012-09-09 05:11:05.000000000 -0400
+++ Python-3.3.0rc2/Makefile.pre.in 2012-09-10 09:19:51.195501518 -0400
@@ -363,6 +363,7 @@ PYTHON_OBJS= \
diff --git a/Makefile.pre.in b/Makefile.pre.in
index a88b7d5..3585b88 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -383,6 +383,7 @@ PYTHON_OBJS= \
Python/formatter_unicode.o \
Python/fileutils.o \
Python/$(DYNLOADFILE) \
@ -642,19 +650,19 @@ diff -up Python-3.3.0rc2/Makefile.pre.in.systemtap Python-3.3.0rc2/Makefile.pre.
$(LIBOBJS) \
$(MACHDEP_OBJS) \
$(THREADOBJ)
@@ -713,7 +714,8 @@ Objects/setobject.o: $(srcdir)/Objects/s
$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
$(OPCODETARGETGEN) $(OPCODETARGETS_H)
@@ -864,7 +865,8 @@ Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
$(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \
$(srcdir)/Python/opcode_targets.h
-Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
+Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h \
-Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h
+Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h \
+ $(srcdir)/Python/ceval_systemtap.h @SYSTEMTAPDEPS@
Python/frozen.o: Python/importlib.h Python/importlib_external.h
Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h
@@ -724,6 +726,13 @@ Objects/typeobject.o: $(srcdir)/Objects/
Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
$(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > Objects/typeslots.inc
@@ -878,6 +880,13 @@ Objects/typeobject.o: Objects/typeslots.inc
< $(srcdir)/Include/typeslots.h \
$(srcdir)/Objects/typeslots.inc
+# Only needed with --with-systemtap; not a public header:
+$(srcdir)/Python/pysystemtap.h: $(srcdir)/Python/pysystemtap.d
@ -666,18 +674,19 @@ diff -up Python-3.3.0rc2/Makefile.pre.in.systemtap Python-3.3.0rc2/Makefile.pre.
############################################################################
# Header files
@@ -1345,6 +1354,7 @@ clean: pycremoval
@@ -1601,6 +1610,7 @@ clean: pycremoval
-rm -f Lib/lib2to3/*Grammar*.pickle
-rm -f Programs/_testembed Programs/_freeze_importlib
-rm -rf build
-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
+ -rm -f $(srcdir)/Python/pysystemtap.h
profile-removal:
find . -name '*.gc??' -exec rm -f {} ';'
diff -up Python-3.3.0rc2/pyconfig.h.in.systemtap Python-3.3.0rc2/pyconfig.h.in
--- Python-3.3.0rc2/pyconfig.h.in.systemtap 2012-09-09 05:11:14.000000000 -0400
+++ Python-3.3.0rc2/pyconfig.h.in 2012-09-10 09:17:21.120511781 -0400
@@ -1306,6 +1306,9 @@
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 39ccf53..9052dbc 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -1375,6 +1375,9 @@
/* Define if you want to compile in Python-specific mallocs */
#undef WITH_PYMALLOC
@ -687,10 +696,11 @@ diff -up Python-3.3.0rc2/pyconfig.h.in.systemtap Python-3.3.0rc2/pyconfig.h.in
/* Define if you want to compile in rudimentary thread support */
#undef WITH_THREAD
diff -up Python-3.3.0rc2/Python/ceval.c.systemtap Python-3.3.0rc2/Python/ceval.c
--- Python-3.3.0rc2/Python/ceval.c.systemtap 2012-09-09 05:11:12.000000000 -0400
+++ Python-3.3.0rc2/Python/ceval.c 2012-09-10 09:17:21.122511781 -0400
@@ -18,6 +18,8 @@
diff --git a/Python/ceval.c b/Python/ceval.c
index 7b40518..0e49de5 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -20,6 +20,8 @@
#include <ctype.h>
@ -699,7 +709,7 @@ diff -up Python-3.3.0rc2/Python/ceval.c.systemtap Python-3.3.0rc2/Python/ceval.c
#ifndef WITH_TSC
#define READ_TIMESTAMP(var)
@@ -1160,6 +1162,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int
@@ -1160,6 +1162,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
}
}
@ -710,7 +720,7 @@ diff -up Python-3.3.0rc2/Python/ceval.c.systemtap Python-3.3.0rc2/Python/ceval.c
co = f->f_code;
names = co->co_names;
consts = co->co_consts;
@@ -3077,6 +3083,11 @@ fast_yield:
@@ -3678,6 +3684,11 @@ fast_yield:
/* pop frame */
exit_eval_frame:
@ -722,9 +732,11 @@ diff -up Python-3.3.0rc2/Python/ceval.c.systemtap Python-3.3.0rc2/Python/ceval.c
Py_LeaveRecursiveCall();
f->f_executing = 0;
tstate->frame = f->f_back;
diff -up Python-3.3.0rc2/Python/ceval_systemtap.h.systemtap Python-3.3.0rc2/Python/ceval_systemtap.h
--- Python-3.3.0rc2/Python/ceval_systemtap.h.systemtap 2012-09-10 09:17:21.122511781 -0400
+++ Python-3.3.0rc2/Python/ceval_systemtap.h 2012-09-10 09:17:21.122511781 -0400
diff --git a/Python/ceval_systemtap.h b/Python/ceval_systemtap.h
new file mode 100644
index 0000000..38697ad
--- /dev/null
+++ b/Python/ceval_systemtap.h
@@ -0,0 +1,86 @@
+/*
+ Support for SystemTap static markers
@ -812,9 +824,11 @@ diff -up Python-3.3.0rc2/Python/ceval_systemtap.h.systemtap Python-3.3.0rc2/Pyth
+#define systemtap_function_return(f)
+
+#endif
diff -up Python-3.3.0rc2/Python/pysystemtap.d.systemtap Python-3.3.0rc2/Python/pysystemtap.d
--- Python-3.3.0rc2/Python/pysystemtap.d.systemtap 2012-09-10 09:17:21.122511781 -0400
+++ Python-3.3.0rc2/Python/pysystemtap.d 2012-09-10 09:17:21.122511781 -0400
diff --git a/Python/pysystemtap.d b/Python/pysystemtap.d
new file mode 100644
index 0000000..c2cdef0
--- /dev/null
+++ b/Python/pysystemtap.d
@@ -0,0 +1,4 @@
+provider python {
+ probe function__entry(const char *, const char *, int, PyFrameObject *);

View File

@ -282,7 +282,7 @@ index c9b113e..60e2392 100644
self._test_pbkdf2_hmac(py_hashlib.pbkdf2_hmac)
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index 44765ac..b8cf490 100644
index ff57614..8cd1b77 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -20,6 +20,8 @@
@ -292,9 +292,9 @@ index 44765ac..b8cf490 100644
+#include <openssl/ssl.h>
+#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
/* We use the object interface to discover what hashes OpenSSL supports. */
@@ -45,11 +47,19 @@ typedef struct {
#include <openssl/objects.h>
@@ -55,10 +57,19 @@ typedef struct {
static PyTypeObject EVPtype;
@ -311,14 +311,13 @@ index 44765ac..b8cf490 100644
-#define DEFINE_CONSTS_FOR_NEW(Name) \
- static PyObject *CONST_ ## Name ## _name_obj = NULL; \
- static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \
- static EVP_MD_CTX *CONST_new_ ## Name ## _ctx_p = NULL;
+#define DEFINE_CONSTS_FOR_NEW(Name) \
+ static EVPCachedInfo cached_info_ ##Name;
DEFINE_CONSTS_FOR_NEW(md5)
DEFINE_CONSTS_FOR_NEW(sha1)
@@ -92,6 +102,48 @@ EVP_hash(EVPobject *self, const void *vp, Py_ssize_t len)
@@ -139,6 +150,48 @@ EVP_hash(EVPobject *self, const void *vp, Py_ssize_t len)
}
}
@ -367,7 +366,7 @@ index 44765ac..b8cf490 100644
/* Internal methods for a hash object */
static void
@@ -259,15 +311,16 @@ EVP_repr(EVPobject *self)
@@ -327,15 +380,16 @@ EVP_repr(EVPobject *self)
static int
EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
{
@ -387,21 +386,21 @@ index 44765ac..b8cf490 100644
return -1;
}
@@ -288,7 +341,12 @@ EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
@@ -356,7 +410,12 @@ EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
PyBuffer_Release(&view);
return -1;
}
- EVP_DigestInit(&self->ctx, digest);
+ mc_ctx_init(&self->ctx, usedforsecurity);
+ if (!EVP_DigestInit_ex(&self->ctx, digest, NULL)) {
- EVP_DigestInit(self->ctx, digest);
+ mc_ctx_init(self->ctx, usedforsecurity);
+ if (!EVP_DigestInit_ex(self->ctx, digest, NULL)) {
+ set_evp_exception();
+ PyBuffer_Release(&view);
+ return -1;
+ Py_RETURN_NONE;
+ }
self->name = name_obj;
Py_INCREF(self->name);
@@ -372,7 +430,8 @@ static PyTypeObject EVPtype = {
@@ -440,7 +499,8 @@ static PyTypeObject EVPtype = {
static PyObject *
EVPnew(PyObject *name_obj,
const EVP_MD *digest, const EVP_MD_CTX *initial_ctx,
@ -411,13 +410,13 @@ index 44765ac..b8cf490 100644
{
EVPobject *self;
@@ -387,7 +446,12 @@ EVPnew(PyObject *name_obj,
@@ -455,7 +515,12 @@ EVPnew(PyObject *name_obj,
if (initial_ctx) {
EVP_MD_CTX_copy(&self->ctx, initial_ctx);
EVP_MD_CTX_copy(self->ctx, initial_ctx);
} else {
- EVP_DigestInit(&self->ctx, digest);
+ mc_ctx_init(&self->ctx, usedforsecurity);
+ if (!EVP_DigestInit_ex(&self->ctx, digest, NULL)) {
- EVP_DigestInit(self->ctx, digest);
+ mc_ctx_init(self->ctx, usedforsecurity);
+ if (!EVP_DigestInit_ex(self->ctx, digest, NULL)) {
+ set_evp_exception();
+ Py_DECREF(self);
+ return NULL;
@ -425,7 +424,7 @@ index 44765ac..b8cf490 100644
}
if (cp && len) {
@@ -411,21 +475,29 @@ PyDoc_STRVAR(EVP_new__doc__,
@@ -479,21 +544,29 @@ PyDoc_STRVAR(EVP_new__doc__,
An optional string argument may be provided and will be\n\
automatically hashed.\n\
\n\
@ -459,7 +458,7 @@ index 44765ac..b8cf490 100644
return NULL;
}
@@ -439,7 +511,8 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdict)
@@ -507,7 +580,8 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdict)
digest = EVP_get_digestbyname(name);
@ -469,13 +468,13 @@ index 44765ac..b8cf490 100644
if (data_obj)
PyBuffer_Release(&view);
@@ -722,57 +795,114 @@ generate_hash_name_list(void)
@@ -769,57 +843,114 @@ generate_hash_name_list(void)
/*
- * This macro generates constructor function definitions for specific
- * hash algorithms. These constructors are much faster than calling
- * the generic one passing it a python string and are noticably
- * the generic one passing it a python string and are noticeably
- * faster than calling a python new() wrapper. Thats important for
+ * This macro and function generates a family of constructor function
+ * definitions for specific hash algorithms. These constructors are much
@ -512,8 +511,8 @@ index 44765ac..b8cf490 100644
+ return implement_specific_EVP_new(self, args, kwdict, \
+ "|Oi:" #NAME, \
+ &cached_info_ ## NAME ); \
}
+ }
+
+static PyObject *
+implement_specific_EVP_new(PyObject *self, PyObject *args, PyObject *kwdict,
+ const char *format,
@ -531,8 +530,8 @@ index 44765ac..b8cf490 100644
+ if (!PyArg_ParseTupleAndKeywords(args, kwdict, format, kwlist,
+ &data_obj, &usedforsecurity)) {
+ return NULL;
+ }
+
}
+ if (data_obj)
+ GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
+
@ -581,7 +580,7 @@ index 44765ac..b8cf490 100644
- if (CONST_ ## NAME ## _name_obj == NULL) { \
- CONST_ ## NAME ## _name_obj = PyUnicode_FromString(#NAME); \
- if (EVP_get_digestbyname(#NAME)) { \
- CONST_new_ ## NAME ## _ctx_p = &CONST_new_ ## NAME ## _ctx; \
- CONST_new_ ## NAME ## _ctx_p = EVP_MD_CTX_new(); \
- EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \
- } \
- } \
@ -621,7 +620,7 @@ index 44765ac..b8cf490 100644
GEN_CONSTRUCTOR(md5)
GEN_CONSTRUCTOR(sha1)
@@ -819,13 +949,10 @@ PyInit__hashlib(void)
@@ -866,13 +997,10 @@ PyInit__hashlib(void)
{
PyObject *m, *openssl_md_meth_names;

View File

@ -1,8 +1,8 @@
Index: Include/object.h
===================================================================
--- Include/object.h (revision 87911)
+++ Include/object.h (working copy)
@@ -914,6 +914,49 @@
diff --git Include/object.h Include/object.h
index 50d9747..9b7e89e 100644
--- Include/object.h
+++ Include/object.h
@@ -1059,6 +1059,49 @@ PyAPI_FUNC(void)
_PyObject_DebugTypeStats(FILE *out);
#endif /* ifndef Py_LIMITED_API */
@ -52,17 +52,17 @@ Index: Include/object.h
#ifdef __cplusplus
}
#endif
Index: Objects/object.c
===================================================================
--- Objects/object.c (revision 87911)
+++ Objects/object.c (working copy)
@@ -1899,6 +1899,35 @@
diff --git Objects/object.c Objects/object.c
index d21fd90..d07b49c 100644
--- Objects/object.c
+++ Objects/object.c
@@ -2034,6 +2034,35 @@ _PyTrash_thread_destroy_chain(void)
}
}
+PyAPI_FUNC(void)
+_PyObject_AssertFailed(PyObject *obj, const char *msg, const char *expr,
+ const char *file, int line, const char *function)
+ const char *file, int line, const char *function)
+{
+ fprintf(stderr,
+ "%s:%d: %s: Assertion \"%s\" failed.\n",
@ -92,23 +92,38 @@ Index: Objects/object.c
#ifndef Py_TRACE_REFS
/* For Py_LIMITED_API, we need an out-of-line version of _Py_Dealloc.
Define this here, so we can undefine the macro. */
Index: Lib/test/test_gc.py
===================================================================
--- Lib/test/test_gc.py (revision 87911)
+++ Lib/test/test_gc.py (working copy)
@@ -1,7 +1,7 @@
diff --git Lib/test/test_gc.py Lib/test/test_gc.py
index a4d684b..e77029e 100644
--- Lib/test/test_gc.py
+++ Lib/test/test_gc.py
@@ -1,10 +1,11 @@
import unittest
from test.support import (verbose, refcount_test, run_unittest,
strip_python_stderr, cpython_only, start_threads,
- temp_dir)
+ temp_dir, import_module)
strip_python_stderr, cpython_only, start_threads,
- temp_dir, requires_type_collecting)
+ temp_dir, requires_type_collecting, import_module)
from test.support.script_helper import assert_python_ok, make_script
import sys
@@ -512,6 +512,48 @@
+import sysconfig
import time
import gc
import weakref
@@ -50,6 +51,8 @@ class GC_Detector(object):
# gc collects it.
self.wr = weakref.ref(C1055820(666), it_happened)
+BUILD_WITH_NDEBUG = ('-DNDEBUG' in sysconfig.get_config_vars()['PY_CFLAGS'])
+
@with_tp_del
class Uncollectable(object):
"""Create a reference cycle with multiple __del__ methods.
@@ -864,6 +867,50 @@ class GCCallbackTests(unittest.TestCase):
self.assertEqual(len(gc.garbage), 0)
+ @unittest.skipIf(BUILD_WITH_NDEBUG,
+ 'built with -NDEBUG')
+ def test_refcount_errors(self):
+ self.preclean()
+ # Verify the "handling" of objects with broken refcounts
@ -154,9 +169,10 @@ Index: Lib/test/test_gc.py
class GCTogglingTests(unittest.TestCase):
def setUp(self):
gc.enable()
diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
--- Modules/gcmodule.c.orig2 2014-12-08 10:54:14.251742911 +0100
+++ Modules/gcmodule.c 2014-12-08 10:52:45.674771917 +0100
diff --git Modules/gcmodule.c Modules/gcmodule.c
index cb7222d..6a9be80 100644
--- Modules/gcmodule.c
+++ Modules/gcmodule.c
@@ -341,7 +341,8 @@ update_refs(PyGC_Head *containers)
{
PyGC_Head *gc = containers->gc.gc_next;
@ -188,7 +204,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
if (_PyGCHead_REFS(gc) > 0)
_PyGCHead_DECREF(gc);
}
@@ -436,9 +440,10 @@ visit_reachable(PyObject *op, PyGC_Head
@@ -436,9 +440,10 @@ visit_reachable(PyObject *op, PyGC_Head *reachable)
* If gc_refs == GC_UNTRACKED, it must be ignored.
*/
else {
@ -202,7 +218,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
}
}
return 0;
@@ -480,7 +485,7 @@ move_unreachable(PyGC_Head *young, PyGC_
@@ -480,7 +485,7 @@ move_unreachable(PyGC_Head *young, PyGC_Head *unreachable)
*/
PyObject *op = FROM_GC(gc);
traverseproc traverse = Py_TYPE(op)->tp_traverse;
@ -211,7 +227,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
_PyGCHead_SET_REFS(gc, GC_REACHABLE);
(void) traverse(op,
(visitproc)visit_reachable,
@@ -543,7 +548,7 @@ move_legacy_finalizers(PyGC_Head *unreac
@@ -543,7 +548,7 @@ move_legacy_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
for (gc = unreachable->gc.gc_next; gc != unreachable; gc = next) {
PyObject *op = FROM_GC(gc);
@ -220,7 +236,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
next = gc->gc.gc_next;
if (has_legacy_finalizer(op)) {
@@ -619,7 +624,7 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -619,7 +624,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
PyWeakReference **wrlist;
op = FROM_GC(gc);
@ -229,7 +245,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
next = gc->gc.gc_next;
if (! PyType_SUPPORTS_WEAKREFS(Py_TYPE(op)))
@@ -640,9 +645,9 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -640,9 +645,9 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
* the callback pointer intact. Obscure: it also
* changes *wrlist.
*/
@ -241,7 +257,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
if (wr->wr_callback == NULL)
continue; /* no callback */
@@ -676,7 +681,7 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -676,7 +681,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
*/
if (IS_TENTATIVELY_UNREACHABLE(wr))
continue;
@ -250,7 +266,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
/* Create a new reference so that wr can't go away
* before we can process it again.
@@ -685,7 +690,8 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -685,7 +690,8 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
/* Move wr to wrcb_to_call, for the next pass. */
wrasgc = AS_GC(wr);
@ -260,7 +276,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
next isn't, so they can't
be the same */
gc_list_move(wrasgc, &wrcb_to_call);
@@ -701,11 +707,11 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -701,11 +707,11 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
gc = wrcb_to_call.gc.gc_next;
op = FROM_GC(gc);
@ -292,35 +308,3 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
if (_PyGCHead_REFS(gc) != 0)
return -1;
}
diff -up Lib/test/test_gc.py.old Lib/test/test_gc.py
--- Lib/test/test_gc.py.old 2014-12-10 11:19:33.503982288 +0100
+++ Lib/test/test_gc.py 2014-12-10 11:21:13.220021364 +0100
@@ -49,6 +49,8 @@ class GC_Detector(object):
# gc collects it.
self.wr = weakref.ref(C1055820(666), it_happened)
+BUILD_WITH_NDEBUG = ('-DNDEBUG' in sysconfig.get_config_vars()['PY_CFLAGS'])
+
@with_tp_del
class Uncollectable(object):
"""Create a reference cycle with multiple __del__ methods.
@@ -854,6 +856,8 @@ class GCCallbackTests(unittest.TestCase)
self.assertEqual(len(gc.garbage), 0)
+ @unittest.skipIf(BUILD_WITH_NDEBUG,
+ 'built with -NDEBUG')
def test_refcount_errors(self):
self.preclean()
# Verify the "handling" of objects with broken refcounts
diff -up Lib/test/test_gc.py.old Lib/test/test_gc.py
--- Lib/test/test_gc.py.old 2014-12-10 12:50:58.252121318 +0100
+++ Lib/test/test_gc.py 2014-12-10 12:51:08.594266653 +0100
@@ -4,6 +4,7 @@ from test.support import (verbose, refco
from test.support.script_helper import assert_python_ok, make_script
import sys
+import sysconfig
import time
import gc
import weakref

View File

@ -1,12 +1,13 @@
diff -r de35eae9048a config.sub
--- a/config.sub Wed Apr 24 23:33:20 2013 +0200
+++ b/config.sub Thu Apr 25 08:51:00 2013 +0200
@@ -1008,7 +1008,7 @@
diff --git a/config.sub b/config.sub
index 3478c1f..e422173 100755
--- a/config.sub
+++ b/config.sub
@@ -1040,7 +1040,7 @@ case $basic_machine in
;;
ppc64) basic_machine=powerpc64-unknown
;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown

View File

@ -1,12 +0,0 @@
--- Python-3.3.2/setup.py.orig 2013-07-01 15:23:24.377711044 +0200
+++ Python-3.3.2/setup.py 2013-07-01 15:23:34.094676496 +0200
@@ -1882,7 +1882,8 @@
if not line:
ffi_inc = None
break
- if line.startswith('#define LIBFFI_H'):
+ if line.startswith('#define LIBFFI_H') or \
+ line.startswith('#define ffi_wrapper_h'):
break
ffi_lib = None
if ffi_inc is not None:

View File

@ -1,17 +0,0 @@
diff -r 682a8e36dd18 Lib/test/test_pyexpat.py
--- a/Lib/test/test_pyexpat.py Tue Jul 05 17:08:52 2016 +0300
+++ b/Lib/test/test_pyexpat.py Thu Jul 07 17:04:35 2016 +0800
@@ -656,11 +656,9 @@
# \xc2\x85 is UTF-8 encoded U+0085 (NEXT LINE)
xml = b"<?xml version\xc2\x85='1.0'?>\r\n"
parser = expat.ParserCreate()
- try:
+ err_pattern = r'XML declaration not well-formed: line 1, column \d+'
+ with self.assertRaisesRegex(expat.ExpatError, err_pattern):
parser.Parse(xml, True)
- self.fail()
- except expat.ExpatError as e:
- self.assertEqual(str(e), 'XML declaration not well-formed: line 1, column 14')
class ErrorMessageTest(unittest.TestCase):
def test_codes(self):

View File

@ -1,89 +0,0 @@
diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst
index 24a4156..d2c7991 100644
--- a/Doc/howto/urllib2.rst
+++ b/Doc/howto/urllib2.rst
@@ -538,6 +538,11 @@ setting up a `Basic Authentication`_ handler: ::
through a proxy. However, this can be enabled by extending urllib.request as
shown in the recipe [#]_.
+.. note::
+
+ ``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see
+ the documentation on :func:`~urllib.request.getproxies`.
+
Sockets and Layers
==================
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst
index 6c1bfb8..1291aeb 100644
--- a/Doc/library/urllib.request.rst
+++ b/Doc/library/urllib.request.rst
@@ -173,6 +173,16 @@ The :mod:`urllib.request` module defines the following functions:
If both lowercase and uppercase environment variables exist (and disagree),
lowercase is preferred.
+ .. note::
+
+ If the environment variable ``REQUEST_METHOD`` is set, which usually
+ indicates your script is running in a CGI environment, the environment
+ variable ``HTTP_PROXY`` (uppercase ``_PROXY``) will be ignored. This is
+ because that variable can be injected by a client using the "Proxy:" HTTP
+ header. If you need to use an HTTP proxy in a CGI environment, either use
+ ``ProxyHandler`` explicitly, or make sure the variable name is in
+ lowercase (or at least the ``_proxy`` suffix).
+
The following classes are provided:
@@ -280,6 +290,11 @@ The following classes are provided:
list of hostname suffixes, optionally with ``:port`` appended, for example
``cern.ch,ncsa.uiuc.edu,some.host:8080``.
+ .. note::
+
+ ``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set;
+ see the documentation on :func:`~urllib.request.getproxies`.
+
.. class:: HTTPPasswordMgr()
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 5d05f8d..c26c52a 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -232,6 +232,18 @@ class ProxyTests(unittest.TestCase):
self.assertTrue(urllib.request.proxy_bypass_environment('anotherdomain.com:8888'))
self.assertTrue(urllib.request.proxy_bypass_environment('newdomain.com:1234'))
+ def test_proxy_cgi_ignore(self):
+ try:
+ self.env.set('HTTP_PROXY', 'http://somewhere:3128')
+ proxies = urllib.request.getproxies_environment()
+ self.assertEqual('http://somewhere:3128', proxies['http'])
+ self.env.set('REQUEST_METHOD', 'GET')
+ proxies = urllib.request.getproxies_environment()
+ self.assertNotIn('http', proxies)
+ finally:
+ self.env.unset('REQUEST_METHOD')
+ self.env.unset('HTTP_PROXY')
+
def test_proxy_bypass_environment_host_match(self):
bypass = urllib.request.proxy_bypass_environment
self.env.set('NO_PROXY',
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 1731fe3..3be327d 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2412,6 +2412,12 @@ def getproxies_environment():
name = name.lower()
if value and name[-6:] == '_proxy':
proxies[name[:-6]] = value
+ # CVE-2016-1000110 - If we are running as CGI script, forget HTTP_PROXY
+ # (non-all-lowercase) as it may be set from the web server by a "Proxy:"
+ # header from the client
+ # If "proxy" is lowercase, it will still be used thanks to the next block
+ if 'REQUEST_METHOD' in os.environ:
+ proxies.pop('http', None)
for name, value in os.environ.items():
if name[-6:] == '_proxy':
name = name.lower()

View File

@ -0,0 +1,13 @@
diff --git a/Modules/getpath.c b/Modules/getpath.c
index c4055be..1258fcd 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -735,7 +735,7 @@ calculate_path(void)
bufsz += wcslen(zip_path) + 1;
bufsz += wcslen(exec_prefix) + 1;
- buf = PyMem_New(wchar_t, bufsz);
+ buf = PyMem_RawMalloc(bufsz * sizeof(wchar_t));
if (buf == NULL) {
Py_FatalError(
"Not enough memory for dynamic PYTHONPATH");

View File

@ -0,0 +1,25 @@
From c3c9db89273fabc62ea1b48389d9a3000c1c03ae Mon Sep 17 00:00:00 2001
From: Jay Bosamiya <jaybosamiya@gmail.com>
Date: Sun, 18 Jun 2017 22:11:03 +0530
Subject: [PATCH] [2.7] bpo-30657: Check & prevent integer overflow in
PyString_DecodeEscape (#2174)
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 77dd45e..9b29dc3 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -970,7 +970,13 @@ PyObject *PyBytes_DecodeEscape(const char *s,
char *p, *buf;
const char *end;
PyObject *v;
- Py_ssize_t newlen = recode_encoding ? 4*len:len;
+ Py_ssize_t newlen;
+ /* Check for integer overflow */
+ if (recode_encoding && (len > PY_SSIZE_T_MAX / 4)) {
+ PyErr_SetString(PyExc_OverflowError, "string is too large");
+ return NULL;
+ }
+ newlen = recode_encoding ? 4*len:len;
v = PyBytes_FromStringAndSize((char *)NULL, newlen);
if (v == NULL)
return NULL;

View File

@ -6,5 +6,5 @@
%py_byte_compile()\
python_binary="%1"\
bytecode_compilation_path="%2"\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2]], optimize=opt) for opt in range(2) for f in sys.argv[1:]]' || :\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2], optimize=opt) for opt in range(2) for f in sys.argv[1:]]' || :\
%{nil}

View File

@ -111,8 +111,8 @@
# ==================
Summary: Version 3 of the Python programming language aka Python 3000
Name: python3
Version: %{pybasever}.2
Release: 4%{?dist}
Version: %{pybasever}.4
Release: 3%{?dist}
License: Python
Group: Development/Languages
@ -342,14 +342,6 @@ Patch178: 00178-dont-duplicate-flags-in-sysconfig.patch
# Not appropriate for upstream, Fedora-specific naming
Patch180: 00180-python-add-support-for-ppc64p7.patch
# 00184 #
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=979696
# Fixes build of ctypes against libffi with multilib wrapper
# Python recognizes ffi.h only if it contains "#define LIBFFI_H",
# but the wrapper doesn't contain that, which makes the build fail
# We patch this by also accepting "#define ffi_wrapper_h"
Patch184: 00184-ctypes-should-build-with-libffi-multilib-wrapper.patch
# 00186 #
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1023607
# Previously, this fixed a problem where some *.py files were not being
@ -378,9 +370,7 @@ Patch188: 00188-fix-lib2to3-tests-when-hashlib-doesnt-compile-properly.patch
# Add the rewheel module, allowing to recreate wheels from already installed
# ones
# https://github.com/bkabrda/rewheel
%if 0%{with_rewheel}
Patch189: 00189-add-rewheel-module.patch
%endif
# 00205 #
# LIBPL variable in makefile takes LIBPL from configure.ac
@ -392,20 +382,6 @@ Patch205: 00205-make-libpl-respect-lib64.patch
# by debian but fedora infra uses only eabi without hf
Patch206: 00206-remove-hf-from-arm-triplet.patch
# 00209 #
# Fix test breakage with version 2.2.0 of Expat
# rhbz#1353918: https://bugzilla.redhat.com/show_bug.cgi?id=1353918
# FIXED UPSTREAM: http://bugs.python.org/issue27369
Patch209: 00209-fix-test-pyexpat-failure.patch
# 00242 #
# HTTPoxy attack (CVE-2016-1000110)
# https://httpoxy.org/
# FIXED UPSTREAM: http://bugs.python.org/issue27568
# Based on a patch by Rémi Rampin
# Resolves: rhbz#1359177
Patch242: 00242-CVE-2016-1000110-httpoxy.patch
# 00243 #
# Fix the triplet used on 64-bit MIPS
# rhbz#1322526: https://bugzilla.redhat.com/show_bug.cgi?id=1322526
@ -413,6 +389,17 @@ Patch242: 00242-CVE-2016-1000110-httpoxy.patch
# Fedora needs the default mips64-linux-gnu
Patch243: 00243-fix-mips64-triplet.patch
# 00279 #
# Fix memory corruption due to allocator mix
# Fixed upstream: https://bugs.python.org/issue31532
Patch279: 00279-fix-memory-corruption-due-to-allocator-mix.patch
# 00286 #
# CVE-2017-1000158
# Check & prevent integer overflow in PyString_DecodeEscape
# Fixed upstream for Python 2 only: https://bugs.python.org/issue30657
Patch286: 00286-pystring-decodeescape-integer-overflow.patch
# (New patches go here ^^^)
#
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@ -643,7 +630,6 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en
%patch170 -p0
%patch178 -p1
%patch180 -p1
%patch184 -p1
%patch186 -p1
%patch188 -p1
@ -653,9 +639,9 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en
%patch205 -p1
%patch206 -p1
%patch209 -p1
%patch242 -p1
%patch243 -p1
%patch279 -p1
%patch286 -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.
@ -754,7 +740,11 @@ BuildPython debug \
BuildPython optimized \
python \
python%{pybasever} \
%ifarch %{ix86} x86_64
"--without-ensurepip --enable-optimizations" \
%else
"--without-ensurepip" \
%endif
true
# ======================================================
@ -1555,6 +1545,37 @@ rm -fr %{buildroot}
# ======================================================
%changelog
* Fri Dec 01 2017 Miro Hrončok <mhroncok@redhat.com> - 3.5.4-3
- Fix for CVE-2017-1000158
- rhbz#1519604: https://bugzilla.redhat.com/show_bug.cgi?id=1519604
* Mon Oct 09 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.5.4-2
- Fix memory corruption due to allocator mix
Resolves: rhbz#1498207
* Wed Aug 23 2017 Petr Viktorin <pviktori@redhat.com> - 3.5.4-1
- Update to 3.5.4
see https://docs.python.org/3.5/whatsnew/changelog.html#python-3-5-4
- Remove upstreamed patches (259, 267, 269)
* Wed May 10 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.5.3-6
- Enable profile guided optimizations for x86_64 and i686 architectures
* Mon Apr 24 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.5.3-5
- Make pip installable in a new venv when using the --system-site-packages flag
* Tue Mar 21 2017 Tomas Orsava <torsava@redhat.com> - 3.5.3-4
- Fix syntax error in %%py_byte_compile macro (rhbz#1433569)
* Wed Mar 8 2017 Iryna Shcherbina <ishcherb@redhat.com> - 3.5.3-3
- Replace patch 259 with a backported upstream patch
* Thu Feb 09 2017 Petr Viktorin <pviktori@redhat.com> - 3.5.3-2
- Add patch 259 to work around magic number bump in Python 3.5.3
* Tue Jan 31 2017 Iryna Shcherbina <ishcherb@redhat.com> - 3.5.3-1
- Rebased to version 3.5.3
* Wed Sep 14 2016 Charalampos Stratakis <cstratak@redhat.com> - 3.5.2-4
- Obsolete and Provide python35 package

View File

@ -1 +1 @@
8906efbacfcdc7c3c9198aeefafd159e Python-3.5.2.tar.xz
SHA512 (Python-3.5.4.tar.xz) = dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff