id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,blockedby,blocking 2173,Potential integer overflow problem in EDF scheduler,Sebastian Huber,Joel Sherrill,"On 2014-03-21 14:46, Gedare Bloom wrote:> On Fri, Mar 21, 2014 at 9:43 AM, Sebastian Huber > 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.",defect,closed,normal,5.1,score,4.11,normal,fixed,,,,