# Data abort exception problem in uxListRemove() function.

**URL:** <https://forums.freertos.org/t/data-abort-exception-problem-in-uxlistremove-function/7009>\
**Category:** Kernel\
**Created:** [February 19, 2018, 1:32pm UTC](https://forums.freertos.org/t/data-abort-exception-problem-in-uxlistremove-function/7009 "2018-02-19T13:32:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 19, 2018, 1:32pm UTC](https://forums.freertos.org/t/data-abort-exception-problem-in-uxlistremove-function/7009/1 "2018-02-19T13:32:25Z")

</div>

**[mongma](https://sourceforge.net/u/mongma/)** wrote on [Monday, February 19, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/0b4ec01f/#1c3f):

Hello.

I have a problem about exception.  
I am trying to debug but it’s difficult to me.  
I searched about this problem. And I found similar question.  
[https://www.freertos.org/FreeRTOS\_Support\_Forum\_Archive/August\_2014/freertos\_uxListRemove\_results\_in\_address\_exception\_20cf7379j.html](https://www.freertos.org/FreeRTOS_Support_Forum_Archive/August_2014/freertos_uxListRemove_results_in_address_exception_20cf7379j.html)  
But I couldn’t get information i want.

I’m using FreeRTOS v9.0.0 on CortexA7.  
RAM address starts at 0xF1000000  
There are 7 tasks and i use interrupt.  
configMAX\_API\_CALL\_INTERRUPT\_PRIORITY is 10.

I use xEventGroupSetBits(), xEventGroupSetBitsFromISR(), xEventGroupWaitBits() repeatedly.  
It’s working fine. But at any moment data abort exception occurs in uxListRemove().

In uxListRemove(), pxList is set to NULL because pxItemToRemove-\>pvContainer is NULL.  
Please refer to the below function.

_UBaseTypet uxListRemove( ListItemt const pxItemToRemove )  
{  
/ The list item knows which list it is in. Obtain the list from the list  
item. /  
Listt const pxList = ( Listt ) pxItemToRemove-\>pvContainer;_

It is dereferenced in below statements.

\*/ Make sure the index is left pointing to a valid item. /  
if( pxList-\>pxIndex == pxItemToRemove )  
{  
pxList-\>pxIndex = pxItemToRemove-\>pxPrevious;

The value of ListItem\_t pxItemToRemove immediately before the exception is:

xItemValue == 364074  
pxNext == 0xF10093DC (a valid RAM address)  
pxPrevious ==0xF1007DAC  
pvOwner == 0xF1009440  
pvContainer == 0

This is callstack when pxItemToRemove-\>pvContainer is NULL.  
xEventGroupWaitBits() -\> vTaskPlaceOnUnorderedEventList() -\> prvAddCurrentTaskToDelayedList() -\> uxListRemove()

I don’t know why pxItemToRemove-\>pvContainer is NULL in uxListRemove()?  
Could you advice to me about this problem?

Thank you very much.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 20, 2018, 4:56am UTC](https://forums.freertos.org/t/data-abort-exception-problem-in-uxlistremove-function/7009/2 "2018-02-20T04:56:06Z")

</div>

**[mongma](https://sourceforge.net/u/mongma/)** wrote on [Tuesday, February 20, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/0b4ec01f/#879c):

I use also configASSERT().  
I think this is not invalid interrupt priority problem. Because vPortValidateInterruptPriority() is passed successfully.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [February 20, 2018, 12:30pm UTC](https://forums.freertos.org/t/data-abort-exception-problem-in-uxlistremove-function/7009/3 "2018-02-20T12:30:00Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, February 20, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/0b4ec01f/#879c/fa00):

What should the value of the offending variable be? Could it be that it has simply been overwritten (I.e. accidentally corrupted).

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 21, 2018, 6:03am UTC](https://forums.freertos.org/t/data-abort-exception-problem-in-uxlistremove-function/7009/4 "2018-02-21T06:03:57Z")

</div>

**[mongma](https://sourceforge.net/u/mongma/)** wrote on [Wednesday, February 21, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/0b4ec01f/#879c/fa00/a0e5):

Hello, Richard  
Thank you very much for your reply.

I think (pxItemToRemove-\>pvContainer) value should be address of a List.(0xF100```)

I think I solved this problem now temporary.  
There was a problem about entering critical section.

I use vPortEnterCritical() function for enterting critical section.  
vPortEnterCritical() calls the ulPortSetInterruptMask().

ulPortSetInterruptMask() disables interrupt and sets portICCPMR\_PRIORITY\_MASK\_REGISTER.  
And then it enables interrupt.

I think critical section is not protected becasue interrupt is enabled.  
I blocked enabling interrupt in ulPortSetInterruptMask().  
And I confirmed the problem is solved.

* * *

uint32\_t ulPortSetInterruptMask( void )  
{  
uint32\_t ulReturn;

```
/* Interrupt in the CPU must be turned off while the ICCPMR is being
updated. */
portCPU_IRQ_DISABLE();
if( portICCPMR_PRIORITY_MASK_REGISTER == ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) )
{
	/* Interrupts were already masked. */
	ulReturn = pdTRUE;
}
else
{
	ulReturn = pdFALSE;
	portICCPMR_PRIORITY_MASK_REGISTER = ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT );
	__asm volatile (	"dsb \n"
						"isb \n" );
}

```

# //portCPU\_IRQ\_ENABLE(); \<------ block this line

```
return ulReturn;

```

}

* * *

I’m not sure whether this modification is correct or not.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 21, 2018, 7:11am UTC](https://forums.freertos.org/t/data-abort-exception-problem-in-uxlistremove-function/7009/5 "2018-02-21T07:11:59Z")

</div>

**[mongma](https://sourceforge.net/u/mongma/)** wrote on [Wednesday, February 21, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/0b4ec01f/#879c/fa00/a0e5/4595):

I know that ulPortSetInterruptMask() masks interrupt.  
I will check interrupt priirity and mask.

Thank you for your support.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 21, 2018, 7:13am UTC](https://forums.freertos.org/t/data-abort-exception-problem-in-uxlistremove-function/7009/6 "2018-02-21T07:13:00Z")

</div>

**[mongma](https://sourceforge.net/u/mongma/)** wrote on [Wednesday, February 21, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/0b4ec01f/#879c/fa00/a0e5/86db):

I know that ulPortSetInterruptMask() masks interrupt.  
I will check interrupt priirity and mask.

Thank you for your support.
