[asterisk-bugs] [JIRA] (ASTERISK-26800) Non-threadsafe function usage

Asterisk Team (JIRA) noreply at issues.asterisk.org
Fri Feb 17 05:45:10 CST 2017


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=235287#comment-235287 ] 

Asterisk Team commented on ASTERISK-26800:
------------------------------------------

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

> Non-threadsafe function usage
> -----------------------------
>
>                 Key: ASTERISK-26800
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26800
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>    Affects Versions: 13.14.0
>            Reporter: Ian Gilmour
>
> Looking through the asterisk codebase I see what (at least at first glance) appear to be use of some non-threadsafe functions. e.g. ctime, strtok, localtime, etc.
> As a check I wrote a bash/cscope-based script (chkthreadsafe) that attempts to identify where non-threadsafe functions are being used.
> It uses the list of potentially non-threadsafe functions from 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_01.
> I notice some of these functions have threadsafe equivalents but that those threadsafe equivalents are themselves now deprecated (e.g. readdir is now favoured again rather than readdir_r according to [http://man7.org/linux/man-pages/man3/readdir.3.html#ATTRIBUTES]). So is there a better list of non-threadsafe functions?
> Using the current list I have the script comes up with a few entries when run against the 13.14.0 branch (see [^chkthreadsafe.output.tgz] ).
> The script is far from perfect. I accept there are a lot more false positives than positives in the output at present.
> False positives come from various sources:
> * variables that have the same name as non-threadsafe functions, 
> * functions that may only be used on a single thread during system startup/shutdown, etc.,
> * and I can see asterisk has it's own threadsafe versions of some of these functions (e.g. ast_inet_ntoa, ast_crypt, etc).
> But that still leaves a few calls that are potentially non-threadsafe. Some of these (e.g. strtok) have threadsafe equivalents already in use elsewhere in the code (strtok_r, etc.).
> I'm just querying if the use of these functions needs further review by those that know the asterisk codebase better?



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list