Type:
New Feature
Priority:
Trivial
Resolution:
Fixed
Affects Version/s:
None
For correctness of AddressSanitizer stack-use-after-return detection one has to annotate swapcontext calls with those when implementing their own fibers.
Since stack-use-after-return is enabled by default in recent clang-15 release (when compiling with -fsanitize=address that is), would be great to see this feature supported by mariadb-connector-c.
{"report":{"fcp":836.2000000476837,"ttfb":184.80000007152557,"pageVisibility":"visible","entityId":116820,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"b4348f1b-6f9e-4620-ada8-e5593e01573c","navigationType":0,"readyForUser":904.7000000476837,"redirectCount":0,"resourceLoadedEnd":514.6000000238419,"resourceLoadedStart":195.60000002384186,"resourceTiming":[{"duration":18.200000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":195.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":195.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":213.80000007152557,"responseStart":0,"secureConnectionStart":0},{"duration":18.100000023841858,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":195.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":195.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":214,"responseStart":0,"secureConnectionStart":0},{"duration":195.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":196.10000002384186,"connectEnd":196.10000002384186,"connectStart":196.10000002384186,"domainLookupEnd":196.10000002384186,"domainLookupStart":196.10000002384186,"fetchStart":196.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":217.39999997615814,"responseEnd":392,"responseStart":239.39999997615814,"secureConnectionStart":196.10000002384186},{"duration":318,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":196.60000002384186,"connectEnd":196.60000002384186,"connectStart":196.60000002384186,"domainLookupEnd":196.60000002384186,"domainLookupStart":196.60000002384186,"fetchStart":196.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":220.20000004768372,"responseEnd":514.6000000238419,"responseStart":263.10000002384186,"secureConnectionStart":196.60000002384186},{"duration":19.899999976158142,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":196.70000004768372,"connectEnd":196.70000004768372,"connectStart":196.70000004768372,"domainLookupEnd":196.70000004768372,"domainLookupStart":196.70000004768372,"fetchStart":196.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":196.70000004768372,"responseEnd":216.60000002384186,"responseStart":216.5,"secureConnectionStart":196.70000004768372},{"duration":70.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":196.80000007152557,"connectEnd":196.80000007152557,"connectStart":196.80000007152557,"domainLookupEnd":196.80000007152557,"domainLookupStart":196.80000007152557,"fetchStart":196.80000007152557,"redirectEnd":0,"redirectStart":0,"requestStart":220.39999997615814,"responseEnd":266.89999997615814,"responseStart":264.60000002384186,"secureConnectionStart":196.80000007152557},{"duration":70.30000007152557,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":196.89999997615814,"connectEnd":196.89999997615814,"connectStart":196.89999997615814,"domainLookupEnd":196.89999997615814,"domainLookupStart":196.89999997615814,"fetchStart":196.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":220.80000007152557,"responseEnd":267.2000000476837,"responseStart":265.39999997615814,"secureConnectionStart":196.89999997615814},{"duration":22.100000023841858,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":197,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":197,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":219.10000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":22.799999952316284,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":197.10000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":197.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":219.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":73.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":197.10000002384186,"connectEnd":197.10000002384186,"connectStart":197.10000002384186,"domainLookupEnd":197.10000002384186,"domainLookupStart":197.10000002384186,"fetchStart":197.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":224.30000007152557,"responseEnd":270.2000000476837,"responseStart":268,"secureConnectionStart":197.10000002384186},{"duration":76.19999992847443,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":197.30000007152557,"connectEnd":197.30000007152557,"connectStart":197.30000007152557,"domainLookupEnd":197.30000007152557,"domainLookupStart":197.30000007152557,"fetchStart":197.30000007152557,"redirectEnd":0,"redirectStart":0,"requestStart":224.70000004768372,"responseEnd":273.5,"responseStart":268.8000000715256,"secureConnectionStart":197.30000007152557},{"duration":310.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":200.89999997615814,"connectEnd":200.89999997615814,"connectStart":200.89999997615814,"domainLookupEnd":200.89999997615814,"domainLookupStart":200.89999997615814,"fetchStart":200.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":254.30000007152557,"responseEnd":511.60000002384186,"responseStart":503.8000000715256,"secureConnectionStart":200.89999997615814},{"duration":311.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":200.89999997615814,"connectEnd":200.89999997615814,"connectStart":200.89999997615814,"domainLookupEnd":200.89999997615814,"domainLookupStart":200.89999997615814,"fetchStart":200.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":281.39999997615814,"responseEnd":512.5,"responseStart":506.7000000476837,"secureConnectionStart":200.89999997615814},{"duration":107.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":545.3999999761581,"connectEnd":545.3999999761581,"connectStart":545.3999999761581,"domainLookupEnd":545.3999999761581,"domainLookupStart":545.3999999761581,"fetchStart":545.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":621,"responseEnd":652.8999999761581,"responseStart":652.3000000715256,"secureConnectionStart":545.3999999761581},{"duration":130.10000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":755.2000000476837,"connectEnd":755.2000000476837,"connectStart":755.2000000476837,"domainLookupEnd":755.2000000476837,"domainLookupStart":755.2000000476837,"fetchStart":755.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":850,"responseEnd":885.3000000715256,"responseStart":884.7000000476837,"secureConnectionStart":755.2000000476837},{"duration":169.39999997615814,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":829.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":829.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":998.6000000238419,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":27,"responseStart":185,"responseEnd":200,"domLoading":189,"domInteractive":957,"domContentLoadedEventStart":957,"domContentLoadedEventEnd":1001,"domComplete":1277,"loadEventStart":1277,"loadEventEnd":1278,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":936.3999999761581},{"name":"bigPipe.sidebar-id.end","time":937.3000000715256},{"name":"bigPipe.activity-panel-pipe-id.start","time":937.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":938.7000000476837},{"name":"activityTabFullyLoaded","time":1018.5}],"measures":[],"correlationId":"906c7aea7f323","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":98,"dbReadsTimeInMs":9,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The address sanitiser API with __sanitizer_start_switch_fiber() and __sanitizer_finish_switch_fiber() is hard to use in the custom assembler used in the efficient co-routine implementation of the non-blocking library. These routines call directly into the target function after switching the stack, there isn't really a good place for a call to __sanitizer_finish_switch_fiber().
Instead, what I will do is to detect if AddressSanitizer is enabled, and in this case switch to one of the fallback system co-routine implementations (boost::context or ucontext), which should have the required instrumentation. This should solve the problem.
The ucontext fallback is used by default, the boost::context can be used instead by running cmake with -DWITH_BOOST_CONTEXT=ON in addition to -DWITH_ASAN=YES.