When building SIP and its test with the following hardening flags (default in Debian):
-Wdate-time -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection
I am getting this:
................................*** stack smashing detected ***: terminated
Python traceback:
Current thread 0x00007f8ed6255200 [python3.14] (most recent call first):
File "/home/dmitry/python-team/sip6/.pybuild/cpython3_3.14_sipbuild/build/test/v13_enums/test_v13_enums.py", line 209 in test_typed_get_member
File "/usr/lib/python3/dist-packages/_pytest/python.py", line 157 in pytest_pyfunc_call
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 121 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 512 in __call__
File "/usr/lib/python3/dist-packages/_pytest/python.py", line 1671 in runtest
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 178 in pytest_runtest_call
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 121 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 512 in __call__
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 246 in <lambda>
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 344 in from_call
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 245 in call_and_report
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 136 in runtestprotocol
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 117 in pytest_runtest_protocol
...
C++ stack trace:
(gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1 0x00007ffff7cef49f in __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
#2 0x00007ffff7c98942 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007ffff7c804ac in __GI_abort () at ./stdlib/abort.c:77
#4 0x00007ffff7c814e5 in __libc_message_impl (fmt=fmt@entry=0x7ffff7e061ce "*** %s ***: terminated\n") at ../sysdeps/posix/libc_fatal.c:138
#5 0x00007ffff7d77055 in __GI___fortify_fail (msg=msg@entry=0x7ffff7e061e6 "stack smashing detected") at ./debug/fortify_fail.c:24
#6 0x00007ffff7d78300 in __stack_chk_fail () at ./debug/stack_chk_fail.c:24
#7 0x00007fffab718de4 in sipVH_v13_enums_module_2 (sipGILState=PyGILState_LOCKED, sipErrorHandler=sipErrorHandler@entry=0x0, sipPySelf=0x7fffabafdd10, sipMethod=0x7fffabb3ca40)
at ./.pybuild/cpython3_3.14_sipbuild/build/test/v13_enums/v13_enums_module/build/v13_enums_module/sipv13_enums_modulecmodule.cpp:57
#8 0x00007fffab718173 in sipEnumClass::typed_virt (this=0x1ad03a0)
at ./.pybuild/cpython3_3.14_sipbuild/build/test/v13_enums/v13_enums_module/build/v13_enums_module/sipv13_enums_moduleEnumClass.cpp:65
#9 0x00007fffab717eba in EnumClass::typed_get (this=<optimized out>) at ./.pybuild/cpython3_3.14_sipbuild/build/test/v13_enums/v13_enums_module.sip:92
#10 meth_EnumClass_typed_get (sipSelf=<optimized out>, sipArgs=<optimized out>)
at ./.pybuild/cpython3_3.14_sipbuild/build/test/v13_enums/v13_enums_module/build/v13_enums_module/sipv13_enums_moduleEnumClass.cpp:309
#11 0x000000000056c859 in ?? ()
#12 0x0000000000525c4c in _PyObject_MakeTpCall ()
#13 0x000000000054f84e in _PyEval_EvalFrameDefault ()
...
The relevant part of sipv13_enums_modulecmodule.cpp is:
49 ::EnumClass::ClassTypedEnum sipVH_v13_enums_module_2(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod)
50 {
51 ::EnumClass::ClassTypedEnum sipRes = ::EnumClass::ClassTypedMember;
52 PyObject *sipResObj = sipCallMethod(SIP_NULLPTR, sipMethod, "");
53
54 sipParseResultEx(sipGILState, sipErrorHandler, sipPySelf, sipMethod, sipResObj, "F", sipType_EnumClass_ClassTypedEnum, &sipRes);
55
56 return sipRes;
57 }
This is a regression in SIP v6.15.2, in SIP v6.15.1 it was fine.
When building SIP and its test with the following hardening flags (default in Debian):
I am getting this:
Python traceback:
C++ stack trace:
The relevant part of
sipv13_enums_modulecmodule.cppis:This is a regression in SIP v6.15.2, in SIP v6.15.1 it was fine.