René's URL Explorer Experiment


Title: JIT: UB: unaligned store in `patch_*` functions · Issue #139269 · python/cpython · GitHub

Open Graph Title: JIT: UB: unaligned store in `patch_*` functions · Issue #139269 · python/cpython

X Title: JIT: UB: unaligned store in `patch_*` functions · Issue #139269 · python/cpython

Description: Bug report Bug description: Summary When the CPython main branch is compiled with Clang using the experimental JIT (--enable-experimental-jit) and memory sanitizers (-fsanitize=address,undefined), it reliably crashes during the test suit...

Open Graph Description: Bug report Bug description: Summary When the CPython main branch is compiled with Clang using the experimental JIT (--enable-experimental-jit) and memory sanitizers (-fsanitize=address,undefined), ...

X Description: Bug report Bug description: Summary When the CPython main branch is compiled with Clang using the experimental JIT (--enable-experimental-jit) and memory sanitizers (-fsanitize=address,undefined), ...

Opengraph URL: https://github.com/python/cpython/issues/139269

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JIT: UB: unaligned store in `patch_*` functions","articleBody":"# Bug report\n\n### Bug description:\n\n#### Summary\n\nWhen the CPython `main` branch is compiled with Clang using the experimental JIT (`--enable-experimental-jit`) and memory sanitizers (`-fsanitize=address,undefined`), it reliably crashes during the test suite execution.\n\nThe crash is preceded by a clear UndefinedBehaviorSanitizer (UBSan) report indicating a misaligned memory store/load of a `uint64_t` within `Python/jit.c`. This undefined behavior immediately leads to a segmentation fault, which is caught by AddressSanitizer (ASan).\n\nThe issue has been reproduced with both **C11** and **C17** language standards, and with different optimization levels (`-O1`, `-O3`), confirming that this is a fundamental bug in the JIT's code generation or patching logic, not an artifact of a specific build configuration.\n\n#### Environment\n\n*   **CPython Version:** `main` branch, commit `dd45179fa0`\n*   **Operating System:** Linux (Ubuntu 24.04 based, Kernel 6.14.0-32-generic)\n*   **Architecture:** x86_64\n*   **Compiler:** Clang 20.1.2 (`Ubuntu clang version 20.1.2 (0ubuntu1)`)\n\n#### Configuration\n\nThe bug is reproducible with the following minimal debug configuration (PGO and LTO are not required to trigger the crash):\n\n**Environment Variables:**\n```sh\nexport CC=clang\nexport CXX=clang++\nexport CFLAGS=\"-std=c11 -g -O1 -fno-omit-frame-pointer -fsanitize=address,undefined\"\nexport LDFLAGS=\"-fsanitize=address,undefined\"\n```\n\n**Configure Command:**\n```sh\n./configure --with-pydebug \\\n            --enable-experimental-jit \\\n            --with-address-sanitizer \\\n            --with-undefined-behavior-sanitizer\n```\n\n#### Steps to Reproduce\n\n1.  Clone the CPython repository and check out the `main` branch.\n2.  Create an out-of-tree build directory: `mkdir build && cd build`\n3.  Run the `configure` command from the section above (e.g., `../configure ...`).\n4.  Compile CPython: `make -j$(nproc)`\n5.  Run a test known to trigger the issue (e.g., `test_array` or `test_asyncio`):\n    ```sh\n    ./python -m test test_array\n    ```\n\n#### Expected Results\n\nThe test should run and pass without crashing the interpreter.\n\n#### Actual Results\n\nThe interpreter crashes with a segmentation fault. The sanitizers provide detailed reports just before the crash.\n\n**UBSan Report:**\nThe first error reported is from UBSan, indicating the root cause:\n```\n../../Python/jit.c:228:5: runtime error: store to misaligned address 0x7be05a2205ab for type 'uint64_t' (aka 'unsigned long'), which requires 8 byte alignment\n0x7be05a2205ab: note: pointer points here\n 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00\n              ^\nSUMMARY: UndefinedBehaviorSanitizer: misaligned-pointer-use ../../Python/jit.c:228:5\n```\n\n**ASan and Faulthandler Report:**\nImmediately following the UBSan report, the program aborts, and ASan/faulthandler provide a stack trace of the crash:\n```\nFatal Python error: Aborted\n\nCurrent thread 0x00007be05a2d7380 [python] (most recent call first):\n  File \"/home/shamil/oss/cpython/main/Lib/inspect.py\", line 1719 in _shadowed_dict\n  ... (Python stack trace) ...\n  File \"/home/shamil/oss/cpython/main/Lib/runpy.py\", line 198 in _run_module_as_main\n\nCurrent thread's C stack trace (most recent call first):\n  ...\n  #0 0x5ab05b94e8a9 in patch_64 /home/shamil/oss/cpython/main/build/jit_debug_c11/../../Python/jit.c:228:12\n  #1 0x5ab05b94e8a9 in emit__COLD_EXIT /home/shamil/oss/cpython/main/build/jit_debug_c11/./jit_stencils-x86_64-unknown-linux-gnu.h:36611:5\n  #2 0x5ab05ba01e43 in _PyJIT_Compile /home/shamil/oss/cpython/main/build/jit_debug_c11/../../Python/jit.c:542:9\n  ... (C stack trace) ...\n```\n\n#### Full logs\n\n[logs.txt](https://github.com/user-attachments/files/22499004/logs.txt)\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-139271\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/ashm-dev","@type":"Person","name":"ashm-dev"},"datePublished":"2025-09-23T17:07:08Z","url":"https://github.com/python/cpython/issues/139269"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6758970d-93f4-0468-7258-8c1b055d6fe6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA390:2412:2335CE:2E3F79:6B024F1A
html-safe-nonce91be92087ee59e3f03f1683a7abe94c8823606a264fd00d763d9ea88c727d588
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzkwOjI0MTI6MjMzNUNFOjJFM0Y3OTo2QjAyNEYxQSIsInZpc2l0b3JfaWQiOiI2ODk5MTEyNTc5MDM4MzM0NzQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8539a95593b35e99270a8f1343328165fa72fa4dce772b7035a5f2fb1d399d57
hovercard-subject-tagissue:3446055335
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/139269/issue_layout
twitter:imagehttps://opengraph.githubassets.com/10bc2677d01c57b95dbbd17050f64e6781935fa85b744a8b2481e2dec5d01190/python/cpython/issues/139269
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/10bc2677d01c57b95dbbd17050f64e6781935fa85b744a8b2481e2dec5d01190/python/cpython/issues/139269
og:image:altBug report Bug description: Summary When the CPython main branch is compiled with Clang using the experimental JIT (--enable-experimental-jit) and memory sanitizers (-fsanitize=address,undefined), ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameashm-dev
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/139269#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F139269
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F139269
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/139269
Reloadhttps://github.com/python/cpython/issues/139269
Reloadhttps://github.com/python/cpython/issues/139269
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/139269
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/139269
JIT: UB: unaligned store in patch_* functionshttps://github.com/python/cpython/issues/139269#top
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-JIThttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-JIT%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/ashm-dev
ashm-devhttps://github.com/ashm-dev
on Sep 23, 2025https://github.com/python/cpython/issues/139269#issue-3446055335
logs.txthttps://github.com/user-attachments/files/22499004/logs.txt
gh-139269: Fix unaligned memory access in JIT code patching functions #139271https://github.com/python/cpython/pull/139271
ashm-devhttps://github.com/ashm-dev
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Sep 23, 2025https://github.com/python/cpython/issues/139269#event-19871226723
zwarehttps://github.com/zware
topic-JIThttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-JIT%22
on Sep 23, 2025https://github.com/python/cpython/issues/139269#event-19871334554
picnixzhttps://github.com/picnixz
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
on Sep 23, 2025https://github.com/python/cpython/issues/139269#event-19871442474
picnixzhttps://github.com/picnixz
on Sep 23, 2025https://github.com/python/cpython/issues/139269#event-19871531022
https://github.com/ashm-dev
ashm-devhttps://github.com/ashm-dev
on Sep 23, 2025https://github.com/python/cpython/issues/139269#issuecomment-3324954275
picnixzhttps://github.com/picnixz
on Sep 23, 2025https://github.com/python/cpython/issues/139269#event-19871787996
ashm-devhttps://github.com/ashm-dev
on Sep 23, 2025https://github.com/python/cpython/issues/139269#event-19872147870
Merge branch 'main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/b0367728e02bc87deb16de32736325729f9463b1
pythongh-139269https://github.com/python/cpython/issues/139269
b036772https://github.com/ashm-dev/cpython/commit/b0367728e02bc87deb16de32736325729f9463b1
Merge remote-tracking branch 'upstream/main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/cf3c01b24f84ad287673176a968075e7cccbc45b
pythongh-139269https://github.com/python/cpython/issues/139269
cf3c01bhttps://github.com/ashm-dev/cpython/commit/cf3c01b24f84ad287673176a968075e7cccbc45b
Merge branch 'main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/827aa7e2ed63643a0dc161599ad929e0f92f54a4
pythongh-139269https://github.com/python/cpython/issues/139269
827aa7ehttps://github.com/ashm-dev/cpython/commit/827aa7e2ed63643a0dc161599ad929e0f92f54a4
Merge remote-tracking branch 'upstream/main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/2c1339b2a583e5b79b537c1f48cf1b1ef220d9c6
pythongh-139269https://github.com/python/cpython/issues/139269
2c1339bhttps://github.com/ashm-dev/cpython/commit/2c1339b2a583e5b79b537c1f48cf1b1ef220d9c6
Merge remote-tracking branch 'upstream/main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/d266ac0fdee4f6a206e7481b234b6de10b818105
pythongh-139269https://github.com/python/cpython/issues/139269
d266ac0https://github.com/ashm-dev/cpython/commit/d266ac0fdee4f6a206e7481b234b6de10b818105
Merge branch 'main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/f075c91ff9fcbf5a192760b6ffd36a7010363670
pythongh-139269https://github.com/python/cpython/issues/139269
f075c91https://github.com/ashm-dev/cpython/commit/f075c91ff9fcbf5a192760b6ffd36a7010363670
Merge remote-tracking branch 'upstream/main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/c2cf365177372f4c2eff3cc15452c0ea64086adf
pythongh-139269https://github.com/python/cpython/issues/139269
c2cf365https://github.com/ashm-dev/cpython/commit/c2cf365177372f4c2eff3cc15452c0ea64086adf
Merge branch 'main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/c36c2b7854798a5dec3268b435e94e191a4d5113
pythongh-139269https://github.com/python/cpython/issues/139269
c36c2b7https://github.com/ashm-dev/cpython/commit/c36c2b7854798a5dec3268b435e94e191a4d5113
Merge branch 'main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/3f327a585c38893ed16b508caef51ef9dd2ec6a2
pythongh-139269https://github.com/python/cpython/issues/139269
3f327a5https://github.com/ashm-dev/cpython/commit/3f327a585c38893ed16b508caef51ef9dd2ec6a2
ashm-devhttps://github.com/ashm-dev
on Oct 8, 2025https://github.com/python/cpython/issues/139269#event-20173768338
Merge remote-tracking branch 'upstream/main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/5e6670e63cebefde36051ae3495d091e2e1c3355
pythongh-139269https://github.com/python/cpython/issues/139269
5e6670ehttps://github.com/ashm-dev/cpython/commit/5e6670e63cebefde36051ae3495d091e2e1c3355
Merge remote-tracking branch 'upstream/main' into pythongh-139269https://github.com/ashm-dev/cpython/commit/71ea00a5c1461e344cad40998028290ee45d62ce
pythongh-139269https://github.com/python/cpython/issues/139269
71ea00ahttps://github.com/ashm-dev/cpython/commit/71ea00a5c1461e344cad40998028290ee45d62ce
Fidget-Spinnerhttps://github.com/Fidget-Spinner
on Oct 18, 2025https://github.com/python/cpython/issues/139269#event-20362892547
gh-139269: Fix unaligned memory access in JIT code patching functions (…https://github.com/python/cpython/commit/bedaea05987738c4c6b958d19cec9621bec09f07
gh-139269https://github.com/python/cpython/issues/139269
…https://github.com/python/cpython/pull/139271
bedaea0https://github.com/python/cpython/commit/bedaea05987738c4c6b958d19cec9621bec09f07
ashm-devhttps://github.com/ashm-dev
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 21, 2025https://github.com/python/cpython/issues/139269#event-20399375529
StanFromIrelandhttps://github.com/StanFromIreland
on Dec 6, 2025https://github.com/python/cpython/issues/139269#event-21401817009
pythongh-139269: Fix unaligned memory access in JIT code patching fun…https://github.com/StanFromIreland/cpython/commit/d3c1c3680f2b3043bdb8dade59c57d2d603ea410
pythongh-139269https://github.com/python/cpython/issues/139269
d3c1c36https://github.com/StanFromIreland/cpython/commit/d3c1c3680f2b3043bdb8dade59c57d2d603ea410
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/139269
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/139269
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-JIThttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-JIT%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.