[SERVER-36844] ASAN build hooks disable stack traces Created: 24/Aug/18  Updated: 29/Oct/23  Resolved: 06/Mar/19

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.1.9

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Spencer Jackson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: HTML File SERVER-36844    
Issue Links:
Problem/Incident
is caused by SERVER-31397 Add 'handle_segv=0' to ASAN_OPTIONS Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Security 2018-10-08, Security 2018-10-22, Security 2018-11-05, Security 2018-11-19, Security 2018-12-03, Security 2018-12-17, Security 2019-01-14, Dev Tools 2019-01-28, Security 2019-02-25, Security 2019-03-11, Dev Tools 2019-02-11
Participants:

 Description   

It would be nice if we could produce stack traces in ASAN builds. I believe due to the way we had to override signal handling for ASAN, it causes things like invariants to skip calling printStackTrace().



 Comments   
Comment by Githook User [ 06/Mar/19 ]

Author:

{'name': 'Spencer Jackson', 'email': 'spencer.jackson@mongodb.com', 'username': 'spencerjackson'}

Message: SERVER-36844 Ensure printStackTrace() produces stacktraces on AUBSAN
Branch: master
https://github.com/mongodb/mongo/commit/ce3d54139390383501f58f66389cdf4fafd14d67

Comment by Spencer Jackson [ 06/Mar/19 ]

ASAN can now integrate better with application defined signal handlers. It's no longer necessary to disable our SIG_ABRT handler when sanitizers are active. It appears that allowing sanitizers to use default handlers for everything but SIG_ABRT allows all failures to produce reasonable looking coredumps and logs. The SIG_ABRT handler is necessary for catching the abort signals raised by LSAN on error.

I propose removing our weird logic to disable SIG_ABRT when running sanitizers, and making the following modification to our sanitizer options in etc/evergreen.yml:

-    san_options: UBSAN_OPTIONS="print_stacktrace=1:handle_abort=0:handle_segv=0:handle_sigbus=0:handle_sigill=0:handle_sigfpe=0" LSAN_OPTIONS="suppressions=etc/lsan.suppressions:report_objects=1" ASAN_OPTIONS=detect_leaks=1:check_initialization_order=true:strict_init_order=true:abort_on_error=1:disable_coredump=0:handle_abort=0:handle_segv=0:handle_sigbus=0:handle_sigill=0:handle_sigfpe=0
+    san_options: UBSAN_OPTIONS="print_stacktrace=1" LSAN_OPTIONS="suppressions=etc/lsan.suppressions:report_objects=1" ASAN_OPTIONS=detect_leaks=1:check_initialization_order=true:strict_init_order=true:abort_on_error=1:disable_coredump=0:handle_abort=1

I've attached a file containing examples of the resulting output.

Generated at Thu Feb 08 04:44:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.