[SERVER-5553] don't call async signal unsafe functions in signal handlers Created: 09/Apr/12  Updated: 11/Jul/16  Resolved: 07/Apr/14

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

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-13429 Replace writes to cout/cerr or stdout... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

There is already a comment about this for rawOut. Other signal handling code should be audited as well.

    /* note: can't use malloc herein - may be in signal handler.
             logLockless() likely does not comply and should still be fixed todo
             likewise class string?
    */
    void rawOut( const string &s ) {



 Comments   
Comment by Githook User [ 07/Apr/14 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-5553 Use malloc-free ostream in signal handlers
Branch: master
https://github.com/mongodb/mongo/commit/90e2cf22bfe2db9ad8430f4b0aeb6024c709613f

Comment by Githook User [ 03/Apr/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-5553 Eliminate malloc from printStacktrace(std::ostream&).

This also opens the exciting possibility of displaying the base address
of the file containing the address, which would let us dump stacks when
ASLR is in use. However, this implementation preserves the format used
in the Linux backtrace_symbols() implementation.
Branch: master
https://github.com/mongodb/mongo/commit/881b2ee9ff3b4cb1dfe1d01957e717d8497cf8cf

Comment by Githook User [ 03/Apr/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-5553 Remove a heap allocation from the log event encoder.

The goal is to eventually have a logging path that is truly safe to
use in a signal handler. This patch advances the cause by removing
the heap allocation caused by returning a string in the date formatters.
Branch: master
https://github.com/mongodb/mongo/commit/962b4ab67f58e80c2ee7d82f9415017d8fc17056

Comment by Aaron Staple [ 09/Apr/12 ]

<https://www.securecoding.cert.org/confluence/display/seccode/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers>

Generated at Thu Feb 08 03:09:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.