Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
10.1(EOL) , 10.2(EOL) , 10.3(EOL) , 10.4(EOL) , 10.5
For some reason, I am only seeing this reported for 10.4 and 10.5, not for earlier versions.
To repeat (I used GCC 9.2.1; clang’s UBSAN would not even bootstrap):
mkdir build; cd build
cmake -DCONC_WITH_{UNITTEST,SSL}=OFF -DWITH_EMBEDDED_SERVER=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug -DPLUGIN_{ARCHIVE,TOKUDB,MROONGA,OQGRAPH,ROCKSDB,CONNECT,SPIDER}=NO -DWITH_SAFEMALLOC=OFF -DWITH_{SSL,ZLIB}=system "$@" -DCMAKE_C{,XX}_FLAGS= '-O2 -march=native' -DWITH_UBSAN=ON ..
make -j$(nproc)
cd mysql- test
nice . /mtr --parallel=$(($(nproc) * 3 / 2)) --force --retry=0 --max- test -fail=0 --big- test
grep 'log.*runtime error' var/* /log/mysqld *err*| cut -d: -f2-| sed -e 's/0x[0-9a-fA-F]*/0xXXX/' | sort | uniq -c| sort -nr
The top of the output looks like this:
10.4 576c96a9385f20cf4b6fe685e079dcf8026c3a24
1740 /mariadb/10.4/sql/log.cc:3812:25: runtime error: member access within address 0xXXX which does not point to an object of type 'xid_count_per_binlog'
1740 /mariadb/10.4/sql/log.cc:3714:41: runtime error: member access within address 0xXXX which does not point to an object of type 'xid_count_per_binlog'
1740 /mariadb/10.4/sql/log.cc:3694:29: runtime error: member access within address 0xXXX which does not point to an object of type 'xid_count_per_binlog'
For some reason, not all such access is flagged. Here is a sample around line 3694:
if (!(new_xid_list_entry = (xid_count_per_binlog *)
my_multi_malloc(MYF(MY_WME),
&entry_mem, sizeof (xid_count_per_binlog),
&name_mem, len,
NULL)))
goto err;
memcpy (name_mem, log_file_name+off, len);
new_xid_list_entry->binlog_name= name_mem;
new_xid_list_entry->binlog_name_len= ( int )len;
new_xid_list_entry->xid_count= 0;
new_xid_list_entry->notify_count= 0;
The problem appears to be that no constructor for xid_count_per_binlog is being called, and thus the vtable will not be initialized. It looks like there is no constructor at all provided for xid_count_per_binlog , even though it is a derived class:
struct xid_count_per_binlog : public ilink {
…
xid_count_per_binlog(); /* Give link error if constructor used. */
};
A definition of MYSQL_BIN_LOG::xid_count_per_binlog::xid_count_per_binlog() is nowhere to be seen. Side note: starting with 10.4, we could use the standard C++11 way to omit default member functions:
xid_count_per_binlog() = delete ;
Here is an attempted patch, which fails to compile due to missing constructor:
diff --git a/sql/log.cc b/sql/log.cc
index 7f632b43cb6..9a5081ab94a 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -3684,13 +3684,13 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
size_t off= dirname_length(log_file_name);
size_t len= strlen(log_file_name) - off;
char *entry_mem, *name_mem;
- if (!(new_xid_list_entry = (xid_count_per_binlog *)
- my_multi_malloc(MYF(MY_WME),
- &entry_mem, sizeof(xid_count_per_binlog),
- &name_mem, len,
- NULL)))
+ if (!my_multi_malloc(MYF(MY_WME),
+ &entry_mem, sizeof(xid_count_per_binlog),
+ &name_mem, len,
+ NULL)))
goto err;
memcpy(name_mem, log_file_name+off, len);
+ new_xid_list_entry = new (entry_mem) xid_count_per_binlog();
new_xid_list_entry->binlog_name= name_mem;
new_xid_list_entry->binlog_name_len= (int)len;
new_xid_list_entry->xid_count= 0;
(Note: my_multi_malloc() would return entry_mem .)
I do not know why I am not seeing any UBSAN errors reported for sql/log.cc in 10.2 or 10.3. It does not look like the code has changed. So, the affectedVersion and fixVersion may need to be revised.
{"report":{"fcp":1537.9000000953674,"ttfb":265.30000019073486,"pageVisibility":"visible","entityId":79990,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"9bad7e68-f635-4ae1-b03d-aa1b036e8858","navigationType":0,"readyForUser":1703.4000000953674,"redirectCount":0,"resourceLoadedEnd":2054.600000143051,"resourceLoadedStart":273.80000019073486,"resourceTiming":[{"duration":613.0999999046326,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":273.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":273.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":886.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":613.4000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":274,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":274,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":887.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":623.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":274.30000019073486,"connectEnd":274.30000019073486,"connectStart":274.30000019073486,"domainLookupEnd":274.30000019073486,"domainLookupStart":274.30000019073486,"fetchStart":274.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":274.30000019073486,"responseEnd":897.4000000953674,"responseStart":897.4000000953674,"secureConnectionStart":274.30000019073486},{"duration":707.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":274.40000009536743,"connectEnd":274.40000009536743,"connectStart":274.40000009536743,"domainLookupEnd":274.40000009536743,"domainLookupStart":274.40000009536743,"fetchStart":274.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":274.40000009536743,"responseEnd":982.1000001430511,"responseStart":982.1000001430511,"secureConnectionStart":274.40000009536743},{"duration":711.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":274.7000000476837,"connectEnd":274.7000000476837,"connectStart":274.7000000476837,"domainLookupEnd":274.7000000476837,"domainLookupStart":274.7000000476837,"fetchStart":274.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":274.7000000476837,"responseEnd":986.1000001430511,"responseStart":986.1000001430511,"secureConnectionStart":274.7000000476837},{"duration":711.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":274.90000009536743,"connectEnd":274.90000009536743,"connectStart":274.90000009536743,"domainLookupEnd":274.90000009536743,"domainLookupStart":274.90000009536743,"fetchStart":274.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":274.90000009536743,"responseEnd":986.6000001430511,"responseStart":986.6000001430511,"secureConnectionStart":274.90000009536743},{"duration":712,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":275.10000014305115,"connectEnd":275.10000014305115,"connectStart":275.10000014305115,"domainLookupEnd":275.10000014305115,"domainLookupStart":275.10000014305115,"fetchStart":275.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":275.10000014305115,"responseEnd":987.1000001430511,"responseStart":987.1000001430511,"secureConnectionStart":275.10000014305115},{"duration":796.2999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":275.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":275.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1071.5,"responseStart":0,"secureConnectionStart":0},{"duration":712.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":275.40000009536743,"connectEnd":275.40000009536743,"connectStart":275.40000009536743,"domainLookupEnd":275.40000009536743,"domainLookupStart":275.40000009536743,"fetchStart":275.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":275.40000009536743,"responseEnd":987.7000000476837,"responseStart":987.7000000476837,"secureConnectionStart":275.40000009536743},{"duration":796.2000000476837,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":275.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":275.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1071.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":712.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":275.80000019073486,"connectEnd":275.80000019073486,"connectStart":275.80000019073486,"domainLookupEnd":275.80000019073486,"domainLookupStart":275.80000019073486,"fetchStart":275.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":275.80000019073486,"responseEnd":988.3000001907349,"responseStart":988.3000001907349,"secureConnectionStart":275.80000019073486},{"duration":1770.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":276.7000000476837,"connectEnd":276.7000000476837,"connectStart":276.7000000476837,"domainLookupEnd":276.7000000476837,"domainLookupStart":276.7000000476837,"fetchStart":276.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":276.7000000476837,"responseEnd":2047.1000001430511,"responseStart":2047.1000001430511,"secureConnectionStart":276.7000000476837},{"duration":1772.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":276.7000000476837,"connectEnd":276.7000000476837,"connectStart":276.7000000476837,"domainLookupEnd":276.7000000476837,"domainLookupStart":276.7000000476837,"fetchStart":276.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":276.7000000476837,"responseEnd":2049.4000000953674,"responseStart":2049.300000190735,"secureConnectionStart":276.7000000476837},{"duration":253.89999985694885,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1087.1000001430511,"connectEnd":1087.1000001430511,"connectStart":1087.1000001430511,"domainLookupEnd":1087.1000001430511,"domainLookupStart":1087.1000001430511,"fetchStart":1087.1000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":1087.1000001430511,"responseEnd":1341,"responseStart":1341,"secureConnectionStart":1087.1000001430511},{"duration":645.7999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1408.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1408.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2054.600000143051,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":75,"responseStart":265,"responseEnd":267,"domLoading":271,"domInteractive":2091,"domContentLoadedEventStart":2091,"domContentLoadedEventEnd":2147,"domComplete":2714,"loadEventStart":2714,"loadEventEnd":2714,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2058.600000143051},{"name":"bigPipe.sidebar-id.end","time":2059.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":2059.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":2061},{"name":"activityTabFullyLoaded","time":2161.9000000953674}],"measures":[],"correlationId":"e11ddfe56a9586","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":111,"dbReadsTimeInMs":21,"dbConnsTimeInMs":30,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}