[PATCH rtems v2] once.c, onceimplh.h: Make synchronization variable volatile
The loop that waits for another thread to complete the once initialization was flagged as a potential infinite loop. This is because there was no way to break out of the loop inside the loop. The solution is to make the state variable volatile which indicates it may be modified by another thread of execution. This was flagged by a user Coverity Scan run which apparently is configured differently from the instance provided by Coverity to open source projects. --- cpukit/include/rtems/score/onceimpl.h | 8 ++-- cpukit/score/src/once.c | 13 - 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cpukit/include/rtems/score/onceimpl.h b/cpukit/include/rtems/score/onceimpl.h index 9552cc0a67..5c716ce40a 100644 --- a/cpukit/include/rtems/score/onceimpl.h +++ b/cpukit/include/rtems/score/onceimpl.h @@ -64,11 +64,15 @@ extern "C" { * Once_Information_Mutex. * * @param once_state The once state. - * @param init_routine The initialization routine called if @a once_state is ONCE_STATE_INIT. + * @param init_routine The initialization routine called if @a once_state + * is ONCE_STATE_INIT. * * @return This method always returns zero upon termination. */ -int _Once( unsigned char *once_state, void ( *init_routine )( void ) ); +int _Once( + volatile unsigned char *once_state, + void ( *init_routine )( void ) +); /** @} */ diff --git a/cpukit/score/src/once.c b/cpukit/score/src/once.c index a395197c3a..10a5c4fee6 100644 --- a/cpukit/score/src/once.c +++ b/cpukit/score/src/once.c @@ -75,7 +75,10 @@ static void _Once_Unlock( Thread_Life_state thread_life_state ) _Thread_Set_life_protection( thread_life_state ); } -int _Once( unsigned char *once_state, void ( *init_routine )( void ) ) +int _Once( + volatile unsigned char *once_state, + void ( *init_routine )( void ) +) { _Atomic_Fence( ATOMIC_ORDER_ACQUIRE ); @@ -93,6 +96,14 @@ int _Once( unsigned char *once_state, void ( *init_routine )( void ) ) *once_state = ONCE_STATE_COMPLETE; rtems_condition_variable_broadcast( &_Once_Information.State ); } else { + /* + * This is flagged as an infinite loop by at least Coverity. It is + * not an infinite loop because *once_state is set by another + * thread. This loop is used when a second thread concurrently + * attempts to process a once variable while it is in the process + * of being initialized. The second and subsequent threads block + * until the broadcast above is executed. + */ while ( *once_state != ONCE_STATE_COMPLETE ) { rtems_condition_variable_wait( &_Once_Information.State, -- 2.31.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH rtems-source-builder] rtems-mipstx39-gdb-head.bset: Add missing file
Pushed. Thanks. On Sun, Nov 19, 2023 at 5:44 PM Chris Johns wrote: > Looks good and thanks > > Chris > > On 18/11/2023 5:11 am, Joel Sherrill wrote: > > This configuration file was missing for the mipstx39 gdb build for the > > head/7 tools. > > > > Closes #4935. > > --- > > rtems/config/tools/rtems-mipstx39-gdb-head.bset | 7 +++ > > 1 file changed, 7 insertions(+) > > create mode 100644 rtems/config/tools/rtems-mipstx39-gdb-head.bset > > > > diff --git a/rtems/config/tools/rtems-mipstx39-gdb-head.bset > b/rtems/config/tools/rtems-mipstx39-gdb-head.bset > > new file mode 100644 > > index 000..252967c > > --- /dev/null > > +++ b/rtems/config/tools/rtems-mipstx39-gdb-head.bset > > @@ -0,0 +1,7 @@ > > +%define release 1 > > +%define rtems_arch mips > > +%define gdb-sim-options --enable-sim-hardware > > +%define win32-gdb-disable-sim > > +%define _target mipstx39-rtems%{rtems_version} > > +devel/gmp-6.2.1 > > +tools//rtems-gdb-head > ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v2] sb: Fix Python 3.12 safeConfigParser and invalid escape sequences
From: Chris Johns Updates #4968 --- source-builder/sb/pkgconfig.py | 4 ++-- source-builder/sb/version.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source-builder/sb/pkgconfig.py b/source-builder/sb/pkgconfig.py index 198ec80..bfe769f 100755 --- a/source-builder/sb/pkgconfig.py +++ b/source-builder/sb/pkgconfig.py @@ -90,7 +90,7 @@ class package(object): get_recursion = ['cflags', 'libs'] no_dup_flags = ['-I', '-l', '-L'] dual_opts = ['-D', '-U', '-I', '-l', '-L'] -lib_list_splitter = re.compile('[\s,]+') +lib_list_splitter = re.compile(r'[\s,]+') loaded_prefixes = None loaded = {} @@ -514,7 +514,7 @@ class package(object): return None s = '' if self.file_: -mre = re.compile('\$\{[^\}]+\}') +mre = re.compile(r'\$\{[^\}]+\}') s = self.fields[label.lower()] expanded = True tm = False diff --git a/source-builder/sb/version.py b/source-builder/sb/version.py index 4ec7cfa..eb6a17d 100644 --- a/source-builder/sb/version.py +++ b/source-builder/sb/version.py @@ -110,7 +110,7 @@ def _load_released_version_config(): import configparser except ImportError: import ConfigParser as configparser -v = configparser.SafeConfigParser() +v = configparser.ConfigParser() try: v.read(path.host(ver)) except Exception as e: -- 2.37.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] python: Updates for Python 3.12
From: Chris Johns - Change SafeConfigParser to ConfigParser - Fix escape sequences in strings Updates #4968 --- linkers/wscript | 2 +- misc/wscript | 2 +- rtemstoolkit/configuration.py | 2 +- rtemstoolkit/version.py | 2 +- rtemstoolkit/wscript | 2 +- trace/wscript | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/linkers/wscript b/linkers/wscript index 8591d60..2d2d7f0 100644 --- a/linkers/wscript +++ b/linkers/wscript @@ -178,4 +178,4 @@ def build(bld): use = modules) def tags(ctx): -ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) +ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True) diff --git a/misc/wscript b/misc/wscript index 21e7f75..5775dcf 100644 --- a/misc/wscript +++ b/misc/wscript @@ -92,4 +92,4 @@ def build(bld): 'tools/config/rtems-boot.ini') def tags(ctx): -ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) +ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True) diff --git a/rtemstoolkit/configuration.py b/rtemstoolkit/configuration.py index 1f57de4..ba38104 100644 --- a/rtemstoolkit/configuration.py +++ b/rtemstoolkit/configuration.py @@ -57,7 +57,7 @@ class configuration: else: self.config = configparser.ConfigParser() self.ini = None -self.macro_filter = re.compile('\$\{[^\}]+\}') +self.macro_filter = re.compile(r'\$\{[^\}]+\}') def __str__(self): if self.ini is None: diff --git a/rtemstoolkit/version.py b/rtemstoolkit/version.py index 56cf97f..51188bf 100644 --- a/rtemstoolkit/version.py +++ b/rtemstoolkit/version.py @@ -116,7 +116,7 @@ def _load_released_version_config(): os.path.join('..', 'VERSION'), rtems.configuration_file('rtems-version.ini')]: if path.exists(path.join(ver)): -v = configparser.SafeConfigParser() +v = configparser.ConfigParser() try: v.read(path.host(ver)) except Exception as e: diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript index bd7254b..0a27853 100644 --- a/rtemstoolkit/wscript +++ b/rtemstoolkit/wscript @@ -168,7 +168,7 @@ def rebuild(ctx): waflib.Options.commands.extend(['clean', 'build']) def tags(ctx): -ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) +ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True) # # Libelf module. diff --git a/trace/wscript b/trace/wscript index a3dd5d5..0c0e4b4 100644 --- a/trace/wscript +++ b/trace/wscript @@ -101,4 +101,4 @@ def build(bld): lib = conf['lib']) def tags(ctx): -ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) +ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True) -- 2.37.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel