1. 16 Mar, 2018 1 commit
    • Philippe Gerum's avatar
      copperplate/threadobj: fix NULL dereference in threadobj_unblock() · 945c7dbf
      Philippe Gerum authored
      threadobj_unblock() simply does not work, dereferencing a NULL pointer
      whenever it actually manages to unblock a thread waiting on a
      synchronization object.
      
      Calling syncobj_flush() on this object to wake up waiters zeroes the
      wait_sobj field in the corresponding TCBs, so don't dereference
      thobj->wait_sobj past this point.
      
      Thread 1 "main" received signal SIGSEGV, Segmentation fault.
      0x00007ffff79aeda0 in __syncobj_tag_unlocked (sobj=0x0) at include/copperplate/syncobj.h:100
      100		assert(sobj->flags & SYNCOBJ_LOCKED);
      (gdb) bt
      945c7dbf
  2. 29 Sep, 2017 1 commit
    • Philippe Gerum's avatar
      include/boilerplate: strip private APIs out of public headers · 1ed69a66
      Philippe Gerum authored
      Some private Xenomai APIs are known to enter namespace conflicts with
      C++ frameworks used by client real-time applications, e.g. Boost.
      
      Instead of polluting the namespace even more by prefixing all private
      definitions, hide them from the public scope by moving them to their
      own separate headers, only the Xenomai C implementation should pull.
      
      This commit only partially addresses the general issue, more work
      remains to be done in this direction to fix all potential conflicts.
      1ed69a66
  3. 24 Sep, 2017 1 commit
  4. 07 Jul, 2016 1 commit
  5. 21 Apr, 2016 1 commit
  6. 09 Feb, 2016 1 commit
  7. 28 Dec, 2015 2 commits
  8. 21 Sep, 2015 1 commit
  9. 14 Sep, 2015 1 commit
    • Philippe Gerum's avatar
      copperplate: enable group-based access to sessions · cf21e806
      Philippe Gerum authored
      Passing --session foo/<group> will allow the members of the designated
      UNIX group to attach the shared heap and use the Copperplate services
      within a particular session.
      
      <group> may be a valid GID or group name from /etc/group.  With
      Cobalt, such group would typically match the xenomai.allowed_group
      parameter passed to the kernel.
      
      To set up a shared session involving non-privileged users, all of them
      must be members of a dedicated UNIX group, and the following
      operations should be carried out:
      
      1. if using Cobalt, pass xenomai.gid=<group-id> on the kernel command
      line accordingly
      
      2. set udev rules to chown+chmod /dev/rtdm/* files with proper group
      permissions (e.g. for user group "xenomai" => SUBSYSTEM=="rtdm",
      MODE="0660", GROUP="xenomai")
      
      3. create the registry root manually with proper permissions, 1777 is
      recommended if non-privileged processes will belong to the session
      
      4. if --shared-registry is required from a non-privileged session
      initiator (i.e. the first process establishing the session), set
      user_allow_other in /etc/fuse.conf
      
      5. to start a session with group-based access control, suffix the
      session name with the allowed group name or id separated with a slash
      ('/') when starting the session initiator, i.e. --session
      name/<group-id|group-name>.
      
      For instance, with {user} a member of the "xenomai" group:
      
      /* The initiator of session 'foo' is [root] */
      [root] ./program --session foo/xenomai
      
      /* Bind a non-privileged process from {user} to session 'foo' */
      {user} ./program --session foo
      
      Or, with {user1} and {user2} both members of the "xenomai" group:
      
      /* The initiator of session 'foo' is {user1} */
      {user1} ./program --session foo/xenomai
      
      /* Bind a process from {user2} to session 'foo' */
      {user2} ./program --session foo
      cf21e806
  10. 25 Aug, 2015 2 commits
  11. 18 Jul, 2015 2 commits
  12. 16 Jul, 2015 1 commit
  13. 19 Jun, 2015 1 commit
  14. 02 Jun, 2015 1 commit
  15. 02 May, 2015 1 commit
    • Philippe Gerum's avatar
      copperplate/threadobj: prevent priority inversion in threadobj_cancel() · d3a61fef
      Philippe Gerum authored
      We provide a guarantee to threadobj_cancel() callers that the killed
      thread has actually exited when the call returns.
      
      This change fixes an issue with L < M < H priority threads, with H
      calling threadobj_cancel() on L, while M is spinning. To address this,
      we boost L to H's priority before waiting for the "deletion confirmed"
      event, which is sent from L's finalizer.
      d3a61fef
  16. 23 Jan, 2015 2 commits
  17. 23 Sep, 2014 1 commit
  18. 18 Aug, 2014 1 commit
    • Philippe Gerum's avatar
      cobalt, mercury: enable uClibc, NPTL/linuxthreads builds · f8481807
      Philippe Gerum authored
      We allow building the Xenomai libraries and programs against uClibc
      and glibc-based toolchains for both Cobalt and Mercury
      configurations. We cope with NPTL and legacy linuxthreads for both as
      well.
      
      To this end, this patch moves all libc quirks to a separate header.
      f8481807
  19. 17 Aug, 2014 1 commit
  20. 06 Aug, 2014 1 commit
  21. 05 Aug, 2014 1 commit
    • Philippe Gerum's avatar
      copperplate: work-around glibc race in cancel state handling · 75cc5dac
      Philippe Gerum authored
      This is a SMP race which seems to affect NPTL-based glibc releases
      (2.9 and 2.18 checked, other releases are likely concerned as
      well). The issue requires SMP setups to pop up, when
      --enable-async-cancel is mentioned on the Xenomai build configuration
      line. It was detected over the Mercury core, not checked on the Cobalt
      core. The work-around will fit both.
      
      The bug creates a situation where
      pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, ...) does not actually
      prevent subsequent asynchronous cancellation of the caller, in the
      following scenario:
      
      threadB has its cancellability set to PTHREAD_CANCEL_ENABLE,
      PTHREAD_CANCEL_ASYNCHRONOUS on entry:
      
      threadA[CPU0]: pthread_cancel(threadB)
      		(SIGCANCEL queued to threadB[CPU1])
      threadB[CPU1]: pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL)
      		(SIGCANCEL delivered to threadB[CPU1])
      		<sigcancel_handler>
      			if (cancel_type(threadB) == PTHREAD_CANCEL_ASYNCHRONOUS)
      				__do_cancel();
      			...
      
      As illustra...
      75cc5dac
  22. 03 Aug, 2014 1 commit
  23. 02 Aug, 2014 1 commit
  24. 29 Jul, 2014 1 commit
  25. 07 Jul, 2014 1 commit
    • Philippe Gerum's avatar
      lib/cobalt: restrict sched_get_priority_min/max() range for SCHED_FIFO/RR · f84627ce
      Philippe Gerum authored
      Increasing the values returned by the sched_get_priority_max() wrapper
      above the glibc limit breaks the basic assumption that such value
      could be used with pthread_create(), which is wrong.
      
      When an overlap exist for some scheduling policies (i.e. SCHED_FIFO,
      RR) between Cobalt and glibc interface, we must differentiate calls
      for obtaining the static range complying with the glibc, from those
      for dealing specifically with those policies if Cobalt extends them.
      
      This translates to:
      
      sched_get_priority_max(SCHED_FIFO/RR) => 99
      sched_get_priority_max_ex(SCHED_FIFO/RR) => 256
      f84627ce
  26. 06 Jul, 2014 1 commit
  27. 03 Jul, 2014 3 commits
  28. 01 Jul, 2014 1 commit
    • Philippe Gerum's avatar
      cobalt: fix naming consistency issues with *_np() calls · 50bd5540
      Philippe Gerum authored
      To match the GNU extension equivalent, pthread_set_name_np() is
      renamed to pthread_setname_np(). For consistency with the previous
      change, pthread_set_mode_np() becomes pthread_setmode_np().
      
      The former calls will be available from the upcoming transition kit.
      50bd5540
  29. 16 Jun, 2014 1 commit
  30. 02 Jun, 2014 1 commit
  31. 27 May, 2014 1 commit
  32. 26 May, 2014 2 commits
    • Philippe Gerum's avatar
      copperplate/threadobj: set global priority to weighted value over Cobalt · d8e207dd
      Philippe Gerum authored
      This fixes a long-standing issue with Cobalt-based systems, by having
      threads wait on syncobj resources by priority values weighted by the
      core priority of the scheduling class they belong to.
      
      e.g. SCHED_FIFO,99 has higher priority than SCHED_QUOTA,99, and
      obviously even higher than SCHED_WEAK,99.
      d8e207dd
    • Philippe Gerum's avatar
      copperplate: substitute SCHED_RT with SCHED_FIFO · 0ee9288d
      Philippe Gerum authored
      Now that Cobalt supports up to 256 priority levels with the SCHED_FIFO
      class, we may assign all regular real-time threads directly to the
      latter.
      
      SCHED_CORE is introduced as an alias to the scheduling class giving
      access to the highest priority levels assigned to internal server
      threads.
      0ee9288d
  33. 22 May, 2014 1 commit