René's URL Explorer Experiment


Title: CI: UBSan runs GIL-only and never against the JIT; two configurations already shipped by distros are unsanitized · Issue #154927 · python/cpython · GitHub

Open Graph Title: CI: UBSan runs GIL-only and never against the JIT; two configurations already shipped by distros are unsanitized · Issue #154927 · python/cpython

X Title: CI: UBSan runs GIL-only and never against the JIT; two configurations already shipped by distros are unsanitized · Issue #154927 · python/cpython

Description: Feature or enhancement Proposal The UBSan job in .github/workflows/build.yml runs against exactly one configuration: GIL-enabled, no JIT. Two configurations that CI already builds — and that distributions already ship — are never sanitiz...

Open Graph Description: Feature or enhancement Proposal The UBSan job in .github/workflows/build.yml runs against exactly one configuration: GIL-enabled, no JIT. Two configurations that CI already builds — and that distri...

X Description: Feature or enhancement Proposal The UBSan job in .github/workflows/build.yml runs against exactly one configuration: GIL-enabled, no JIT. Two configurations that CI already builds — and that distri...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CI: UBSan runs GIL-only and never against the JIT; two configurations already shipped by distros are unsanitized","articleBody":"# Feature or enhancement\n\n## Proposal\n\nThe UBSan job in `.github/workflows/build.yml` runs against exactly one configuration: GIL-enabled, no JIT. Two configurations that CI already builds — and that distributions already ship — are never sanitized. Both are cheap to add, and I have measured what each would have caught.\n\n### 1. UBSan × `free-threading: true`\n\nThe sanitizer matrix pairs TSan with `free-threading: {false, true}` but UBSan only with `false`:\n\n```yaml\n        free-threading:\n        - false\n        - true\n        sanitizer:\n        - TSan\n        include:\n        - check-name: Undefined behavior\n          sanitizer: UBSan\n          free-threading: false\n```\n\nSo files that only compile under `Py_GIL_DISABLED` are never built under UBSan. That is not a hypothetical gap: `Python/uniqueid.c:185` shifted a negative per-thread refcount delta left, which is UB, and it fired from interpreter startup and from every GC cycle. Over the full suite with all suppressions disabled:\n\n|          | UB reports | test failures | failing files |\n|----------|-----------:|--------------:|--------------:|\n| before   |       1762 |           529 |            61 |\n| after #154915 |      0 |             0 |             0 |\n\nOnce #154915 lands, this configuration is green, so adding it is a regression guard rather than a source of new work.\n\n### 2. UBSan × `--enable-experimental-jit`\n\n`jit.yml` builds the JIT in several configurations and `tail-call.yml` builds `--with-tail-call-interp`, but neither is ever combined with a sanitizer. The JIT's own C code — the stencil patcher in `Python/jit.c`, and the tier-2 optimiser in `Python/optimizer*.c` which only compiles under `-D_Py_TIER2=1` — is therefore never sanitized in CI.\n\nThis one has already proven productive when done by hand: gh-139269 (an unaligned `uint64_t` store in `Python/jit.c`'s `patch_*` functions, which segfaulted release builds) was found by building `--enable-experimental-jit` with `-fsanitize=address,undefined`, and gh-142476 was an ASan-found leak in `allocate_executor`.\n\nI ran the full test suite against a machine-code JIT build under UBSan, with every entry in `Tools/ubsan/suppressions.txt` disabled: **clean, zero reports**, 51,459 tests across 493 files, 4m50s. Verified non-vacuous — `_testinternalcapi.get_jit_backend()` returns `jit` and a hot loop produces real machine-code ranges, so this was the copy-and-patch JIT rather than a silent fallback to the uop interpreter.\n\nSince it is already green, this is also a pure regression guard.\n\n## Two smaller findings from the same sweep\n\n- **`local-bounds` is enabled nowhere.** `--with-undefined-behavior-sanitizer` injects plain `-fsanitize=undefined`, and `local-bounds` is not in that group even though it detects genuine UB. I built with it on and ran the full suite: **zero findings**, including no false positives from the trailing variable-length array idiom, which was the obvious risk. It looks free to add.\n- **`float-divide-by-zero`** (also not in the group) yields exactly one hit, `Modules/expat/xmlparse.c:869`, in vendored libexpat, which deliberately relies on IEEE-754 `+inf` and documents that in a comment. Not worth enabling without excluding expat.\n\n## On cost\n\nThe usual objection to widening the matrix is build time. For reference, a full PGO + ThinLTO + UBSan build — the heaviest combination I tried, including the instrumented build, the profile run, the rebuild and the ThinLTO link — took **9 min 43 s** at `--jobs=8`. A plain UBSan build is far cheaper, and the JIT suite run above took under five minutes.\n\n(That PGO/LTO configuration found nothing new, incidentally. It is worth noting only because `--enable-optimizations` and `--with-lto` appear in no workflow at all, while Arch, Debian and python-build-standalone all ship them. UBSan's checks are source-level, so PGO/LTO mostly changes which UB is *reached*; miscompilation from UB would show up as test failures rather than sanitizer reports, which is a different exercise.)\n\n## Linked PRs\n\n- #154915 — fixes the free-threaded UB, prerequisite for adding that matrix entry\n\n# Has this already been discussed elsewhere?\n\nThis is a follow-up to gh-148286.\n\n# Links to previous discussion of this feature:\n\n- gh-148286\n- gh-139269\n- gh-142476\n","author":{"url":"https://github.com/matthiasgoergens","@type":"Person","name":"matthiasgoergens"},"datePublished":"2026-07-30T13:22:46Z","url":"https://github.com/python/cpython/issues/154927"}

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:13b66216-617c-c3b4-cdfa-24ff5c466b54
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA234:21BD98:3FC7835:50AD7D3:6B024F23
html-safe-nonce54450738d9111c2f2986a0516dbc7f987ee669d31d2a56572d7ee0b8fac68771
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjM0OjIxQkQ5ODozRkM3ODM1OjUwQUQ3RDM6NkIwMjRGMjMiLCJ2aXNpdG9yX2lkIjoiODc4NDc3NjU3NDQzMDI4NzcxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8d34b495b2b65070c095bd1bd3fa5f8d7bf90db630885560691d4912caf8d790
hovercard-subject-tagissue:5020175548
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/154927/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bf49303fdb15ee25e80a5e73b7bcabc840c0b92308e4ff22057a155af689128c/python/cpython/issues/154927
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bf49303fdb15ee25e80a5e73b7bcabc840c0b92308e4ff22057a155af689128c/python/cpython/issues/154927
og:image:altFeature or enhancement Proposal The UBSan job in .github/workflows/build.yml runs against exactly one configuration: GIL-enabled, no JIT. Two configurations that CI already builds — and that distri...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamematthiasgoergens
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-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/154927#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F154927
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%2F154927
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/154927
Reloadhttps://github.com/python/cpython/issues/154927
Reloadhttps://github.com/python/cpython/issues/154927
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/154927
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/154927
CI: UBSan runs GIL-only and never against the JIT; two configurations already shipped by distros are unsanitizedhttps://github.com/python/cpython/issues/154927#top
infraCI, GitHub Actions, buildbots, Dependabot, etc.https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22infra%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com/matthiasgoergens
matthiasgoergenshttps://github.com/matthiasgoergens
on Jul 30, 2026https://github.com/python/cpython/issues/154927#issue-5020175548
#154915https://github.com/python/cpython/pull/154915
#154915https://github.com/python/cpython/pull/154915
gh-139269https://github.com/python/cpython/issues/139269
gh-142476https://github.com/python/cpython/issues/142476
gh-148286: Fix undefined behaviour in per-thread refcount merging #154915https://github.com/python/cpython/pull/154915
gh-148286https://github.com/python/cpython/issues/148286
Various UB warnings found by UBSan #148286https://github.com/python/cpython/issues/148286
JIT: UB: unaligned store in patch_* functions #139269https://github.com/python/cpython/issues/139269
ASan memory leak in test_gc with --enable-experimental-jit (allocate_executor) #142476https://github.com/python/cpython/issues/142476
picnixzhttps://github.com/picnixz
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
infraCI, GitHub Actions, buildbots, Dependabot, etc.https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22infra%22
on Jul 30, 2026https://github.com/python/cpython/issues/154927#event-28739250594
https://github.com/StanFromIreland
StanFromIrelandhttps://github.com/StanFromIreland
on Jul 30, 2026https://github.com/python/cpython/issues/154927#issuecomment-5135093794
https://github.com/matthiasgoergens
matthiasgoergenshttps://github.com/matthiasgoergens
on Aug 1, 2026https://github.com/python/cpython/issues/154927#issuecomment-5150775774
gh-148286: Fix undefined behaviour in per-thread refcount merging #154915https://github.com/python/cpython/pull/154915
gh-148286: Fix undefined behaviour in per-thread refcount merging #154915https://github.com/python/cpython/pull/154915
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/154927
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/154927
infraCI, GitHub Actions, buildbots, Dependabot, etc.https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22infra%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%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.