Project

General

Profile

Actions

Bug #55304

closed

libcephsqlite: crash when compiled with gcc12 cause of regex treating '-' as a range operator

Added by Ganesh Maharaj Mahalingam about 2 years ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
quincy,pacific
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):

8ce65856856059d1f702c1e2a13a048ab53ec669dbd74667bc5914069de394cc
c378729b55506b4208e12e7c1fa4fc14e459efd2f9c2c9e59518f9e3675f5b12


Description

When compiled with gcc12 (fedora36 & clearlinux) and using vstart.sh to test ceph, ceph-mgr would crash with the below error.

ceph version 17.0.0-11503-g4ba019b10bd (4ba019b10bd732774738ef26b4e32b11ca0fc3e7) quincy (dev)
1: /lib64/libc.so.6(0x42ac0) [0x7f72c5b91ac0]
2: /lib64/libc.so.6(+0x92e3c) [0x7f72c5be1e3c]
3: raise()
4: abort()
5: /lib64/libstdc
+.so.6(0xa2b77) [0x7f72c5ef1b77]
6: /lib64/libstdc
+.so.6(0xae45c) [0x7f72c5efd45c]
7: /lib64/libstdc
+.so.6(0xae4c7) [0x7f72c5efd4c7]
8: /lib64/libstdc
+.so.6(+0xae728) [0x7f72c5efd728]
9: (std::__throw_regex_error(std::regex_constants::error_type, char const*)+0x48) [0x55b6edfc60ac]
10: (bool std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_expression_term<false, false>(std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_BracketState&, std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>&)+0x52d) [0x5
5b6ee01fddd]
11: (void std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_insert_bracket_matcher<false, false>(bool)+0xc6) [0x55b6ee01ff36]
12: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_bracket_expression()+0x45) [0x55b6ee022b05]
13: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative()+0x118) [0x55b6ee023548]
14: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_disjunction()+0x2d) [0x55b6ee0236bd]
15: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_atom()+0x4d1) [0x55b6ee023041]
16: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative()+0x118) [0x55b6ee023548]
17: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative()+0x71) [0x55b6ee0234a1]
18: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative()+0x71) [0x55b6ee0234a1]
19: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative()+0x71) [0x55b6ee0234a1]
20: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative()+0x71) [0x55b6ee0234a1]
21: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_disjunction()+0x2d) [0x55b6ee0236bd]
22: (std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_Compiler(char const*, char const*, std::locale const&, std::regex_constants::syntax_option_type)+0x256) [0x55b6ee023ac6]
23: /data/workspace/ceph/ceph/build/lib/libcephsqlite.so(+0x162ea) [0x7f72c770e2ea]
24: /data/workspace/ceph/ceph/build/lib/libcephsqlite.so(+0x1a6c7) [0x7f72c77126c7]
25: /lib64/libsqlite3.so.0(+0x2e6e5) [0x7f72c75d86e5]
26: /lib64/libsqlite3.so.0(+0xadeb7) [0x7f72c7657eb7]
27: /usr/lib64/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so(+0x946c) [0x7f72bb04846c]
28: /lib64/libpython3.10.so.1.0(+0x119383) [0x7f72c7375383]
29: _PyObject_Call()
30: /usr/lib64/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so(+0x92c3) [0x7f72bb0482c3]
31: /lib64/libpython3.10.so.1.0(+0x11d101) [0x7f72c7379101]
NOTE: a copy of the executable, or `objdump -rdS <executable>` is needed to interpret this

backtrace on the crash yielded this.

Thread 37 "devicehealth" hit Catchpoint 1 (exception thrown), 0x00007f0f9c9b36f1 in _cxxabiv1::_cxa_throw (obj=0x5597c4783f20, tinfo=0x7f0f9cb2c360 <typeinfo for std::regex_error>, dest=0x7f0f9c9dfff0 <std::regex_error::~regex_error()>) at ../../../../libstdc++-v3/libsupc
+/eh_throw.cc:81
81 PROBE2 (throw, obj, tinfo);
(gdb) bt
#0 0x00007f0f9c9b36f1 in _cxxabiv1::_cxa_throw (obj=0x5597c4783f20, tinfo=0x7f0f9cb2c360 <typeinfo for std::regex_error>,
dest=0x7f0f9c9dfff0 <std::regex_error::~regex_error()>) at ../../../../libstdc
+-v3/libsupc++/eh_throw.cc:81
#1 0x00005597bc3b20ac in std::__throw_regex_error (_ecode=_ecode@entry=std::regex_constants::_S_error_range,
_what=_what@entry=0x5597bc6b3d30 "Invalid start of '[x-x]' range in regular expression")
at /usr/include/c++/12/bits/regex_error.h:169
#2 0x00005597bc40bddd in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_expression_term<false, false> (
this=this@entry=0x7f0f775011d0, _last_char=..., __matcher=...) at /usr/include/c++/12/bits/regex_compiler.tcc:497
#3 0x00005597bc40bf36 in std::
_detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_insert_bracket_matcher<false, false> (
this=this@entry=0x7f0f775011d0, _neg=<optimized out>) at /usr/include/c++/12/bits/regex_compiler.tcc:419
#4 0x00005597bc40eb05 in std::
_detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_bracket_expression (
this=this@entry=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:350
#5 0x00005597bc40ebff in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_atom (this=this@entry=0x7f0f775011d0)
at /usr/include/c++/12/bits/regex_compiler.tcc:336
#6 0x00005597bc40f548 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_term (this=0x7f0f775011d0)
at /usr/include/c++/12/bits/regex_compiler.tcc:133
#7 std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0)
at /usr/include/c++/12/bits/regex_compiler.tcc:115
#8 0x00005597bc40f6bd in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_disjunction (
this=this@entry=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:91
#9 0x00005597bc40f041 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_atom (this=this@entry=0x7f0f775011d0)
at /usr/include/c++/12/bits/regex_compiler.tcc:329
#10 0x00005597bc40f548 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_term (this=0x7f0f775011d0)
at /usr/include/c++/12/bits/regex_compiler.tcc:133
#11 std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0)
at /usr/include/c++/12/bits/regex_compiler.tcc:115
#12 0x00005597bc40f4a1 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:118
#13 std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0)
at /usr/include/c++/12/bits/regex_compiler.tcc:112
--Type <RET> for more, q to quit, c to continue without paging--
#14 0x00005597bc40f4a1 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:118
#15 std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:112
#16 0x00005597bc40f4a1 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:118
#17 std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:112
#18 0x00005597bc40f4a1 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:118
#19 std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:112
#20 0x00005597bc40f6bd in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_disjunction (this=this@entry=0x7f0f775011d0) at /usr/include/c++/12/bits/regex_compiler.tcc:91
#21 0x00005597bc40fac6 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_Compiler (this=0x7f0f775011d0, _b=<optimized out>, __e=<optimized out>, __loc=..., __flags=<optimized out>) at /usr/include/c++/12/bits/regex_compiler.tcc:76
#22 0x00007f0f9e1c42ea in std::
_cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::_M_compile (_f=std::regex_constants::_S_ECMAScript, __last=0x7f0f9e1f4118 "", __first=0x7f0f9e1f40e0 "^/*(\\*[[:digit:]]+):([[:alnum:]-.]*)/([[:alnum:]-._]+)$",
this=0x7f0f9e203e20 <parsepath(std::basic_string_view<char, std::char_traits<char> >, cephsqlite_fileloc*)::re1>) at /usr/include/c++/12/bits/regex.h:786
#23 std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::basic_regex (_f=std::regex_constants::_S_ECMAScript, __p=0x7f0f9e1f40e0 "^/*(\\*[[:digit:]]+):([[:alnum:]-.]*)/([[:alnum:]-._]+)$",
this=0x7f0f9e203e20 <parsepath(std::basic_string_view<char, std::char_traits<char> >, cephsqlite_fileloc*)::re1>) at /usr/include/c++/12/bits/regex.h:453
#24 parsepath (fileloc=0x7f0f77501460, Python Exception <class 'gdb.error'>: value has been optimized out
path=) at /data/workspace/ceph/ceph/src/libcephsqlite.cc:384
#25 0x00007f0f9e1c86c7 in FullPathname (vfs=0x5597c4879ad0, ipath=0x5597c48a394c "/.mgr:devicehealth/main.db", opathlen=4097, opath=0x5597c5232008 "") at /data/workspace/ceph/ceph/src/libcephsqlite.cc:669

I created a small test.cc file with contents as below.

#include <regex>

int main() {
static const std::regex re1{"^/*(\\*[[:digit:]]+):([[:alnum:]-_.]*)/([[:alnum:]\\-._]+)$"};
}

My test results are as such.

ganeshma@ganeshma-lab2 <> temp % g++-10 -o test test.cc && ./test
ganeshma@ganeshma-lab2 <> temp % g++ -o test test.cc && ./test
terminate called after throwing an instance of 'std::regex_error'
what(): Invalid start of '[x-x]' range in regular expression
Aborted (core dumped)


Related issues 7 (0 open7 closed)

Related to RADOS - Tasks #56952: Set mgr_pool to true for a handful of tests in the rados qa suiteClosedLaura Flores

Actions
Has duplicate cephsqlite - Bug #55696: vstart hangs on when creating volumeDuplicate

Actions
Has duplicate RADOS - Bug #56700: MGR pod on CLBO on rook deploymentDuplicate

Actions
Has duplicate mgr - Bug #56745: unrecognized option ssl_server_port appears to cause failure of MGRDuplicate

Actions
Has duplicate mgr - Bug #56726: Ceph Mgr crash due to missing OSD serviceDuplicate

Actions
Copied to cephsqlite - Backport #56701: pacific: libcephsqlite: crash when compiled with gcc12 cause of regex treating '-' as a range operatorResolvedVikhyat UmraoActions
Copied to cephsqlite - Backport #56702: quincy: libcephsqlite: crash when compiled with gcc12 cause of regex treating '-' as a range operatorResolvedVikhyat UmraoActions
Actions

Also available in: Atom PDF