Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Potential crash in xTaskResumeAll !!!???

Posted by Nobody/Anonymous on April 17, 2006
Can someone please check the following:

in xTaskResumeAll(...)
...
vListRemove( &( pxTCB->xEventListItem ) );


!!! If the task was not listed in any event list (vTaskDelay for example), the vListRemove will incorrectly remove it from previous event list, or worse yet, it might incorrectly modify unknown region if the pxNext and pxPrevious was not initialized.
Please look also in:

in vListRemove(...)
...
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;

!!! The pxNext pointer may be pointing to nothing or to an old link (to pxListEnd of a waiting list in a queue for example).


Please check, Thank you.

RE: Potential crash in xTaskResumeAll !!!???

Posted by Richard on April 17, 2006
> Can someone please check the following:
>
> in xTaskResumeAll(...)
> ...
> vListRemove( &( pxTCB->xEventListItem ) );
>
>
> !!! If the task was not listed in any event list (vTaskDelay for example), the
> vListRemove will incorrectly remove it from previous event list, or worse yet,
> it might incorrectly modify unknown region if the pxNext and pxPrevious was
> not initialized.


This line of code removes tasks from the pending ready list. When the scheduler is locked the ready and delayed lists cannot be modified so tasks that are woken by events are placed in the pending ready list to wait for the scheduler to become unlocked. As the ready and delayed lists cannot be modified tasks cannot be placed in the pending ready list using their generic list item, so are instead placed in the pending ready list using their event list item. The line of code you refer to follows a while loop, that obtains the event list item from the pending ready list, then removes it from the pending ready list. As the event list item came from the pending ready list it must be referenced from the list and vListRemove() is valid.

Places where tasks get added to the pending ready list:

+ vTaskPrioritySet() - here the pending ready list is used if the task is currently in a ready list. When a task is in a ready list the event list item is free and can therefore be legitimately used to place the task in the pending ready list.

+ vTaskResume() - here the pending ready list is used for a task that was previously in the suspended list. Again when a task is in the suspended list the event list item is free and can therefore be legitimately used to place the task in the pending ready list.

+ xTaskRemoveFromEventList() - here the event list item is removed from an event list and placed in the pending ready list. Again this is therefore valid as the event list is removed from one list before being inserted into another.


> Please look also in:
>
> in vListRemove(...)
> ...
> pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
>
> !!! The pxNext pointer may be pointing to nothing or to an old link (to pxListEnd
> of a waiting list in a queue for example).

The pxNext pointer never points to nothing as the list is circular. If you are finding that pxNext points to nothing than an error has occurred prior to this statement being processed.

Regards.

RE: Potential crash in xTaskResumeAll !!!???

Posted by Nobody/Anonymous on April 17, 2006
Glad to read that my worries are unfounded.
Thanks.

I was implementing a DoubleQueueWait (waiting for two queues) when I found that second use of xEventListItem during some greps.
Just to make sure I didn't screw things up,
I'll post the patch as soon as I feel comfortable with it.

RE: Potential crash in xTaskResumeAll !!!???

Posted by Nobody/Anonymous on April 17, 2006
Here it is,

https://sourceforge.net/forum/forum.php?thread_id=1248938&forum_id=382005


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists