[asterisk-bugs] [JIRA] (ASTERISK-26800) Non-threadsafe function usage
Joshua Colp (JIRA)
noreply at issues.asterisk.org
Mon Feb 20 06:21:12 CST 2017
[ https://issues.asterisk.org/jira/browse/ASTERISK-26800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joshua Colp updated ASTERISK-26800:
-----------------------------------
Severity: Minor (was: Major)
> Non-threadsafe function usage
> -----------------------------
>
> Key: ASTERISK-26800
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-26800
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Core/General
> Affects Versions: 13.14.0
> Reporter: Ian Gilmour
> Severity: Minor
> Attachments: chkthreadsafe.output.tgz
>
>
> 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 script 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