Title: test_gdb.test_jit.test_bt_unwinds_from_inside_jit_executor is fragile on aarch64 release builds · Issue #157965 · python/cpython · GitHub
Open Graph Title: test_gdb.test_jit.test_bt_unwinds_from_inside_jit_executor is fragile on aarch64 release builds · Issue #157965 · python/cpython
X Title: test_gdb.test_jit.test_bt_unwinds_from_inside_jit_executor is fragile on aarch64 release builds · Issue #157965 · python/cpython
Description: Bug report Bug description: Adding the following below to the Python/bytecodes.c caused test_bt_unwinds_from_inside_jit_executor to fail for me even though by itself it's a NOOP change. Edit: At time of edit this test does not fail howev...
Open Graph Description: Bug report Bug description: Adding the following below to the Python/bytecodes.c caused test_bt_unwinds_from_inside_jit_executor to fail for me even though by itself it's a NOOP change. Edit: At ti...
X Description: Bug report Bug description: Adding the following below to the Python/bytecodes.c caused test_bt_unwinds_from_inside_jit_executor to fail for me even though by itself it's a NOOP change. Edit: A...
Opengraph URL: https://github.com/python/cpython/issues/157965
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_gdb.test_jit.test_bt_unwinds_from_inside_jit_executor is fragile on aarch64 release builds","articleBody":"# Bug report\n\n### Bug description:\n\nAdding the following below to the `Python/bytecodes.c` caused `test_bt_unwinds_from_inside_jit_executor` to fail for me even though by itself it's a NOOP change. \n\nEdit: At time of edit this test does not fail however I've referenced base commits where it has failed.\n\n\n```python\ntier2 op(_GUARD_BUILTINS_IS_CANONICAL, (--)) {\n DEOPT_IF(BUILTINS() != tstate->interp->builtins);\n}\n```\n\u003cdetails>\n\u003csummary>Test Failure\u003c/summary>\n```\n======================================================================\nERROR: test_bt_unwinds_from_inside_jit_executor (test.test_gdb.test_jit.JitBacktraceTests.test_bt_unwinds_from_inside_jit_executor)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/home/runner/work/cpython/cpython/Lib/test/test_gdb/test_jit.py\", line 199, in test_bt_unwinds_from_inside_jit_executor\n gdb_output = self.get_stack_trace(\n script=JIT_SAMPLE_SCRIPT,\n ...\u003c5 lines>...\n PYTHON_JIT=\"1\",\n )\n File \"/home/runner/work/cpython/cpython/Lib/test/test_gdb/test_jit.py\", line 88, in get_stack_trace\n return super().get_stack_trace(**kwargs)\n ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^\n File \"/home/runner/work/cpython/cpython/Lib/test/test_gdb/util.py\", line 265, in get_stack_trace\n out, err = run_gdb(*args, PYTHONHASHSEED=PYTHONHASHSEED, **env_vars)\n ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/cpython/cpython/Lib/test/test_gdb/util.py\", line 88, in run_gdb\n raise Exception(f\"{cmd_text} failed with exit code {proc.returncode}, \"\n ...\u003c2 lines>...\n f\"stderr={stderr!r}\")\nException: /usr/bin/gdb --batch -nx --init-eval-command 'add-auto-load-safe-path /home/runner/work/cpython/cpython/python-gdb.py' '--eval-command=set breakpoint pending yes' '--eval-command=break builtin_id' '--eval-command=set print address off' --eval-command=run '--eval-command=set print entry-values no' '--eval-command=python exec(\"import gdb\\ntarget = '\"'\"'py::jit:executor'\"'\"'\\nfor _ in range(20):\\n frame = gdb.selected_frame()\\n if frame is not None and frame.name() == target:\\n break\\n gdb.execute('\"'\"'finish'\"'\"')\\nelse:\\n raise RuntimeError('\"'\"'did not reach %s'\"'\"' % target)\\n\")' '--eval-command=python exec(\"import gdb\\ntarget = '\"'\"'py::jit:executor'\"'\"'\\nfor _ in range(4):\\n frame = gdb.selected_frame()\\n if frame is None or frame.name() != target:\\n raise RuntimeError('\"'\"'left JIT region during stepping: '\"'\"'\\n + repr(frame and frame.name()))\\n gdb.execute('\"'\"'si'\"'\"')\\nframe = gdb.selected_frame()\\nif frame is None or frame.name() != target:\\n raise RuntimeError('\"'\"'stepped out of JIT region after si'\"'\"')\\n\")' --eval-command=bt --args /home/runner/work/cpython/cpython/python -S /home/runner/work/cpython/cpython/Lib/test/test_gdb/gdb_jit_sample.py failed with exit code 1, expected exit code 0:\nstdout='Breakpoint 1 at 0x2b8e8c: file Python/clinic/bltinmodule.c.h, line 755.\\n[Thread debugging using libthread_db enabled]\\nUsing host libthread_db library \"/usr/lib/aarch64-linux-gnu/libthread_db.so.1\".\\n\\nBreakpoint 1, builtin_id (self=\u003cmodule at remote 0xfffff7b93cc0>, v=42) at Python/clinic/bltinmodule.c.h:755\\n755\\t return_value = builtin_id_impl((PyModuleDef *)self, v);\\n_PyObject_VectorcallTstate (tstate=\u003c_PyRuntime+249576>, callable=\u003cbuilt-in method id of module object at remote 0xfffff7b93cc0>, args=\u003coptimized out>, nargsf=\u003coptimized out>, kwnames=\u003coptimized out>) at ./Include/internal/pycore_call.h:144\\n144\\t res = func(callable, args, nargsf, kwnames);\\nValue returned is $1 = 187649991800368\\n_Py_VectorCallInstrumentation_StackRefSteal (callable=187649991800368, arguments=, total_args=1, kwnames=0x0, call_instrumentation=false, frame=, this_instr=\u003coptimized out>, tstate=\u003coptimized out>) at Python/ceval.c:774\\n774\\t STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);\\n_PyEval_EvalFrameDefault (tstate=\u003c_PyRuntime+249576>, frame=, throwflag=0) at Python/generated_cases.c.h:1916\\n1916\\t if (res_o == NULL) {\\nValue returned is $2 = 187649991800368\\n_PyEval_EvalFrame (tstate=\u003c_PyRuntime+249576>, frame=\u003coptimized out>, throwflag=0) at ./Include/internal/pycore_ceval.h:122\\n122\\t return _PyEval_EvalFrameDefault(tstate, frame, throwflag);\\nValue returned is $3 = None\\n[Inferior 1 (process 21431) exited normally]\\n'\nstderr=\"Python Exception \u003cclass 'gdb.error'>: No frame is currently selected.\\nError occurred in Python: No frame is currently selected.\\nPython Exception \u003cclass 'gdb.error'>: No frame is currently selected.\\nError occurred in Python: No frame is currently selected.\\nNo stack.\\n\"\n```\n\u003c/details>\n\nThis caused https://github.com/python/cpython/pull/157766 to fail however recently this is passing again with the latest main from merge. Commit [`212e6035133` ](https://github.com/python/cpython/commit/212e6035133) is an example of where this fails, however recent changes to main do not fail any more. \n\nFrom what I can tell with claude assistance this is related due to `veneer` being emitted.\n\n```\nBefore, main snapshot (adrp at page offset 0xf7c, no veneer):\n2d3f7c adrp x0, \u003cGOT page> ; page address of the global offset table (GOT)\n2d3f80 ldr x0, [x0, #2392] ; load &__stack_chk_guard from the GOT\n2d3f84 ldr x3, [sp, #120] ; load the canary saved on this frame's stack\n2d3f88 ldr x2, [x0] ; load the current guard value\n2d3f8c subs x3, x3, x2 ; compare; mismatch → __stack_chk_fail\n\nAfter, + tier2 op (adrp at page offset 0x03c, patched):\n2d403c adrp x0, \u003cGOT page>\n2d4040 ldr x0, [x0, #2408]\n2d4044 ldr x3, [sp, #120]\n2d4048 b e843419@… ; ← ld replaced the 4th instruction\n ...\ne843419@…: ldr x2, [x0] ; the same load, relocated\n b 2d404c ; jump back to the subs\n```\n\nWhen we hit the `vaneer` it looks to break the gdb call tracking chaining so likely the test is catching a genuine bug. It seems to be fairly random if vaneer is emitted depending on the layout generated by the source code.\n\nI added the AI analysis and some steps to reproducing in docker [here](https://github.com/johng/cpython/pull/8)\n\n\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/johng","@type":"Person","name":"johng"},"datePublished":"2026-09-22T20:52:55Z","url":"https://github.com/python/cpython/issues/157965"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d4992d0d-ba73-e483-7027-bf7e0523c658 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D71A:1B4E4E:2F9AC2:41CF1D:6AECC9CE |
| html-safe-nonce | e7df2da77fdddbc7be17a5d2c0f64edd5063e81b9a442216b52a7610e25b211e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzFBOjFCNEU0RToyRjlBQzI6NDFDRjFEOjZBRUNDOUNFIiwidmlzaXRvcl9pZCI6Ijg4ODE2NDExMTQ2MTE1MzQyODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f07a992d57507608e4ceb3c5b0aedb313cd605a4fcc838db76121b2c049a594c |
| hovercard-subject-tag | issue:5545121850 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/157965/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8107892864b6147ae1fd7319563a92b153be8a60e1c50df5c0e584ceb31fe0b/python/cpython/issues/157965 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8107892864b6147ae1fd7319563a92b153be8a60e1c50df5c0e584ceb31fe0b/python/cpython/issues/157965 |
| og:image:alt | Bug report Bug description: Adding the following below to the Python/bytecodes.c caused test_bt_unwinds_from_inside_jit_executor to fail for me even though by itself it's a NOOP change. Edit: At ti... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | johng |
| hostname | github.com |
| expected-hostname | github.com |
| None | dc0b519c5798dc1150b88dc4c06a8b9634d0069218dc04e469970e76aad74016 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | db139f0bf57b59bf9a8c4abb0849924d6c6ca559 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width