[MDEV-26541] Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds Created: 2021-09-05 Updated: 2023-07-04 Resolved: 2023-01-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Spider |
| Affects Version/s: | 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11 |
| Fix Version/s: | 10.11.2, 11.0.1, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Roel Van de Paar | Assignee: | Yuchen Pei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | UBSAN, affects-tests, not-10.3 | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
This bug blocks ASAN/UBSAN testing of the Spider Engine. Steps to reproduce:
The file is there:
Present in 10.5 and 10.7. Likely same in older versions also. |
| Comments |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-09-07 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I confirm that the bug is reproducible on 10.4 and10.5 but not on 10.3. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-09-07 ] | ||||||||||||||||||||||||||||||||||||||||||
|
This seems to be a known issue because BUILD/compile-pentium64-ubsan says as the following:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-09-09 ] | ||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-09-09 ] | ||||||||||||||||||||||||||||||||||||||||||
|
nayuta-yanagisawa That is interesting. Standard MariaDB builds allow both flags/building with both enabled. I will check on my end to confirm your findings. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-09-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
nayuta-yanagisawa Confirming that the workaround works. I also tested the reverse: -DWITH_UBSAN=ON only (without any ASAN options), and the issue on that one is the same:
The issue is thus limited to UBSAN only. Updated title. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-09-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
So thinking about this, perhaps an #include is missing or similar? Specifically partitioning (given _ZTI12ha_partition) in Spider (ha_spider)? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-09-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Roel Thank you for your confirmation and insight. I'm still investigating why WITH_UNSAN does not work. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2022-12-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I increased prio as the issue blocks a fair bit of Spider testing (UBSAN continues to fail working):
serg Do you have any ideas/insights on perhaps missing lib/header? Thank you | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-12-19 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I believe that this has been started from https://github.com/MariaDB/server/commit/2400e06946bb5856684fd27ee86f610267bf4dc3. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-12-19 ] | ||||||||||||||||||||||||||||||||||||||||||
|
This is likely caused by the mixture of -fno-rtti and -frtti binaries. In fact, the following patch fixes the problem.
I've not checked the detail, but WITH_UBSAN might magically disable RTTI (??). | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2022-12-19 ] | ||||||||||||||||||||||||||||||||||||||||||
|
nayuta-yanagisawa Thank you | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Yuchen Pei [ 2022-12-21 ] | ||||||||||||||||||||||||||||||||||||||||||
|
mtr testcase:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Yuchen Pei [ 2022-12-22 ] | ||||||||||||||||||||||||||||||||||||||||||
|
It seems this issue cannot be directly analysed by a debugger, as the traces are identical with or without ubsan. The server binary is built with rtti, which can be verified using the method mentioned in <https://stackoverflow.com/questions/22150806/how-can-i-check-if-a-library-was-compiled-with-fno-rtti>. Without -fno-rtti for spider, we get
With -fno-rtti for spider, as with the stackoverflow post, there's no typeinfo for ha_partition, or anything for ha_partition:
Furthermore, with the -fno-rtti and ubsan build for spider, we get test failures which
These seem to be errors produced by ubsan, cf <https://jira.mariadb.org/browse/MDEV-20923>. If we use Nayuta's patch, we will need to fix these errors. OTOH I wonder whether the tests will pass if we can find a fix for this issue without disabling rtti. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-01-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The following change allows the _ZTI12ha_partition to be exported as a global symbol in mariadbd:
The proper way to fix this would be to apply something like the
tweak in sql/CMakeLists.txt to other files. With that sorted out, several Spider tests would fail due to one error:
A number of tests still fail with that patch due to other nonnull violations in storage/spider/spd_trx.cc:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Yuchen Pei [ 2023-01-12 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Thanks marko very much for unblocking this ticket. holyfoot: I've created a patch at https://github.com/MariaDB/server/commit/b4d5a4f46c2, PTAL thanks. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Yuchen Pei [ 2023-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
marko holyfoot updated patch incorporating marko's comment at https://github.com/MariaDB/server/commit/af2de138303 | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexey Botchkov [ 2023-01-19 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Ok to push. |