#1247 closed defect (fixed)

RTEMS does not implement locks needed by multithreaded newlib

Reported by: strauman Owned by: Chris Johns
Priority: highest Milestone: 5.1
Component: fs Version: 4.5
Severity: critical Keywords:
Cc: chrisj@… Blocked By:
Blocking:

Description (last modified by Gedare Bloom)

multi-threaded newlib protects a number of internal data structures
(as of newlib-1.15 these comprise:

  • global list of FILE objects
  • stdio FILE object initializer
  • individual FILEs [since FILEs with the exception of stdin/stdout/stderr are per-process entities]
  • global hash table used by telldir/seekdir
  • individual DIR structures (opendir/readdir)
  • atexit list
  • list of environment variables
  • global timezone variable

)
using mutexes. It expects the OS to implement these locks but defaults
to not using locking if the OS does not provide an implementation.
Currently, RTEMS does *not* provide its own implementation of 'sys/lock.h'
and therefore vital data structures in newlib are currently *unprotected*
(with the exception of environment variables -- 'envlock.c' had been
added to RTEMS a while ago but since then, newlib has introduced more
locks and a general OS interface which - once implemented - will obsolete
'envlock.c').

Note that while semantics of having no protection for individual FILE
objects may be tolerable, having no protection for global newlib data
structures such as lists of FILEs is not acceptable.

I am currently working on an implementation which should be available shortly.

Attachments (4)

PR#1247-rtems-newlibc-locking.diff (11.1 KB) - added by strauman on 08/23/07 at 23:53:38.
Implements locks needed by newlib
PR#1247-newlib-1.15.0-locking.diff (5.4 KB) - added by strauman on 08/23/07 at 23:55:18.
Patch to newlibc for newlib to use RTEMS locks
PR#1247-rtems-newlibc-locking-1.diff (13.8 KB) - added by strauman on 03/06/08 at 21:47:00.
Implements locks needed by newlib
PR#1247-newlib-1.16.0-locking-crt0add.diff (755 bytes) - added by strauman on 03/07/09 at 00:18:24.
*NEWLIB* - patch adding stubs to crt0.c required for RTEMS autoconf tests

Download all attachments as: .zip

Change History (14)

Changed on 08/23/07 at 23:53:38 by strauman

Implements locks needed by newlib

Changed on 08/23/07 at 23:55:18 by strauman

Patch to newlibc for newlib to use RTEMS locks

comment:1 Changed on 08/23/07 at 23:56:34 by strauman

attachments.ispatch: 01
attachments.mimetype: text/x-patchtext/plain

Changed on 03/06/08 at 21:47:00 by strauman

Implements locks needed by newlib

comment:2 Changed on 03/06/08 at 21:47:00 by strauman

attachments.isobsolete: 01

Changed on 03/07/09 at 00:18:24 by strauman

*NEWLIB* - patch adding stubs to crt0.c required for RTEMS autoconf tests

comment:3 Changed on 03/07/09 at 00:18:24 by strauman

This patch (to *newlib*) is required (in addition to the previously posted newlib patch) to help RTEMS autoconf tests. These tests try to link specific functions from newlib in order to determine if newlib provides them. Some functions require the newlib locks, however, and linkage would fail unless stubs for the locking routines are present in crt0. Such stubs are what this patch provides.

comment:4 Changed on 06/04/10 at 20:54:02 by Chris Johns

Component: cpukitfilesystem
Milestone: 4.74.11
Owner: changed from Joel Sherrill to Chris Johns
Status: newassigned, chrisj@rtems.org
Version: 4.7HEAD

comment:5 Changed on 11/24/14 at 18:58:28 by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:6 Changed on 02/10/15 at 15:16:33 by Gedare Bloom

Description: modified (diff)

Sebastian/Chris?: Is this still a valid problem?

Version 0, edited on 02/10/15 at 15:16:33 by Gedare Bloom (next)

comment:7 Changed on 03/02/15 at 20:42:45 by Gedare Bloom

Milestone: 4.114.11.1

bump milestone

comment:8 Changed on 07/31/15 at 05:32:11 by Sebastian Huber

Milestone: 4.11.14.12
Resolution: fixed
Status: assignedclosed
Version: 4.114.5

comment:9 Changed on 05/11/17 at 07:31:02 by Sebastian Huber

Milestone: 4.124.12.0

comment:10 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.