Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
3.1.12
-
None
-
macOS 11.4 on M1, libmariadb installed with Vcpkg, clang-1205.0.22.9
Description
A simple program like this will cause SIGBUS:
MYSQL mysql;
|
mysql_init(&mysql);
|
auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr);
|
MYSQL *ret = nullptr;
|
mysql_real_connect_start(&ret,
|
&mysql,
|
"127.0.0.1", |
"root", |
"root", |
"mysql", |
3306,
|
nullptr,
|
0);
|
It actually won't produce any stack trace but with single step in IDE, the crash actually produced at swapcontext in my_context_continue.
Might related to MDEV-9112
Update: It's because _XOPEN_SOURCE macro caused stack struct change in macOS. But someone defined _XOPEN_SOURCE in the source file instead of in CMakefile.txt.
Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
A simple program like this will cause SIGBUS:
``` MYSQL mysql; mysql_init(&mysql); auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr); MYSQL *ret = nullptr; mysql_real_connect_start(&ret, &mysql, "127.0.0.1", "root", "root", "mysql", 3306, nullptr, 0); ``` It actually won't produce any stack trace but with single step in IDE, the crash actually produced at `swapcontext` in `my_context_continue`. Might related to https://jira.mariadb.org/browse/MDEV-9112 |
A simple program like this will cause SIGBUS:
``` MYSQL mysql; mysql_init(&mysql); auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr); MYSQL *ret = nullptr; mysql_real_connect_start(&ret, &mysql, "127.0.0.1", "root", "root", "mysql", 3306, nullptr, 0); ``` It actually won't produce any stack trace but with single step in IDE, the crash actually produced at `swapcontext` in `my_context_continue`. Might related to https://jira.mariadb.org/browse/MDEV-9112 Update: It's because `_XOPEN_SOURCE` macro caused stack struct change in macOS. But someone defined `_XOPEN_SOURCE` in the source file instead of in CMakefile.txt. Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link |
Description |
A simple program like this will cause SIGBUS:
``` MYSQL mysql; mysql_init(&mysql); auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr); MYSQL *ret = nullptr; mysql_real_connect_start(&ret, &mysql, "127.0.0.1", "root", "root", "mysql", 3306, nullptr, 0); ``` It actually won't produce any stack trace but with single step in IDE, the crash actually produced at `swapcontext` in `my_context_continue`. Might related to https://jira.mariadb.org/browse/MDEV-9112 Update: It's because `_XOPEN_SOURCE` macro caused stack struct change in macOS. But someone defined `_XOPEN_SOURCE` in the source file instead of in CMakefile.txt. Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link |
A simple program like this will cause SIGBUS:
{code:c} MYSQL mysql; mysql_init(&mysql); auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr); MYSQL *ret = nullptr; mysql_real_connect_start(&ret, &mysql, "127.0.0.1", "root", "root", "mysql", 3306, nullptr, 0); {code} It actually won't produce any stack trace but with single step in IDE, the crash actually produced at {swapcontext} in {my_context_continue}. Might related to https://jira.mariadb.org/browse/MDEV-9112 Update: It's because {_XOPEN_SOURCE} macro caused stack struct change in macOS. But someone defined {_XOPEN_SOURCE} in the source file instead of in CMakefile.txt. Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link |
Description |
A simple program like this will cause SIGBUS:
{code:c} MYSQL mysql; mysql_init(&mysql); auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr); MYSQL *ret = nullptr; mysql_real_connect_start(&ret, &mysql, "127.0.0.1", "root", "root", "mysql", 3306, nullptr, 0); {code} It actually won't produce any stack trace but with single step in IDE, the crash actually produced at {swapcontext} in {my_context_continue}. Might related to https://jira.mariadb.org/browse/MDEV-9112 Update: It's because {_XOPEN_SOURCE} macro caused stack struct change in macOS. But someone defined {_XOPEN_SOURCE} in the source file instead of in CMakefile.txt. Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link |
A simple program like this will cause SIGBUS:
{code:c} MYSQL mysql; mysql_init(&mysql); auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr); MYSQL *ret = nullptr; mysql_real_connect_start(&ret, &mysql, "127.0.0.1", "root", "root", "mysql", 3306, nullptr, 0); {code} It actually won't produce any stack trace but with single step in IDE, the crash actually produced at {{swapcontext}} in {{my_context_continue}}. Might related to https://jira.mariadb.org/browse/MDEV-9112 Update: It's because {{_XOPEN_SOURCE}} macro caused stack struct change in macOS. But someone defined {{_XOPEN_SOURCE}} in the source file instead of in CMakefile.txt. Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link |
Description |
A simple program like this will cause SIGBUS:
{code:c} MYSQL mysql; mysql_init(&mysql); auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr); MYSQL *ret = nullptr; mysql_real_connect_start(&ret, &mysql, "127.0.0.1", "root", "root", "mysql", 3306, nullptr, 0); {code} It actually won't produce any stack trace but with single step in IDE, the crash actually produced at {{swapcontext}} in {{my_context_continue}}. Might related to https://jira.mariadb.org/browse/MDEV-9112 Update: It's because {{_XOPEN_SOURCE}} macro caused stack struct change in macOS. But someone defined {{_XOPEN_SOURCE}} in the source file instead of in CMakefile.txt. Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link |
A simple program like this will cause SIGBUS:
{code:c} MYSQL mysql; mysql_init(&mysql); auto r = mysql_options(&mysql, MYSQL_OPT_NONBLOCK, nullptr); MYSQL *ret = nullptr; mysql_real_connect_start(&ret, &mysql, "127.0.0.1", "root", "root", "mysql", 3306, nullptr, 0); {code} It actually won't produce any stack trace but with single step in IDE, the crash actually produced at {{swapcontext}} in {{my_context_continue}}. Might related to Update: It's because {{_XOPEN_SOURCE}} macro caused stack struct change in macOS. But someone defined {{_XOPEN_SOURCE}} in the source file instead of in CMakefile.txt. Ref: https://stackoverflow.com/questions/23852522/swapcontext-segfaults-when-swapping-to-a-ucontext-ts-uc-link |
Priority | Major [ 3 ] | Critical [ 2 ] |
Fix Version/s | 3.1.14 [ 25817 ] |
Fix Version/s | 3.1 [ 23223 ] | |
Fix Version/s | 3.1.14 [ 25817 ] |
Workflow | MariaDB connectors [ 122482 ] | MariaDB v4 [ 160881 ] |
Fix Version/s | 3.1.17 [ 27520 ] | |
Fix Version/s | 3.1 [ 23223 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |