[Home]

Summary:ASTERISK-29713: GCC 11.2: two stringop-overread
Reporter:Alexander Traud (traud)Labels:
Date Opened:2021-10-29 03:30:56Date Closed:2021-11-01 09:16:07
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/Channels Core/Logging
Versions:16.21.1 18.7.1 Frequency of
Occurrence
Related
Issues:
is duplicated byASTERISK-29725 COMPILE_DOUBLE exposes issues in logger.c and channel.c with GCC 11.2
Environment:Ubuntu 21.10 with GCC 11.2Attachments:
Description:The following was seen on a (minimal) installation of Ubuntu 21.10. Asterisk was made via:
{code}
sudo apt update
sudo ./contrib/scripts/install_prereq install
./configure
make
{code}Two modules gave a warning (which turn into errors in the developer mode):{code}
  [CC] logger.c -> logger.o
In file included from include/asterisk/lock.h:663,
                from include/asterisk/utils.h:32,
                from include/asterisk/module.h:39,
                from logger.c:52:
In function ‘ast_threadstorage_set_ptr’,
   inlined from ‘ast_log_safe’ at logger.c:2216:6:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
 258 |         return pthread_setspecific(ts->key, ptr);
     |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
  52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
     |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                from include/asterisk/utils.h:32,
                from include/asterisk/module.h:39,
                from logger.c:52:
include/asterisk/threadstorage.h: In function ‘ast_log_safe’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1308 | extern int pthread_setspecific (pthread_key_t __key,
     |            ^~~~~~~~~~~~~~~~~~~
{code}{code}
  [CC] channel.c -> channel.o
In file included from include/asterisk/lock.h:663,
                from include/asterisk/utils.h:32,
                from include/asterisk/alertpipe.h:22,
                from include/asterisk/channel.h:126,
                from include/asterisk/pbx.h:26,
                from channel.c:40:
In function ‘ast_threadstorage_set_ptr’,
   inlined from ‘channel_set_intercept_mode’ at channel.c:10346:11,
   inlined from ‘ast_channel_connected_line_macro’ at channel.c:10393:2:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
 258 |         return pthread_setspecific(ts->key, ptr);
     |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
  52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
     |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                from include/asterisk/utils.h:32,
                from include/asterisk/alertpipe.h:22,
                from include/asterisk/channel.h:126,
                from include/asterisk/pbx.h:26,
                from channel.c:40:
include/asterisk/threadstorage.h: In function ‘ast_channel_connected_line_macro’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1308 | extern int pthread_setspecific (pthread_key_t __key,
     |            ^~~~~~~~~~~~~~~~~~~
In file included from include/asterisk/lock.h:663,
                from include/asterisk/utils.h:32,
                from include/asterisk/alertpipe.h:22,
                from include/asterisk/channel.h:126,
                from include/asterisk/pbx.h:26,
                from channel.c:40:
In function ‘ast_threadstorage_set_ptr’,
   inlined from ‘channel_set_intercept_mode’ at channel.c:10346:11,
   inlined from ‘ast_channel_redirecting_macro’ at channel.c:10445:2:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
 258 |         return pthread_setspecific(ts->key, ptr);
     |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
  52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
     |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                from include/asterisk/utils.h:32,
                from include/asterisk/alertpipe.h:22,
                from include/asterisk/channel.h:126,
                from include/asterisk/pbx.h:26,
                from channel.c:40:
include/asterisk/threadstorage.h: In function ‘ast_channel_redirecting_macro’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1308 | extern int pthread_setspecific (pthread_key_t __key,
     |            ^~~~~~~~~~~~~~~~~~~
In file included from include/asterisk/lock.h:663,
                from include/asterisk/utils.h:32,
                from include/asterisk/alertpipe.h:22,
                from include/asterisk/channel.h:126,
                from include/asterisk/pbx.h:26,
                from channel.c:40:
In function ‘ast_threadstorage_set_ptr’,
   inlined from ‘channel_set_intercept_mode’ at channel.c:10346:11,
   inlined from ‘ast_channel_connected_line_sub’ at channel.c:10490:2:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
 258 |         return pthread_setspecific(ts->key, ptr);
     |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
  52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
     |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                from include/asterisk/utils.h:32,
                from include/asterisk/alertpipe.h:22,
                from include/asterisk/channel.h:126,
                from include/asterisk/pbx.h:26,
                from channel.c:40:
include/asterisk/threadstorage.h: In function ‘ast_channel_connected_line_sub’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1308 | extern int pthread_setspecific (pthread_key_t __key,
     |            ^~~~~~~~~~~~~~~~~~~
In file included from include/asterisk/lock.h:663,
                from include/asterisk/utils.h:32,
                from include/asterisk/alertpipe.h:22,
                from include/asterisk/channel.h:126,
                from include/asterisk/pbx.h:26,
                from channel.c:40:
In function ‘ast_threadstorage_set_ptr’,
   inlined from ‘channel_set_intercept_mode’ at channel.c:10346:11,
   inlined from ‘ast_channel_redirecting_sub’ at channel.c:10535:2:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
 258 |         return pthread_setspecific(ts->key, ptr);
     |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
  52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
     |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                from include/asterisk/utils.h:32,
                from include/asterisk/alertpipe.h:22,
                from include/asterisk/channel.h:126,
                from include/asterisk/pbx.h:26,
                from channel.c:40:
include/asterisk/threadstorage.h: In function ‘ast_channel_redirecting_sub’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1308 | extern int pthread_setspecific (pthread_key_t __key,
     |            ^~~~~~~~~~~~~~~~~~~
{code}Because I do not even unterstand what GCC is [trying to tell|https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options] me, I cannot proceed and just report.
Comments:By: Asterisk Team (asteriskteam) 2021-10-29 03:30:58.636-0500

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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

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].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Alexander Traud (traud) 2021-10-29 03:34:35.665-0500

Forgot to mention, those happen with the current branch head(s), including ASTERISK-29682.

By: Friendly Automation (friendly-automation) 2021-11-01 09:16:08.129-0500

Change 16660 merged by Friendly Automation:
various: Fix GCC 11.2 compilation issues.

[https://gerrit.asterisk.org/c/asterisk/+/16660|https://gerrit.asterisk.org/c/asterisk/+/16660]

By: Friendly Automation (friendly-automation) 2021-11-01 09:16:38.114-0500

Change 16658 merged by Friendly Automation:
various: Fix GCC 11.2 compilation issues.

[https://gerrit.asterisk.org/c/asterisk/+/16658|https://gerrit.asterisk.org/c/asterisk/+/16658]

By: Friendly Automation (friendly-automation) 2021-11-01 09:18:33.277-0500

Change 16659 merged by Friendly Automation:
various: Fix GCC 11.2 compilation issues.

[https://gerrit.asterisk.org/c/asterisk/+/16659|https://gerrit.asterisk.org/c/asterisk/+/16659]

By: Friendly Automation (friendly-automation) 2021-11-01 09:19:24.523-0500

Change 16663 merged by Friendly Automation:
various: Fix GCC 11.2 compilation issues.

[https://gerrit.asterisk.org/c/asterisk/+/16663|https://gerrit.asterisk.org/c/asterisk/+/16663]