René's URL Explorer Experiment


Title: UBSan: runtime undefined behaviours when using `-fsanitize=undefined -fno-sanitize-recover` · Issue #132097 · python/cpython · GitHub

Open Graph Title: UBSan: runtime undefined behaviours when using `-fsanitize=undefined -fno-sanitize-recover` · Issue #132097 · python/cpython

X Title: UBSan: runtime undefined behaviours when using `-fsanitize=undefined -fno-sanitize-recover` · Issue #132097 · python/cpython

Description: Bug report Bug description: We finally managed to fix gh-111178, but this is assuming that Python is compiled with -fsanitize=function. When compiling Python as follows (with clang 18.1.8): ./configure \ -q --with-pydebug \ --with-undefi...

Open Graph Description: Bug report Bug description: We finally managed to fix gh-111178, but this is assuming that Python is compiled with -fsanitize=function. When compiling Python as follows (with clang 18.1.8): ./confi...

X Description: Bug report Bug description: We finally managed to fix gh-111178, but this is assuming that Python is compiled with -fsanitize=function. When compiling Python as follows (with clang 18.1.8): ./confi...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"UBSan: runtime undefined behaviours when using `-fsanitize=undefined -fno-sanitize-recover`","articleBody":"# Bug report\n\n### Bug description:\n\nWe finally managed to fix gh-111178, but this is assuming that Python is compiled with `-fsanitize=function`. When compiling Python as follows (with clang 18.1.8):\n\n```sh\n./configure \\\n\t-q --with-pydebug \\\n\t--with-undefined-behavior-sanitizer \\\n\tCC=clang LD=clang \\\n\tCFLAGS=\"-fsanitize=undefined -fno-sanitize-recover\" \\\n\tLDFLAGS=\"-fsanitize=undefined -fno-sanitize-recover\"\n```\n\nwe still have some tests failing:\n\n- https://github.com/python/cpython/pull/131605#issuecomment-2779318764\n- https://github.com/python/cpython/pull/131605#issuecomment-2779323572 (cc @vstinner as the original author to gh-131674).\n\nOthers related to the second item above:\n\n\u003cdetails\u003e\n\n```\n0:00:56 load avg: 32.43 [448/486/3] test_xxtestfuzz worker non-zero exit code (Exit code 1) -- running (2): test.test_multiprocessing_spawn.test_processes (54.6 sec), test.test_multiprocessing_forkserver.test_processes (55.2 sec)\nModules/expat/xmlparse.c:6779:5: runtime error: call to function expat_default_handler through pointer to incorrect function type 'void (*)(void *, const char *, int)'\n/$HOME/lib/python/cpython/./Modules/_elementtree.c:3212: note: expat_default_handler defined here\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Modules/expat/xmlparse.c:6779:5\n```\n\n\u003c/details\u003e\n\nOthers on fautlhandler, but I'm not sure whether this is the UB that is being reported or something else:\n\n\u003cdetails\u003e\n\n```txt\n    #0 0x7ff4cf25f76b in raise (/lib64/libpthread.so.0+0x1676b) (BuildId: 938e42b7e407d175ee3ef9a89c038168101d330c)\n    #1 0x55776b2dc6f2 in faulthandler_raise_sigsegv /$HOME/lib/python/cpython/./Modules/faulthandler.c:1053:5\n    #2 0x55776b2dc6f2 in faulthandler_sigsegv /$HOME/lib/python/cpython/./Modules/faulthandler.c:1069:9\n    #3 0x55776b01e13d in cfunction_call /$HOME/lib/python/cpython/Objects/methodobject.c:562:18\n    #4 0x55776af71824 in _PyObject_MakeTpCall /$HOME/lib/python/cpython/Objects/call.c:242:18\n    #5 0x55776b1a4db0 in _PyEval_EvalFrameDefault /$HOME/lib/python/cpython/Python/generated_cases.c.h:1434:35\n    #6 0x55776b174755 in _PyEval_Vector /$HOME/lib/python/cpython/Python/ceval.c:1902:12\n    #7 0x55776b1744d9 in PyEval_EvalCode /$HOME/lib/python/cpython/Python/ceval.c:829:21\n    #8 0x55776b2956b3 in run_mod /$HOME/lib/python/cpython/Python/pythonrun.c:1436:19\n    #9 0x55776b292931 in _PyRun_StringFlagsWithName /$HOME/lib/python/cpython/Python/pythonrun.c:1259:15\n    #10 0x55776b292931 in _PyRun_SimpleStringFlagsWithName /$HOME/lib/python/cpython/Python/pythonrun.c:578:15\n    #11 0x55776b2d70e5 in pymain_run_command /$HOME/lib/python/cpython/Modules/main.c:255:11\n    #12 0x55776b2d70e5 in pymain_run_python /$HOME/lib/python/cpython/Modules/main.c:671:21\n    #13 0x55776b2d70e5 in Py_RunMain /$HOME/lib/python/cpython/Modules/main.c:761:5\n    #14 0x55776b2d7775 in pymain_main /$HOME/lib/python/cpython/Modules/main.c:791:12\n    #15 0x55776b2d7802 in Py_BytesMain /$HOME/lib/python/cpython/Modules/main.c:815:12\n    #16 0x7ff4cf03624c in __libc_start_main (/lib64/libc.so.6+0x3524c) (BuildId: 74f77bf013a66413c77197c121955e029c32d259)\n    #17 0x55776ae8dd49 in _start /home/abuild/rpmbuild/BUILD/glibc-2.31/csu/../sysdeps/x86_64/start.S:120\n\nUndefinedBehaviorSanitizer can not provide additional info.\nSUMMARY: UndefinedBehaviorSanitizer: SEGV (/lib64/libpthread.so.0+0x1676b) (BuildId: 938e42b7e407d175ee3ef9a89c038168101d330c) in raise\n==9369==ABORTING\n```\n\n\u003c/details\u003e\n\nFinally, `test_regrtest` also fails but the test suite just hangs after crashing (but the UB seems to happen in a test related to XML so it's probably the same thing):\n\n\u003cdetails\u003e\n\n```\n0:01:16 load avg: 26.11 [485/486/5] test_regrtest failed (1 failure) (38.8 sec) -- running (1): test_socket (35.7 sec)\ntest test_regrtest failed -- Traceback (most recent call last):\n  File \"/$HOME/lib/python/cpython/Lib/test/test_regrtest.py\", line 2289, in test_xml\n    output = self.run_tests(testname, \"--junit-xml\", filename,\n                            exitcode=EXITCODE_BAD_TEST)\n  File \"/$HOME/lib/python/cpython/Lib/test/test_regrtest.py\", line 927, in run_tests\n    return self.run_python(cmdargs, **kw)\n           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^\n  File \"/$HOME/lib/python/cpython/Lib/test/test_regrtest.py\", line 777, in run_python\n    proc = self.run_command(args, **kw)\n  File \"/$HOME/lib/python/cpython/Lib/test/test_regrtest.py\", line 768, in run_command\n    self.fail(msg)\n    ~~~~~~~~~^^^^^\nAssertionError: Command ['/$HOME/lib/python/cpython/python', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=/tmp/test_python_3mwd8cdm/tmpsfkk6fdz', 'test_regrtest_noop51', '--junit-xml', '@test_12395_tmpæ'] failed with exit code 1, but exit code 2 expected!\n\nstdout:\n---\nUsing random seed: 777580575\n0:00:00 load avg: 26.11 Run 1 test sequentially in a single process\n0:00:00 load avg: 26.11 [1/1] test_regrtest_noop51\ntest test_regrtest_noop51 failed -- Traceback (most recent call last):\n  File \"/tmp/test_python_3mwd8cdm/tmpsfkk6fdz/test_regrtest_noop51.py\", line 8, in test_failed\n    self.fail()\n    ~~~~~~~~~^^\nAssertionError: None\n\nStdout:\nabc ef\n\n\nStdout:\nabc ef\nModules/expat/xmlparse.c:3162:9: runtime error: call to function expat_start_handler through pointer to incorrect function type 'void (*)(void *, const char *, const char **)'\n/$HOME/lib/python/cpython/./Modules/_elementtree.c:3259: note: expat_start_handler defined here\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Modules/expat/xmlparse.c:3162:9\n\n---\n\n0:01:46 load avg: 16.11 running (1): test_socket (1 min 5 sec)\n^C\n```\n\n\u003c/details\u003e\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-131605\n* gh-131665\n* gh-132265\n* gh-132398\n* gh-132406\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/picnixz","@type":"Person","name":"picnixz"},"datePublished":"2025-04-04T17:51:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/132097/cpython/issues/132097"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:38666e58-c4df-1d15-c828-cc1a7eecc09c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBD18:DEDFE:1CBE183:262B77E:696AFC66
html-safe-nonce5706a387dfec8259ee10a07b5a552314bcefc4b01f8d547114fcb02cb9ec99c7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDE4OkRFREZFOjFDQkUxODM6MjYyQjc3RTo2OTZBRkM2NiIsInZpc2l0b3JfaWQiOiI3MzQ0MTM1NTk4MjA2ODExMjM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7ba27971945489031c23dd62297b3819ea1c73854f1512d71580e86d68af3d47
hovercard-subject-tagissue:2973037676
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/132097/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5cf718deebab3d673f1b253209b54ca337959e6bb7d3022f369df16a7791e1cf/python/cpython/issues/132097
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5cf718deebab3d673f1b253209b54ca337959e6bb7d3022f369df16a7791e1cf/python/cpython/issues/132097
og:image:altBug report Bug description: We finally managed to fix gh-111178, but this is assuming that Python is compiled with -fsanitize=function. When compiling Python as follows (with clang 18.1.8): ./confi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepicnixz
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
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
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/132097#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F132097
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F132097
Sign up https://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/132097
Reloadhttps://github.com/python/cpython/issues/132097
Reloadhttps://github.com/python/cpython/issues/132097
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/132097
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/132097
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/132097
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/132097
UBSan: runtime undefined behaviours when using -fsanitize=undefined -fno-sanitize-recoverhttps://github.com/python/cpython/issues/132097#top
https://github.com/picnixz
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/picnixz
https://github.com/picnixz
picnixzhttps://github.com/picnixz
on Apr 4, 2025https://github.com/python/cpython/issues/132097#issue-2973037676
gh-111178https://github.com/python/cpython/issues/111178
gh-132097: allow AC to disable fastcall convention to avoid UBSan failures #131605 (comment)https://github.com/python/cpython/pull/131605#issuecomment-2779318764
gh-132097: allow AC to disable fastcall convention to avoid UBSan failures #131605 (comment)https://github.com/python/cpython/pull/131605#issuecomment-2779323572
@vstinnerhttps://github.com/vstinner
gh-111178: Fix function signature in pyexpat.c #131674https://github.com/python/cpython/pull/131674
gh-132097: allow AC to disable fastcall convention to avoid UBSan failures #131605https://github.com/python/cpython/pull/131605
gh-132097: remove unnecessary clinic casts to PyCFunction and others #131665https://github.com/python/cpython/pull/131665
gh-132097: fix runtime UB when calling expat handlers #132265https://github.com/python/cpython/pull/132265
gh-132097: skip tests raising an explicit SIGSEV when UB sanitizer is on #132398https://github.com/python/cpython/pull/132398
gh-132097: use a macro for semantically casting function pointers #132406https://github.com/python/cpython/pull/132406
picnixzhttps://github.com/picnixz
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%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.