[RTEMS Project] #2173: Potential integer overflow problem in EDF scheduler

RTEMS trac trac at rtems.org
Sun Nov 23 16:26:56 UTC 2014


#2173: Potential integer overflow problem in EDF scheduler
-----------------------------+----------------------------
 Reporter:  sebastian.huber  |       Owner:  joel.sherrill
     Type:  defect           |      Status:  closed
 Priority:  normal           |   Milestone:  4.11
Component:  cpukit           |     Version:  HEAD
 Severity:  normal           |  Resolution:  wontfix
 Keywords:                   |
-----------------------------+----------------------------
Changes (by joel.sherrill):

 * status:  new => closed
 * resolution:   => wontfix


Old description:

> On 2014-03-21 14:46, Gedare Bloom wrote:> On Fri, Mar 21, 2014 at 9:43
> AM, Sebastian Huber
> > <sebastian.huber at embedded-brains.de>  wrote:
> [...]
> >> >I have another question regarding the EDF scheduler.  Does this work
> in case
> >> >_Watchdog_Ticks_since_boot overflows?
> >> >
> > No. For this, I think we need to use "deadline folding" which is just
> > modulo arithmetic.
> >
> >> >void _Scheduler_EDF_Release_job(
> >> >   Thread_Control    *the_thread,
> >> >   uint32_t           deadline
> >> >)
> >> >{
> >> >   Priority_Control new_priority;
> >> >
> >> >   if (deadline) {
> >> >     /* Initializing or shifting deadline. */
> >> >     new_priority = (_Watchdog_Ticks_since_boot + deadline)
> >> >                    & ~SCHEDULER_EDF_PRIO_MSB;
> >> >   }
> >> >   else {
> >> >     /* Switch back to background priority. */
> >> >     new_priority = the_thread->Start.initial_priority;
> >> >   }
> >> >
> >> >   the_thread->real_priority = new_priority;
> >> >   _Thread_Change_priority(the_thread, new_priority, true);
> >> >
> >> >}
>
> _Watchdog_Ticks_since_boot us uint32_t and overflows after 49 days with a
> one millisecond clock tick.

New description:

 On 2014-03-21 14:46, Gedare Bloom wrote:> On Fri, Mar 21, 2014 at 9:43 AM,
 Sebastian Huber
 > <sebastian.huber at embedded-brains.de>  wrote:
 [...]
 >> >I have another question regarding the EDF scheduler.  Does this work
 in case
 >> >_Watchdog_Ticks_since_boot overflows?
 >> >
 > No. For this, I think we need to use "deadline folding" which is just
 > modulo arithmetic.
 >
 >> >void _Scheduler_EDF_Release_job(
 >> >   Thread_Control    *the_thread,
 >> >   uint32_t           deadline
 >> >)
 >> >{
 >> >   Priority_Control new_priority;
 >> >
 >> >   if (deadline) {
 >> >     /* Initializing or shifting deadline. */
 >> >     new_priority = (_Watchdog_Ticks_since_boot + deadline)
 >> >                    & ~SCHEDULER_EDF_PRIO_MSB;
 >> >   }
 >> >   else {
 >> >     /* Switch back to background priority. */
 >> >     new_priority = the_thread->Start.initial_priority;
 >> >   }
 >> >
 >> >   the_thread->real_priority = new_priority;
 >> >   _Thread_Change_priority(the_thread, new_priority, true);
 >> >
 >> >}

 _Watchdog_Ticks_since_boot us uint32_t and overflows after 49 days with a
 one millisecond clock tick.

--

Comment:

 Sebastian noted this was a hardware problem. Seems to indicate problem is
 NA now.

--
Ticket URL: <http://devel.rtems.org/ticket/2173#comment:2>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list