#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 Aug 23, 2007 at 11:53:38 PM.
Implements locks needed by newlib
PR#1247-newlib-1.15.0-locking.diff (5.4 KB) - added by strauman on Aug 23, 2007 at 11:55:18 PM.
Patch to newlibc for newlib to use RTEMS locks
PR#1247-rtems-newlibc-locking-1.diff (13.8 KB) - added by strauman on Mar 6, 2008 at 9:47:00 PM.
Implements locks needed by newlib
PR#1247-newlib-1.16.0-locking-crt0add.diff (755 bytes) - added by strauman on Mar 7, 2009 at 12:18:24 AM.
*NEWLIB* - patch adding stubs to crt0.c required for RTEMS autoconf tests

Download all attachments as: .zip

Change History (14)

Changed on Aug 23, 2007 at 11:53:38 PM by strauman

Implements locks needed by newlib

Changed on Aug 23, 2007 at 11:55:18 PM by strauman

Patch to newlibc for newlib to use RTEMS locks

comment:1 Changed on Aug 23, 2007 at 11:56:34 PM by strauman

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

Changed on Mar 6, 2008 at 9:47:00 PM by strauman

Implements locks needed by newlib

comment:2 Changed on Mar 6, 2008 at 9:47:00 PM by strauman

attachments.isobsolete: 01

Changed on Mar 7, 2009 at 12:18:24 AM by strauman

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

comment:3 Changed on Mar 7, 2009 at 12:18:24 AM 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 Jun 4, 2010 at 8:54:02 PM 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 Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

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

comment:6 Changed on Feb 10, 2015 at 3:16:33 PM by Gedare Bloom

Description: modified (diff)

Sebastian/Chris: Is this still a valid problem?

Last edited on Feb 10, 2015 at 3:16:50 PM by Gedare Bloom (previous) (diff)

comment:7 Changed on Mar 2, 2015 at 8:42:45 PM by Gedare Bloom

Milestone: 4.114.11.1

bump milestone

comment:8 Changed on Jul 31, 2015 at 5:32:11 AM by Sebastian Huber

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

comment:9 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber

Milestone: 4.124.12.0

comment:10 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.