cpython/Lib
Pablo Galindo Salgado 4ed40146f1
gh-149202: Fix frame pointer unwinding on s390x and ARM (GH-149362)
-fno-omit-frame-pointer is not enough to make every target walkable by the
simple manual frame pointer unwinder.

The helper used by test_frame_pointer_unwind used to assume the frame pointer
named a two-word record where fp[0] was the previous frame pointer and fp[1]
was the return address. That is only the generic layout used by some targets.
This patch keeps that default, but moves the slots behind named offsets so
architecture-specific layouts can describe where the backchain and return
address really live.

On s390x, GCC and Clang do not emit a usable backchain unless -mbackchain is
enabled. Without it, the unwinder stops at the current C frame and the test
reports no Python frames. Once backchains are present, the helper must also
stop at the current thread's known C stack bounds; otherwise it can follow the
final backchain far enough to dereference an invalid frame and segfault.
For Linux s390x backchain frames, the documented z/Architecture stack-frame
layout saves r14, the return-address register, at byte offset 112 from the
frame pointer, so read the return address from that named slot instead of fp[1].

The 112-byte offset comes from Linux's s390 debugging documentation: its Stack
Frame Layout table shows z/Architecture backchain frames with the backchain at
offset 0 and saved r14 of the caller function at offset 112:
https://www.kernel.org/doc/html/v5.3/s390/debugging390.html#stack-frame-layout

This helper remains scoped to Linux s390x backchain frames. GNU SFrame's s390x
notes state that the s390x ELF ABI does not generally mandate where RA and FP
are saved, or whether they are saved at all:
https://sourceware.org/binutils/docs/sframe-spec.html#s390x

As Jens Remus noted, -fno-omit-frame-pointer is not needed when -mbackchain is
present.

On 32-bit ARM, GCC defaults to Thumb mode on common armhf toolchains. The Thumb
prologue keeps the saved frame pointer and link register at offsets that depend
on the generated frame, which breaks the fp[0]/fp[1] walk used by the helper.
Use -marm when it is supported for frame-pointer builds, and teach the helper
the GCC ARM-mode slots where the previous frame pointer is at fp[-1] and the
saved LR return address is at fp[0].


Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-06 15:03:37 +00:00
..
__phello__
_pyrepl gh-130472: Use fancycompleter in import completions (#148188) 2026-05-05 01:36:43 +00:00
asyncio gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
collections gh-147957: pop items from UserDict in LIFO order (gh-147958) 2026-04-14 23:29:41 -05:00
compression
concurrent Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
ctypes gh-148675: Add Zd/Zf formats to array, ctypes, memoryview, struct (#148676) 2026-05-04 16:14:23 +02:00
curses gh-146153: Use frozendict in pure python fallback for curses.has_key (#146154) 2026-03-21 14:06:07 +01:00
dbm Fix typo: 'exept' -> 'except' in Lib/dbm/dumb.py (GH-144060) 2026-01-20 08:50:34 +02:00
email gh-81074: Allow non-ASCII addr_spec in email.headerregistry.Address (#122477) 2026-05-01 14:00:46 -04:00
encodings gh-146054: Limit the growth of encodings.search_function cache (GH-146055) 2026-03-17 15:02:59 +01:00
ensurepip gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
html
http gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
idlelib gh-139551: add support for BaseExceptionGroup in IDLE (GH-139563) 2026-04-12 10:06:41 -07:00
importlib GH-83065: Fix import deadlock by implementing hierarchical module locking (GH-137196) 2026-04-28 01:06:23 -07:00
json gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
logging gh-145650: Add logging.{Formatter,Filter}.__repr__ (GH-145652) 2026-03-26 12:41:14 +00:00
multiprocessing gh-137335: remove a mktemp use in multiprocessing.connection to avoid security scanner noise (GH-148578) 2026-04-14 23:31:58 +00:00
pathlib gh-137855: Improve import time of pathlib (GH-146327) 2026-05-05 14:38:03 +02:00
profiling gh-146256: Add --jsonl collector to the profiling.sampling (#146257) 2026-05-05 00:44:37 +00:00
pydoc_data Python 3.15.0a8 2026-04-07 14:24:03 +03:00
re gh-86519: Add prefixmatch APIs to the re module (GH-31137) 2026-02-15 17:43:39 -08:00
site-packages
sqlite3 gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
string
sysconfig gh-146541: Allow building the Android testbed for 32-bit targets (#146542) 2026-04-04 11:27:27 +08:00
test gh-149202: Fix frame pointer unwinding on s390x and ARM (GH-149362) 2026-05-06 15:03:37 +00:00
tkinter gh-47655: Add support for user data and detail of Tk events to tkinter (GH-7142) 2026-02-25 10:34:00 +02:00
tomllib gh-149231: tomllib: Limit the number of parts in a key (GH-149233) 2026-05-04 13:49:07 +02:00
turtledemo gh-137586: Open external osascript program with absolute path (GH-137584) 2026-04-06 09:42:10 -07:00
unittest gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
urllib gh-138907: Support RFC 9309 in robotparser (GH-138908) 2026-05-04 18:03:11 +00:00
venv gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
wsgiref gh-144370: Disallow usage of control characters in status in wsgiref.handlers for security (#144371) 2026-03-06 13:22:21 +01:00
xml gh-139489: Add xml.is_valid_text() (GH-149412) 2026-05-06 14:40:10 +00:00
xmlrpc
zipfile gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
zoneinfo gh-145883: Fix two heap-buffer-overflows in _zoneinfo (#145885) 2026-04-04 13:29:17 +01:00
__future__.py
__hello__.py
_aix_support.py
_android_support.py gh-144415: Android testbed fixes (#142912) 2026-02-03 16:37:34 +08:00
_apple_support.py
_ast_unparse.py gh-143055: Fix crash in AST unparser when unparsing dict comprehension unpacking (#145556) 2026-03-09 10:37:23 -07:00
_collections_abc.py gh-141510, PEP 814: Add built-in frozendict type (#144757) 2026-02-17 10:54:41 +01:00
_colorize.py gh-148352: Add more colour to calendar CLI output (#148354) 2026-05-04 15:14:57 +03:00
_compat_pickle.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
_ios_support.py
_markupbase.py
_opcode_metadata.py GH-143732: SEND specialization (GH-148963) 2026-05-05 15:19:16 +01:00
_osx_support.py gh-136677: Introduce executable specific linker flags to configure (#137296) 2026-02-24 22:52:02 +00:00
_py_abc.py
_py_warnings.py gh-143231: Add the module attribute to warnings.WarningMessage (GH-149298) 2026-05-03 09:35:47 +00:00
_pydatetime.py
_pydecimal.py
_pyio.py gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629) 2026-01-15 16:08:55 +01:00
_pylong.py
_sitebuiltins.py gh-145035: Allows removing the _pyrepl module to completely disable the modern REPL (GH-145159) 2026-03-10 14:58:32 +01:00
_strptime.py GH-70647: Remove support for %d (and deprecate for %e) without year in strptime() (GH-144570) 2026-04-14 17:15:27 -07:00
_threading_local.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
_weakrefset.py
abc.py
annotationlib.py gh-148680: Replace internal names with type_reprs of objects in string representations of ForwardRef (#148682) 2026-04-23 06:22:20 -07:00
antigravity.py
argparse.py gh-142389: Add support for backtick colorisation in argparse help text (#149375) 2026-05-04 22:58:04 +00:00
ast.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
base64.py gh-146311: Reject non-canonical padding bits in base32, 64, & 85 decoding (GH-146312) 2026-04-25 16:02:51 -07:00
bdb.py
bisect.py
bz2.py
calendar.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
cmd.py
code.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
codecs.py
codeop.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
colorsys.py
compileall.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
configparser.py gh-148370: prevent quadratic behavior in configparser.ParsingError.combine (#148452) 2026-04-14 00:32:54 +02:00
contextlib.py gh-125862: Keep ContextDecorator open across generator/coroutine execution (GH-136212) 2026-04-28 05:26:38 +00:00
contextvars.py
copy.py gh-141510: Fix copy.deepcopy() for recursive frozendict (#145027) 2026-02-21 15:30:40 +00:00
copyreg.py
cProfile.py
csv.py
dataclasses.py gh-149321: Fix stdlib imports with lazy imports disabled (#149338) 2026-05-04 19:03:21 +01:00
datetime.py
decimal.py
difflib.py gh-149189: Modern defaults for pprint (#149190) 2026-05-05 15:04:05 +03:00
dis.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
doctest.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
enum.py gh-140806: add docs for enum.bin function (#140807) 2026-01-12 13:34:18 +02:00
filecmp.py
fileinput.py
fnmatch.py
fractions.py
ftplib.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
functools.py gh-141510: Use frozendict in the stdlib (#144909) 2026-03-06 10:25:09 +01:00
genericpath.py gh-74453: Deprecate os.path.commonprefix (#144436) 2026-02-05 22:37:05 +02:00
getopt.py
getpass.py gh-138577: Fix keyboard shortcuts in getpass with echo_char (#141597) 2026-03-30 11:11:13 +02:00
gettext.py gh-141510: Use frozendict in the stdlib (#144909) 2026-03-06 10:25:09 +01:00
glob.py gh-144835: Added missing explanations for some parameters in glob and iglob. (#144836) 2026-03-02 08:56:28 -03:00
graphlib.py GH-143948: Explain graphlib's cycle-finding code (#143950) 2026-01-20 19:28:48 -06:00
gzip.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
hashlib.py
heapq.py Indexing is more straight-forward (and faster) than unpacking (gh-145154) 2026-02-23 12:31:35 -06:00
hmac.py gh-142451: correctly copy HMAC attributes in HMAC.copy() (#142510) 2025-12-14 09:45:36 +01:00
imaplib.py gh-142307: deprecate legacy support for altering IMAP4.file (#142335) 2026-05-06 17:41:26 +03:00
inspect.py gh-149096: Remove 'im_*' attribute reference from inspect module docstring (#149108) 2026-05-05 22:25:08 -04:00
io.py
ipaddress.py
keyword.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
linecache.py
locale.py gh-123853: Update locale.windows_locale (GH-123901) 2026-04-20 11:47:37 +03:00
lzma.py
mailbox.py bpo-32234: Allow mailbox instances as context managers (GH-4770) 2026-02-16 14:14:26 +01:00
mimetypes.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
modulefinder.py gh-84530: fix namespace package support in modulefinder (#29196) 2025-12-09 15:50:50 +00:00
netrc.py gh-139633: Run netrc file permission check only once per parse (GH-139634) 2026-03-30 22:05:18 +03:00
ntpath.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
nturl2path.py
numbers.py
opcode.py gh-148871: extend and improve LOAD_COMMON_CONSTANT (GH-148971) 2026-05-02 19:59:51 +01:00
operator.py
optparse.py gh-141510: Use frozendict in the stdlib (#144909) 2026-03-06 10:25:09 +01:00
os.py
pdb.py gh-148615: Handle -- separator in pdb argument parsing (#148624) 2026-05-05 21:22:58 -07:00
pickle.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
pickletools.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
pkgutil.py gh-148641: Implement PEP 829 - startup configuration files (#149109) 2026-05-03 17:17:29 +00:00
platform.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
plistlib.py gh-141510: Support frozendict in plistlib (#145590) 2026-03-31 15:45:23 +03:00
poplib.py gh-143923: Reject control characters in POP3 commands 2026-01-20 20:46:32 +00:00
posixpath.py gh-74453: Deprecate os.path.commonprefix (#144436) 2026-02-05 22:37:05 +02:00
pprint.py gh-149189: Modern defaults for pprint (#149190) 2026-05-05 15:04:05 +03:00
profile.py GH-65961: Stop setting __cached__ on modules (GH-142165) 2025-12-11 11:44:46 -08:00
pstats.py
pty.py
py_compile.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
pyclbr.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
pydoc.py gh-145035: Allows removing the _pyrepl module to completely disable the modern REPL (GH-145159) 2026-03-10 14:58:32 +01:00
queue.py
quopri.py
random.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
reprlib.py
rlcompleter.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
runpy.py gh-149117: Set ImportError.name on errors from runpy.run_module/run_path (gh-149159) 2026-05-02 12:27:23 +10:00
sched.py
secrets.py
selectors.py
shelve.py
shlex.py
shutil.py gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows (GH-146591) 2026-04-27 21:43:15 +03:00
signal.py
site.py gh-148641: Implement PEP 829 - startup configuration files (#149109) 2026-05-03 17:17:29 +00:00
smtplib.py gh-70039: smtplib: store the server name in ._host in .connect() (#115259) 2026-04-08 17:46:25 -04:00
socket.py gh-146139: Disable socketpair authentication on WASI (#146140) 2026-04-13 21:06:36 +00:00
socketserver.py
ssl.py gh-141510: Use frozendict in the stdlib (#144909) 2026-03-06 10:25:09 +01:00
stat.py gh-144050: Fix stat.filemode pure Python file type detection (GH-144059) 2026-01-20 14:05:42 +02:00
statistics.py statistics: Fix geometric_mean() error message for negative inputs (#149246) 2026-05-01 22:54:24 -05:00
stringprep.py
struct.py
subprocess.py gh-47798: Refactor the POSIX subprocess.Popen._communicate selector loop into helpers (GH-149032) 2026-04-27 00:40:20 +00:00
symtable.py gh-141510: Use frozendict in the stdlib (#144909) 2026-03-06 10:25:09 +01:00
tabnanny.py
tarfile.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
tempfile.py gh-66305: Fix a hang on Windows in the tempfile module (GH-144672) 2026-02-24 13:05:06 +02:00
textwrap.py
this.py
threading.py gh-124397: Add free-threading support for iterators. (gh-148894) 2026-05-01 16:31:00 -05:00
timeit.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
token.py
tokenize.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
trace.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
traceback.py gh-146406: Add cross-language method suggestions for builtin AttributeError (#146407) 2026-05-04 21:38:07 +00:00
tracemalloc.py
tty.py
turtle.py Fix pyflakes warnings: variable is assigned to but never used (#142294) 2025-12-08 14:00:31 +01:00
types.py gh-142349: Implement PEP 810 - Explicit lazy imports (#142351) 2026-02-12 00:15:33 +00:00
typing.py gh-149415: Replace typing._LazyAnnotationLib with lazy import (#149416) 2026-05-06 12:58:45 +00:00
uuid.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
warnings.py
wave.py gh-117716: Fix wave RIFF padding for data chunks (GH-145237) 2026-04-15 14:21:43 +02:00
weakref.py gh-124748: Fix handling kwargs in WeakKeyDictionary.update() (#124783) 2026-02-18 13:17:08 +00:00
webbrowser.py gh-137586: Replace 'osascript' with 'open' on macOS in webbrowser (#146439) 2026-05-06 16:56:17 +03:00
zipapp.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
zipimport.py