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.
Marko Mäkelä
made changes -
2019-10-30 05:26
Field
Original Value
New Value
Status
Open
[ 1
]
Confirmed
[ 10101
]
Sujatha Sivakumar (Inactive)
made changes -
2019-11-12 12:56
Assignee
Sujatha Sivakumar
[ sujatha.sivakumar
]
Andrei Elkin
[ elkin
]
Status
In Progress
[ 3
]
In Review
[ 10002
]
Sujatha Sivakumar (Inactive)
made changes -
2019-11-12 12:57
Affects Version/s
10.1
[ 16100
]
Affects Version/s
10.2
[ 14601
]
Affects Version/s
10.3
[ 22126
]
Andrei Elkin
made changes -
2019-11-27 17:29
Assignee
Andrei Elkin
[ elkin
]
Sujatha Sivakumar
[ sujatha.sivakumar
]
Status
In Review
[ 10002
]
Stalled
[ 10000
]
Marko Mäkelä
made changes -
2020-01-23 16:53
Link
This issue blocks MENT-314
[ MENT-314
]
Marko Mäkelä
made changes -
2020-01-23 17:15
Fix Version/s
10.1
[ 16100
]
Fix Version/s
10.2
[ 14601
]
Fix Version/s
10.3
[ 22126
]
Sujatha Sivakumar (Inactive)
made changes -
2020-01-29 12:19
Fix Version/s
10.1.45
[ 23913
]
Fix Version/s
10.2.32
[ 24221
]
Fix Version/s
10.3.23
[ 24222
]
Fix Version/s
10.4.13
[ 24223
]
Fix Version/s
10.2
[ 14601
]
Fix Version/s
10.1
[ 16100
]
Fix Version/s
10.3
[ 22126
]
Fix Version/s
10.4
[ 22408
]
Fix Version/s
10.5
[ 23123
]
Resolution
Fixed
[ 1
]
Status
Stalled
[ 10000
]
Closed
[ 6
]
Sergei Golubchik
made changes -
2021-12-06 21:50
Workflow
MariaDB v3
[ 100690
]
MariaDB v4
[ 156915
]
{"report":{"fcp":1274.6999998092651,"ttfb":364.89999985694885,"pageVisibility":"visible","entityId":79990,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"571535b4-5605-4af6-92bd-285c2b866b81","navigationType":0,"readyForUser":1389.8999998569489,"redirectCount":0,"resourceLoadedEnd":1805.7999999523163,"resourceLoadedStart":371,"resourceTiming":[{"duration":306.7999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":371,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":371,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":677.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":306.7000000476837,"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":371.39999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":371.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":678.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":324.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":371.5,"connectEnd":371.5,"connectStart":371.5,"domainLookupEnd":371.5,"domainLookupStart":371.5,"fetchStart":371.5,"redirectEnd":0,"redirectStart":0,"requestStart":371.5,"responseEnd":696,"responseStart":696,"secureConnectionStart":371.5},{"duration":390.89999985694885,"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":371.7999999523163,"connectEnd":371.7999999523163,"connectStart":371.7999999523163,"domainLookupEnd":371.7999999523163,"domainLookupStart":371.7999999523163,"fetchStart":371.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":371.7999999523163,"responseEnd":762.6999998092651,"responseStart":762.6999998092651,"secureConnectionStart":371.7999999523163},{"duration":425.89999985694885,"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":372,"connectEnd":372,"connectStart":372,"domainLookupEnd":372,"domainLookupStart":372,"fetchStart":372,"redirectEnd":0,"redirectStart":0,"requestStart":372,"responseEnd":797.8999998569489,"responseStart":797.8999998569489,"secureConnectionStart":372},{"duration":426.2000000476837,"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":372.19999980926514,"connectEnd":372.19999980926514,"connectStart":372.19999980926514,"domainLookupEnd":372.19999980926514,"domainLookupStart":372.19999980926514,"fetchStart":372.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":372.19999980926514,"responseEnd":798.3999998569489,"responseStart":798.3999998569489,"secureConnectionStart":372.19999980926514},{"duration":426.2999999523163,"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":372.39999985694885,"connectEnd":372.39999985694885,"connectStart":372.39999985694885,"domainLookupEnd":372.39999985694885,"domainLookupStart":372.39999985694885,"fetchStart":372.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":372.39999985694885,"responseEnd":798.6999998092651,"responseStart":798.6999998092651,"secureConnectionStart":372.39999985694885},{"duration":536,"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":372.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":372.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":908.5,"responseStart":0,"secureConnectionStart":0},{"duration":426.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":372.7999999523163,"connectEnd":372.7999999523163,"connectStart":372.7999999523163,"domainLookupEnd":372.7999999523163,"domainLookupStart":372.7999999523163,"fetchStart":372.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":372.7999999523163,"responseEnd":799.1999998092651,"responseStart":799.1999998092651,"secureConnectionStart":372.7999999523163},{"duration":535.7000000476837,"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":372.89999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":372.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":908.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":426.7999999523163,"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":373,"connectEnd":373,"connectStart":373,"domainLookupEnd":373,"domainLookupStart":373,"fetchStart":373,"redirectEnd":0,"redirectStart":0,"requestStart":373,"responseEnd":799.7999999523163,"responseStart":799.7999999523163,"secureConnectionStart":373},{"duration":1399.8999998569489,"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":374,"connectEnd":374,"connectStart":374,"domainLookupEnd":374,"domainLookupStart":374,"fetchStart":374,"redirectEnd":0,"redirectStart":0,"requestStart":374,"responseEnd":1773.8999998569489,"responseStart":1773.8999998569489,"secureConnectionStart":374},{"duration":1395.7999999523163,"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":378.5,"connectEnd":378.5,"connectStart":378.5,"domainLookupEnd":378.5,"domainLookupStart":378.5,"fetchStart":378.5,"redirectEnd":0,"redirectStart":0,"requestStart":378.5,"responseEnd":1774.2999999523163,"responseStart":1774.2999999523163,"secureConnectionStart":378.5},{"duration":247.39999985694885,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":939.2999999523163,"connectEnd":939.2999999523163,"connectStart":939.2999999523163,"domainLookupEnd":939.2999999523163,"domainLookupStart":939.2999999523163,"fetchStart":939.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":939.2999999523163,"responseEnd":1186.6999998092651,"responseStart":1186.6999998092651,"secureConnectionStart":939.2999999523163},{"duration":592.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1213.5999999046326,"connectEnd":1213.5999999046326,"connectStart":1213.5999999046326,"domainLookupEnd":1213.5999999046326,"domainLookupStart":1213.5999999046326,"fetchStart":1213.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":1213.5999999046326,"responseEnd":1805.7999999523163,"responseStart":1805.7999999523163,"secureConnectionStart":1213.5999999046326},{"duration":609.2000000476837,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1265.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1265.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1874.8999998569489,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":122,"responseStart":365,"responseEnd":369,"domLoading":368,"domInteractive":1817,"domContentLoadedEventStart":1817,"domContentLoadedEventEnd":1870,"domComplete":2317,"loadEventStart":2317,"loadEventEnd":2318,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1786.7999999523163},{"name":"bigPipe.sidebar-id.end","time":1787.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1787.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":1792.1999998092651},{"name":"activityTabFullyLoaded","time":1890.2999999523163}],"measures":[],"correlationId":"ad2c8eb8f6bab7","effectiveType":"4g","downlink":9.9,"rtt":0,"serverDuration":174,"dbReadsTimeInMs":44,"dbConnsTimeInMs":57,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}