[SERVER-62972] Local UBSAN runtime error with --dbg=off Created: 25/Jan/22  Updated: 29/Oct/23  Resolved: 19/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Katherine Wu (Inactive) Assignee: Ryan Egesdahl (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Platform 2022-02-21, Dev Platform 2022-03-07, Dev Platform 2022-03-21
Participants:

 Description   

Compiling with UBSAN and --dbg=off results in the following runtime error:

[j0] src/third_party/unwind/dist/src/x86_64/Ginit.c:334:14: runtime error: load of misaligned address 0x7f102889a0ca for type 'unw_word_t' (aka 'unsigned long'), which requires 8 byte alignment
[j0] 0x7f102889a0ca: note: pointer points here
[j0]  66 f5  00 00 48 8d 15 cf f8 00  00 4c 89 ec 41 ff e4 66  0f 1f 84 00 00 00 00 00  83 47 04 01 c3 90
[j0]               ^

Full build invocation:

./buildscripts/scons.py         --modules= --dbg=off --opt=on --link-model=dynamic --sanitize=undefined         --variables-files=./etc/scons/mongodbtoolchain_stable_clang.vars         --ninja generate-ninja

When building with --dbg=on the runtime error disappears.



 Comments   
Comment by Githook User [ 18/Mar/22 ]

Author:

{'name': 'Ryan Egesdahl', 'email': 'ryan.egesdahl@mongodb.com', 'username': 'deriamis'}

Message: SERVER-62972 Add libunwind access_mem() to UBSAN denylist
Branch: master
https://github.com/mongodb/mongo/commit/e8adc423e438910d1e8c8b53343d4487d7ccf620

Comment by Ryan Egesdahl (Inactive) [ 09/Feb/22 ]

katherine.wu Incidentally, I created SERVER-63400 to address a probable reason you had --modules= along with --link-model=dynamic in your invocation. There was a bug in the Enterprise module that was causing build failures whenever it was built with both --link-model=dynamic and CCFLAGS="-gsplit-dwarf" (which I noticed you were using). I noticed it when I tried your build but forgot to disable the Enterprise module. Once SERVER-63400 merges, you should not need to disable the Enterprise module in dynamic builds.

Comment by Katherine Wu (Inactive) [ 25/Jan/22 ]

Full stack trace:

[j0] src/third_party/unwind/dist/src/x86_64/Ginit.c:334:14: runtime error: load of misaligned address 0x7fabeb9d70ca for type 'unw_word_t' (aka 'unsigned long'), which requires 8 byte alignment
[j0] 0x7fabeb9d70ca: note: pointer points here
[j0]  66 f5  00 00 48 8d 15 cf f8 00  00 4c 89 ec 41 ff e4 66  0f 1f 84 00 00 00 00 00  83 47 04 01 c3 90
[j0]               ^
[j0]     #0 0x7fabe8807bc1 in access_mem /home/katwu/mongodb/mongo/src/third_party/unwind/dist/src/x86_64/Ginit.c:334:14
[j0]     #1 0x7fabe8809ada in is_plt_entry /home/katwu/mongodb/mongo/src/third_party/unwind/dist/src/x86_64/Gstep.c:43:14
[j0]     #2 0x7fabe8809ada in _ULx86_64_step /home/katwu/mongodb/mongo/src/third_party/unwind/dist/src/x86_64/Gstep.c:126
[j0]     #3 0x7fabeb6c958c in GetStackTrace_libunwind(void**, int, int) /home/katwu/mongodb/mongo/src/third_party/gperftools/dist/src/stacktrace_libunwind-inl.h:138:9
[j0]     #4 0x7fabeb6c9819 in maybe_convert_libunwind_to_generic_fp() /home/katwu/mongodb/mongo/src/third_party/gperftools/dist/src/stacktrace.cc:353:12
[j0]     #5 0x7fabeb6cada6 in init_default_stack_impl() /home/katwu/mongodb/mongo/src/third_party/gperftools/dist/src/stacktrace.cc:385:3
[j0]     #6 0x7fabeb6b41fb in (anonymous namespace)::google_init_module_stacktrace_init_default_stack_impl() /home/katwu/mongodb/mongo/src/third_party/gperftools/dist/src/stacktrace.cc:396:1
[j0]     #7 0x7fabeb6b41fb in GoogleInitializer::GoogleInitializer(char const*, void (*)(), void (*)()) /home/katwu/mongodb/mongo/src/third_party/gperftools/dist/src/base/googleinit.h:46
[j0]     #8 0x7fabeb6b41fb in __cxx_global_var_init /home/katwu/mongodb/mongo/src/third_party/gperftools/dist/src/stacktrace.cc:396
[j0]     #9 0x7fabeb6b41fb in _GLOBAL__sub_I_stacktrace.cc /home/katwu/mongodb/mongo/src/third_party/gperftools/dist/src/stacktrace.cc
[j0] Waiting to connect to mongod on port 20000.
[j0]     #10 0x7fabeb9e6732 in call_init /build/glibc-OTsEL5/glibc-2.27/elf/dl-init.c:72
[j0]     #11 0x7fabeb9e6732 in _dl_init /build/glibc-OTsEL5/glibc-2.27/elf/dl-init.c:119
[j0]     #12 0x7fabeb9d70c9  (/lib64/ld-linux-x86-64.so.2+0x10c9)

Generated at Thu Feb 08 05:56:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.